From f5bb02dc533f136311682e8801c2d9834e3be691 Mon Sep 17 00:00:00 2001 From: deva Date: Wed, 3 Dec 2008 08:46:12 +0000 Subject: Fixed onchange in altcombobox and checkbox. --- client/widgets/altcombobox.cc | 11 +++++++++++ client/widgets/altcombobox.h | 1 + client/widgets/checkbox.cc | 6 +++--- client/widgets/checkbox.h | 2 +- client/widgets/combobox.cc | 2 ++ 5 files changed, 18 insertions(+), 4 deletions(-) (limited to 'client/widgets') 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); } -- cgit v1.2.3