From 43e82b32f2d812225e6d7ef76efdbf4873efc343 Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 31 Aug 2010 09:34:19 +0000 Subject: luaComboBox and luaDB fixes and improvements. --- client/widgets/combobox.cc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'client/widgets/combobox.cc') 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; + } } -- cgit v1.2.3