diff options
Diffstat (limited to 'client/widgets')
-rw-r--r-- | client/widgets/combobox.cc | 32 | ||||
-rw-r--r-- | client/widgets/combobox.h | 4 |
2 files changed, 36 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; + } } diff --git a/client/widgets/combobox.h b/client/widgets/combobox.h index 02b4ccd..ec8c9ba 100644 --- a/client/widgets/combobox.h +++ b/client/widgets/combobox.h @@ -50,6 +50,9 @@ public: QString value(); void setValue(QString value, QString source = ""); + QString lineEditValue(); + void setLineEditValue(QString value); + bool preValid(); void setWdgValid(bool valid); @@ -71,6 +74,7 @@ private: bool ischangingbyuser; QComboBox *combobox; + bool ignoreChangeEvents; }; #endif/*__PRACRO_COMBOBOX_H__*/ |