From 3eebecacd576c35605aff01324ec66ad9825b0d7 Mon Sep 17 00:00:00 2001 From: deva Date: Wed, 20 Aug 2008 10:28:35 +0000 Subject: Fixed various small bugs. --- client/widgets/combobox.cc | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'client/widgets/combobox.cc') diff --git a/client/widgets/combobox.cc b/client/widgets/combobox.cc index d6d6483..39a957b 100644 --- a/client/widgets/combobox.cc +++ b/client/widgets/combobox.cc @@ -30,12 +30,6 @@ #include #include -typedef enum { - SELECT, - EDIT, - SEARCH -} types_t; - ComboBox::ComboBox(QDomNode &node, MacroWindow *macrowindow) : QComboBox(), Widget(node, macrowindow) { @@ -51,6 +45,13 @@ ComboBox::ComboBox(QDomNode &node, MacroWindow *macrowindow) setMinimumHeight(elem.attribute("height").toInt()); } + if(elem.hasAttribute("help")) { + setWhatsThis(elem.attribute("help")); + } + if(elem.hasAttribute("help")) { + // setToolTip(elem.attribute("help")); + } + QDomNodeList children = node.childNodes(); QStringList itemlist; @@ -73,7 +74,7 @@ ComboBox::ComboBox(QDomNode &node, MacroWindow *macrowindow) } */ - types_t combotype = SELECT; + combotype = SELECT; if(elem.hasAttribute("type")) { if(elem.attribute("type") == "select") combotype = SELECT; if(elem.attribute("type") == "edit") combotype = EDIT; @@ -83,7 +84,7 @@ ComboBox::ComboBox(QDomNode &node, MacroWindow *macrowindow) switch(combotype) { case SELECT: setEditable(false); - //connect(this, SIGNAL(currentIndexChanged(QString)), this, SLOT(changed())); + connect(this, SIGNAL(currentIndexChanged(QString)), this, SLOT(changed())); break; case EDIT: @@ -136,14 +137,20 @@ void ComboBox::setValue(QString value) bool ComboBox::isValid() { + if(combotype == SELECT) return true; return rx.exactMatch(currentText()); } void ComboBox::changed() { + if(combotype == SELECT) { + luaValidator(); + return; + } + QPalette palette; - if(isValid()) { + if(isValid() && luaValidator()) { // valid string palette.setBrush(QPalette::Base, QBrush(QColor(255, 255, 255))); } else { -- cgit v1.2.3