diff options
author | deva <deva> | 2008-08-21 08:47:40 +0000 |
---|---|---|
committer | deva <deva> | 2008-08-21 08:47:40 +0000 |
commit | 188070b4de5cf878ac3259ce39359106dc6f6643 (patch) | |
tree | ec7e0aa7ba91743d6204bf5176a9fa374ea38507 | |
parent | d92fc946f1574370cd780697d0a7e218847418c8 (diff) |
Updated fix failing initial set on combobox, to not trigger event on construction.
-rw-r--r-- | client/widgets/combobox.cc | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/client/widgets/combobox.cc b/client/widgets/combobox.cc index aff5c7b..81995c6 100644 --- a/client/widgets/combobox.cc +++ b/client/widgets/combobox.cc @@ -84,11 +84,19 @@ ComboBox::ComboBox(QDomNode &node, MacroWindow *macrowindow) switch(combotype) { case SELECT: setEditable(false); + + // Hack to force currentIndexChanged event. + setCurrentIndex(-1); + connect(this, SIGNAL(currentIndexChanged(QString)), this, SLOT(changed())); break; case EDIT: setEditable(true); + + // Hack to force currentIndexChanged event. + setCurrentIndex(-1); + connect(this, SIGNAL(editTextChanged(QString)), this, SLOT(changed())); //setEditText(elem.attribute("value")); break; @@ -111,13 +119,14 @@ ComboBox::ComboBox(QDomNode &node, MacroWindow *macrowindow) setCompleter(completer); setValidator(new QRegExpValidator(rx, this)); } + + // Hack to force currentIndexChanged event. + setCurrentIndex(-1); + connect(this, SIGNAL(editTextChanged(QString)), this, SLOT(changed())); //setEditText(elem.attribute("value")); break; } - - // Hack to force currentIndexChanged event. - setCurrentIndex(-1); } QString ComboBox::getValue() @@ -159,7 +168,7 @@ void ComboBox::changed() palette.setBrush(QPalette::Base, QBrush(QColor(255, 255, 255))); } else { // invalid string - palette.setBrush(QPalette::Base, QBrush(QColor(200, 230, 200))); + palette.setBrush(QPalette::Base, QBrush(QColor(230, 200, 200))); } setPalette(palette); |