diff options
| -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); | 
