summaryrefslogtreecommitdiff
path: root/client/widgets/combobox.cc
diff options
context:
space:
mode:
authordeva <deva>2010-08-31 09:34:19 +0000
committerdeva <deva>2010-08-31 09:34:19 +0000
commit43e82b32f2d812225e6d7ef76efdbf4873efc343 (patch)
treedf5ace9b3fb39b7e58145c185e63e2ce5a8d8466 /client/widgets/combobox.cc
parentf3847624ee5f99a37cf60be52067ad19bcdb4446 (diff)
luaComboBox and luaDB fixes and improvements.
Diffstat (limited to 'client/widgets/combobox.cc')
-rw-r--r--client/widgets/combobox.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/client/widgets/combobox.cc b/client/widgets/combobox.cc
index b625848..9d783a2 100644
--- a/client/widgets/combobox.cc
+++ b/client/widgets/combobox.cc
@@ -64,6 +64,8 @@ ComboBox::ComboBox(QDomNode &node, MacroWindow *macrowindow)
combobox = new MyQComboBox();
widget = combobox;
+ ignoreChangeEvents = false;
+
setCommonAttributes(combobox, node);
#ifdef STYLE_HACK
@@ -191,12 +193,18 @@ bool ComboBox::preValid()
void ComboBox::changed()
{
+ if(ignoreChangeEvents == true) return;
+
+ WARN(ComboBox, "changed");
if(ischangingbyuser) emit wasChanged();
emit eventOnChange();
}
bool ComboBox::eventFilter(QObject *obj, QEvent *event)
{
+ if(ignoreChangeEvents == true) return false;
+
+ WARN(ComboBox, "eventFilter");
if(combotype == SELECT) {
if(event->type() == QEvent::MouseButtonRelease) {
if(enabled()) combobox->showPopup();
@@ -208,6 +216,9 @@ bool ComboBox::eventFilter(QObject *obj, QEvent *event)
void ComboBox::changeEvent(QEvent *event)
{
+ if(ignoreChangeEvents == true) return;
+
+ WARN(ComboBox, "changeEvent");
if(event->type() == QEvent::EnabledChange) {
changed();
}
@@ -231,10 +242,31 @@ void ComboBox::setWdgValid(bool valid)
void ComboBox::clear()
{
+ ignoreChangeEvents = true;
+ WARN(ComboBox, "clear");
combobox->clear();
+ ignoreChangeEvents = false;
}
void ComboBox::addItem(QString item)
{
+ ignoreChangeEvents = true;
combobox->addItem(item, item);
+ ignoreChangeEvents = false;
+}
+
+QString ComboBox::lineEditValue()
+{
+ if(combobox->lineEdit()) return combobox->lineEdit()->text();
+ return "";
+
+}
+
+void ComboBox::setLineEditValue(QString value)
+{
+ if(combobox->lineEdit()) {
+ ignoreChangeEvents = true;
+ combobox->lineEdit()->setText(value);
+ ignoreChangeEvents = false;
+ }
}