Anoncoin  0.9.4
P2P Digital Currency
qvaluecombobox.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2013 The Bitcoin developers
2 // Copyright (c) 2013-2014 The Anoncoin Core developers
3 // Distributed under the MIT/X11 software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef QVALUECOMBOBOX_H
7 #define QVALUECOMBOBOX_H
8 
9 #include <QComboBox>
10 #include <QVariant>
11 
12 /* QComboBox that can be used with QDataWidgetMapper to select ordinal values from a model. */
13 class QValueComboBox : public QComboBox
14 {
15  Q_OBJECT
16 
17  Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged USER true)
18 
19 public:
20  explicit QValueComboBox(QWidget *parent = 0);
21 
22  QVariant value() const;
23  void setValue(const QVariant &value);
24 
26  void setRole(int role);
27 
28 signals:
29  void valueChanged();
30 
31 private:
32  int role;
33 
34 private slots:
35  void handleSelectionChanged(int idx);
36 };
37 
38 #endif // QVALUECOMBOBOX_H
QVariant value() const
void handleSelectionChanged(int idx)
void setValue(const QVariant &value)
QValueComboBox(QWidget *parent=0)
void setRole(int role)
Specify model role to use as ordinal value (defaults to Qt::UserRole)