Bitcoin Core 28.99.0
P2P Digital Currency
qvaluecombobox.h
Go to the documentation of this file.
1// Copyright (c) 2011-2020 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.
4
5#ifndef BITCOIN_QT_QVALUECOMBOBOX_H
6#define BITCOIN_QT_QVALUECOMBOBOX_H
7
8#include <QComboBox>
9#include <QVariant>
10
11/* QComboBox that can be used with QDataWidgetMapper to select ordinal values from a model. */
12class QValueComboBox : public QComboBox
13{
14 Q_OBJECT
15
16 Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged USER true)
17
18public:
19 explicit QValueComboBox(QWidget *parent = nullptr);
20
21 QVariant value() const;
22 void setValue(const QVariant &value);
23
25 void setRole(int role);
26
27Q_SIGNALS:
29
30private:
31 int role{Qt::UserRole};
32
33private Q_SLOTS:
34 void handleSelectionChanged(int idx);
35};
36
37#endif // BITCOIN_QT_QVALUECOMBOBOX_H
void valueChanged()
void handleSelectionChanged(int idx)
void setRole(int role)
Specify model role to use as ordinal value (defaults to Qt::UserRole)
QValueComboBox(QWidget *parent=nullptr)
void setValue(const QVariant &value)