mirror of https://github.com/GOSTSec/gostcoin
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
562 B
27 lines
562 B
#include "qvaluecombobox.h" |
|
|
|
QValueComboBox::QValueComboBox(QWidget *parent) : |
|
QComboBox(parent), role(Qt::UserRole) |
|
{ |
|
connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(handleSelectionChanged(int))); |
|
} |
|
|
|
QVariant QValueComboBox::value() const |
|
{ |
|
return itemData(currentIndex(), role); |
|
} |
|
|
|
void QValueComboBox::setValue(const QVariant &value) |
|
{ |
|
setCurrentIndex(findData(value, role)); |
|
} |
|
|
|
void QValueComboBox::setRole(int role) |
|
{ |
|
this->role = role; |
|
} |
|
|
|
void QValueComboBox::handleSelectionChanged(int idx) |
|
{ |
|
emit valueChanged(); |
|
}
|
|
|