diff options
| author | Wladimir J. van der Laan <[email protected]> | 2011-07-29 14:36:35 +0200 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2011-07-29 14:36:35 +0200 |
| commit | ee014e5b10f5f65820ff056311051ff49813b294 (patch) | |
| tree | d9c0dd04b021c2c828bf55ba6ff33d93d07b5276 /src/qt/qvaluecombobox.cpp | |
| parent | Merge branch 'master' of https://github.com/bitcoin/bitcoin (diff) | |
| download | discoin-ee014e5b10f5f65820ff056311051ff49813b294.tar.xz discoin-ee014e5b10f5f65820ff056311051ff49813b294.zip | |
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.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/qt/qvaluecombobox.cpp b/src/qt/qvaluecombobox.cpp new file mode 100644 index 000000000..c0ad8c12e --- /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(); +} |