summaryrefslogtreecommitdiff
path: root/client/widgets/listbox.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/widgets/listbox.cc')
-rw-r--r--client/widgets/listbox.cc40
1 files changed, 39 insertions, 1 deletions
diff --git a/client/widgets/listbox.cc b/client/widgets/listbox.cc
index 88a5cd2..303d288 100644
--- a/client/widgets/listbox.cc
+++ b/client/widgets/listbox.cc
@@ -71,6 +71,8 @@ static QListWidgetItem *createItem(QDomElement &elem)
ListBox::ListBox(QDomNode &node, MacroWindow *macrowindow)
: QListWidget(), Widget(node, macrowindow)
{
+ valueIsChangingByComputer = false;
+
setCommonAttributes(this, node);
QDomNodeList children = node.childNodes();
@@ -80,6 +82,8 @@ ListBox::ListBox(QDomNode &node, MacroWindow *macrowindow)
QDomElement list_elem = child.toElement();
addItem(createItem(list_elem));
}
+
+ connect(this, SIGNAL(itemSelectionChanged()), this, SLOT(changed()));
}
bool ListBox::isValid()
@@ -94,8 +98,11 @@ QString ListBox::getValue()
return value;
}
-void ListBox::setValue(QString value)
+void ListBox::setValue(QString value, QString source)
{
+ if(isUserSource(source)) emit wasChanged();
+
+ valueIsChangingByComputer = true;
int sel = -1; // -1 is default for none selected
for(int i = 0; i < count(); i++) {
@@ -104,4 +111,35 @@ void ListBox::setValue(QString value)
}
setCurrentRow(sel);
+
+ setInitialValue(value);
+ valueIsChangingByComputer = false;
+}
+
+void ListBox::connectFrom(const char *signal,
+ const QObject *receiver, const char *method)
+{
+ connect(this, signal, receiver, method);
+}
+
+void ListBox::connectTo(const QObject *sender, const char *signal,
+ const char *method)
+{
+ connect(sender, signal, this, method);
+}
+
+void ListBox::setVisibility(bool visible)
+{
+ setVisible(visible);
+}
+
+void ListBox::changed()
+{
+ if(!valueIsChangingByComputer) emit wasChanged();
+}
+
+bool ListBox::setKeyboardFocus()
+{
+ setFocus();
+ return true;
}