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.cc51
1 files changed, 50 insertions, 1 deletions
diff --git a/client/widgets/radiobuttons.cc b/client/widgets/radiobuttons.cc
index 1987459..ae40677 100644
--- a/client/widgets/radiobuttons.cc
+++ b/client/widgets/radiobuttons.cc
@@ -47,6 +47,9 @@ RadioButtons::RadioButtons(QDomNode &node, MacroWindow *macrowindow)
// Create radiobutton from child, insert in this
layout()->addWidget(radiobutton);
+
+ connect(radiobutton, SIGNAL(clicked()), this, SLOT(childChanged()));
+
radiobutton_list.push_back(radiobutton);
}
@@ -79,8 +82,10 @@ QString RadioButtons::getValue()
return value;
}
-void RadioButtons::setValue(QString value)
+void RadioButtons::setValue(QString value, QString source)
{
+ if(isUserSource(source)) emit wasChanged();
+
QVector< RadioButton* >::iterator i;
for (i = radiobutton_list.begin(); i != radiobutton_list.end(); ++i) {
RadioButton *widget = *i;
@@ -90,4 +95,48 @@ void RadioButtons::setValue(QString value)
widget->setChecked(false);
}
}
+
+ setInitialValue(value);
+}
+
+void RadioButtons::connectFrom(const char *signal,
+ const QObject *receiver, const char *method)
+{
+ connect(this, signal, receiver, method);
+}
+
+void RadioButtons::connectTo(const QObject *sender, const char *signal,
+ const char *method)
+{
+ connect(sender, signal, this, method);
+}
+
+bool RadioButtons::setKeyboardFocus()
+{
+ QVector< RadioButton* >::iterator i = radiobutton_list.begin();
+ while(i != radiobutton_list.end()) {
+ RadioButton *rb = *i;
+ if(rb->isChecked()) {
+ rb->setFocus();
+ return true;
+ }
+ i++;
+ }
+
+ if(radiobutton_list.size()) {
+ radiobutton_list.at(0)->setFocus();
+ return true;
+ }
+
+ return false;
+}
+
+void RadioButtons::setVisibility(bool visible)
+{
+ setVisible(visible);
+}
+
+void RadioButtons::childChanged()
+{
+ emit wasChanged();
}