mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
Full support for other units, add configuration option for default unit (used when displaying amounts)
This commit is contained in:
27
src/qt/qvaluecombobox.cpp
Normal file
27
src/qt/qvaluecombobox.cpp
Normal file
@@ -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();
|
||||
}
|
||||
Reference in New Issue
Block a user