view src/qt/qvaluecombobox.cpp @ 2535:81f28a3ba482 draft

Move GetStartOnSystemStartup and SetStartOnSystemStartup to GUI code
author Wladimir J. van der Laan <laanwj@gmail.com>
date Tue, 01 May 2012 18:44:11 +0200
parents 58abdd7d008b
children
line wrap: on
line source

#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();
}