summaryrefslogtreecommitdiff
path: root/client/widgets/radiobuttons.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/widgets/radiobuttons.cc')
-rw-r--r--client/widgets/radiobuttons.cc48
1 files changed, 27 insertions, 21 deletions
diff --git a/client/widgets/radiobuttons.cc b/client/widgets/radiobuttons.cc
index 2385428..d11c3e5 100644
--- a/client/widgets/radiobuttons.cc
+++ b/client/widgets/radiobuttons.cc
@@ -56,21 +56,40 @@ RadioButtons::RadioButtons(QDomNode &node, MacroWindow *macrowindow)
layout()->setContentsMargins(0,0,0,0);
}
-bool RadioButtons::isValid()
+bool RadioButtons::setBGColor(bool valid)
{
- if(!regexpValidator()) return false;
- if(!luaValidator()) return false;
+ QPalette palette;
+
+ if(valid) {
+ palette.setBrush(QPalette::Base, QBrush(QColor(255, 255, 255)));
+ } else {
+ //palette.setBrush(QPalette::Base, QBrush(QColor(255, 255, 255)));
+ palette.setBrush(QPalette::Base, QBrush(QColor(230, 200, 200)));
+ }
+
+ QVector< RadioButton* >::iterator i;
+ for (i = radiobutton_list.begin(); i != radiobutton_list.end(); ++i) {
+ RadioButton *widget = *i;
+ widget->setPalette(palette);
+ }
+
+ return valid;
+}
+bool RadioButtons::isValid()
+{
+ if(!regexpValidator()) return setBGColor(false);
+ if(!luaValidator()) return setBGColor(false);
QVector< RadioButton* >::iterator i;
for (i = radiobutton_list.begin(); i != radiobutton_list.end(); ++i) {
RadioButton *widget = *i;
if(widget->isChecked()) {
- return true;
+ return setBGColor(true);
}
}
- return false;
+ return setBGColor(false);
}
QString RadioButtons::getValue()
@@ -102,6 +121,8 @@ void RadioButtons::setValue(QString value, QString source)
}
setInitialValue(value);
+
+ isValid();
}
void RadioButtons::connectFrom(const char *signal,
@@ -143,22 +164,7 @@ void RadioButtons::setVisibility(bool visible)
void RadioButtons::childChanged()
{
- QPalette palette;
-
- if(regexpValidator()) {
- if(luaValidator()) {
- // valid string
- palette.setBrush(QPalette::Base, QBrush(QColor(255, 255, 255)));
- } else {
- // invalid string
- palette.setBrush(QPalette::Base, QBrush(QColor(200, 230, 200)));
- }
- } else {
- // invalid string
- palette.setBrush(QPalette::Base, QBrush(QColor(230, 200, 200)));
- }
-
- setPalette(palette);
+ isValid();
emit wasChanged();
}