aboutsummaryrefslogtreecommitdiff
path: root/src/qt/qvaluecombobox.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2011-07-29 14:36:35 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2011-07-29 14:36:35 +0200
commitee014e5b10f5f65820ff056311051ff49813b294 (patch)
treed9c0dd04b021c2c828bf55ba6ff33d93d07b5276 /src/qt/qvaluecombobox.cpp
parentb5b1d1a66b9f418c9fb293cb1cc3eac09a711c4e (diff)
Full support for other units, add configuration option for default unit (used when displaying amounts)
Diffstat (limited to 'src/qt/qvaluecombobox.cpp')
-rw-r--r--src/qt/qvaluecombobox.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/qt/qvaluecombobox.cpp b/src/qt/qvaluecombobox.cpp
new file mode 100644
index 0000000000..c0ad8c12e5
--- /dev/null
+++ b/src/qt/qvaluecombobox.cpp
@@ -0,0 +1,27 @@
+#include "qvaluecombobox.h"
+
+QValueComboBox::QValueComboBox(QWidget *parent) :
+ QComboBox(parent), role(Qt::UserRole)
+{
+ connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(handleSelectionChanged(int)));
+}
+
+int QValueComboBox::value() const
+{
+ return itemData(currentIndex(), role).toInt();
+}
+
+void QValueComboBox::setValue(int value)
+{
+ setCurrentIndex(findData(value, role));
+}
+
+void QValueComboBox::setRole(int role)
+{
+ this->role = role;
+}
+
+void QValueComboBox::handleSelectionChanged(int idx)
+{
+ emit valueChanged();
+}