summaryrefslogtreecommitdiff
path: root/client/widgets/combobox.cc
diff options
context:
space:
mode:
authordeva <deva>2008-08-20 10:28:35 +0000
committerdeva <deva>2008-08-20 10:28:35 +0000
commit3eebecacd576c35605aff01324ec66ad9825b0d7 (patch)
treea4f58503967707cdc1ecab07a0b15b67d32bdab6 /client/widgets/combobox.cc
parent45702265ce206381bcb02a53b413ad987897b02b (diff)
Fixed various small bugs.
Diffstat (limited to 'client/widgets/combobox.cc')
-rw-r--r--client/widgets/combobox.cc25
1 files changed, 16 insertions, 9 deletions
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 <QRegExpValidator>
#include <QRegExp>
-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 {