Master Core  v0.0.9 - 49a5c0d97abf09ef2911ddfe8d9551df59f9efd3-dirty
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
qvaluecombobox.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2013 The Bitcoin developers
2 // Distributed under the MIT/X11 software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef QVALUECOMBOBOX_H
6 #define 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. */
12 class QValueComboBox : public QComboBox
13 {
14  Q_OBJECT
15 
16  Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged USER true)
17 
18 public:
19  explicit QValueComboBox(QWidget *parent = 0);
20 
21  QVariant value() const;
22  void setValue(const QVariant &value);
23 
25  void setRole(int role);
26 
27 signals:
28  void valueChanged();
29 
30 private:
31  int role;
32 
33 private slots:
34  void handleSelectionChanged(int idx);
35 };
36 
37 #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)