summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordeva <deva>2008-12-03 08:46:12 +0000
committerdeva <deva>2008-12-03 08:46:12 +0000
commitf5bb02dc533f136311682e8801c2d9834e3be691 (patch)
treeb4d2207eb885860b58911c34be2c237a6e1b8b03
parent71649bf93bbbf871f48e1e94f4a42aa2534d5370 (diff)
Fixed onchange in altcombobox and checkbox.
-rw-r--r--client/widgets/altcombobox.cc11
-rw-r--r--client/widgets/altcombobox.h1
-rw-r--r--client/widgets/checkbox.cc6
-rw-r--r--client/widgets/checkbox.h2
-rw-r--r--client/widgets/combobox.cc2
5 files changed, 18 insertions, 4 deletions
diff --git a/client/widgets/altcombobox.cc b/client/widgets/altcombobox.cc
index 1dc874f..e3b1eb7 100644
--- a/client/widgets/altcombobox.cc
+++ b/client/widgets/altcombobox.cc
@@ -109,6 +109,7 @@ AltComboBox::AltComboBox(QDomNode &node, MacroWindow *macrowindow)
}
connect(combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(onValueChange(int)));
+ connect(combobox, SIGNAL(editTextChanged(const QString&)), this, SLOT(onValueChange(const QString&)));
layout()->setContentsMargins(0,0,0,0);
altframe->layout()->setContentsMargins(0,0,0,0);
@@ -166,6 +167,16 @@ void AltComboBox::onValueChange(int index)
}
}
+void AltComboBox::onValueChange(const QString &text)
+{
+ int index = combobox->findText(text);
+ if(index != -1 && combobox->itemData(index).toString() == altvalue) {
+ altframe->setEnabled(true);
+ } else {
+ altframe->setEnabled(false);
+ }
+}
+
void AltComboBox::enable()
{
setEnabled(true);
diff --git a/client/widgets/altcombobox.h b/client/widgets/altcombobox.h
index c75b964..222c797 100644
--- a/client/widgets/altcombobox.h
+++ b/client/widgets/altcombobox.h
@@ -51,6 +51,7 @@ public:
public slots:
void onValueChange(int index);
+ void onValueChange(const QString &text);
private:
ComboBox *combobox;
diff --git a/client/widgets/checkbox.cc b/client/widgets/checkbox.cc
index e439159..1b8d64b 100644
--- a/client/widgets/checkbox.cc
+++ b/client/widgets/checkbox.cc
@@ -75,12 +75,12 @@ void CheckBox::setValue(QString value)
// If set operation did not change the value we must invocate the code manually.
if(old == isChecked()) state_change();
}
-
+/*
bool CheckBox::isValid()
{
- return true;
+ return luaValidator();
}
-
+*/
void CheckBox::state_change()
{
luaValidator();
diff --git a/client/widgets/checkbox.h b/client/widgets/checkbox.h
index dca42d1..89f1f1b 100644
--- a/client/widgets/checkbox.h
+++ b/client/widgets/checkbox.h
@@ -37,7 +37,7 @@ Q_OBJECT
public:
CheckBox(QDomNode &node, MacroWindow *macrowindow);
- bool isValid();
+ // bool isValid();
QString getValue();
void setValue(QString value);
diff --git a/client/widgets/combobox.cc b/client/widgets/combobox.cc
index a1a69af..630a449 100644
--- a/client/widgets/combobox.cc
+++ b/client/widgets/combobox.cc
@@ -123,6 +123,8 @@ void ComboBox::setValue(QString value)
{
int idx = findData(value);
+ printf("setValue(\"%s\") - %d\n", value.toStdString().c_str(), idx);
+
setCurrentIndex(idx);
}