1 // Copyright (c) 2011-2015 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 #include "qvaluecombobox.h"
7 QValueComboBox::QValueComboBox(QWidget
*parent
) :
8 QComboBox(parent
), role(Qt::UserRole
)
10 connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(handleSelectionChanged(int)));
13 QVariant
QValueComboBox::value() const
15 return itemData(currentIndex(), role
);
18 void QValueComboBox::setValue(const QVariant
&value
)
20 setCurrentIndex(findData(value
, role
));
23 void QValueComboBox::setRole(int _role
)
28 void QValueComboBox::handleSelectionChanged(int idx
)
30 Q_EMIT
valueChanged();