Changeset View
Changeset View
Standalone View
Standalone View
src/qt/qvaluecombobox.cpp
// Copyright (c) 2011-2016 The Bitcoin Core developers | // Copyright (c) 2011-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <qt/qvaluecombobox.h> | #include <qt/qvaluecombobox.h> | ||||
QValueComboBox::QValueComboBox(QWidget *parent) | QValueComboBox::QValueComboBox(QWidget *parent) | ||||
: QComboBox(parent), role(Qt::UserRole) { | : QComboBox(parent), role(Qt::UserRole) { | ||||
connect(this, SIGNAL(currentIndexChanged(int)), this, | connect( | ||||
SLOT(handleSelectionChanged(int))); | this, | ||||
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), | |||||
this, &QValueComboBox::handleSelectionChanged); | |||||
} | } | ||||
QVariant QValueComboBox::value() const { | QVariant QValueComboBox::value() const { | ||||
return itemData(currentIndex(), role); | return itemData(currentIndex(), role); | ||||
} | } | ||||
void QValueComboBox::setValue(const QVariant &value) { | void QValueComboBox::setValue(const QVariant &value) { | ||||
setCurrentIndex(findData(value, role)); | setCurrentIndex(findData(value, role)); | ||||
Show All 9 Lines |