From 188070b4de5cf878ac3259ce39359106dc6f6643 Mon Sep 17 00:00:00 2001 From: deva Date: Thu, 21 Aug 2008 08:47:40 +0000 Subject: Updated fix failing initial set on combobox, to not trigger event on construction. --- client/widgets/combobox.cc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'client/widgets') 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); -- cgit v1.2.3