summaryrefslogtreecommitdiff
path: root/client/widgets/combobox.cc
diff options
context:
space:
mode:
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 {