summaryrefslogtreecommitdiffstats
path: root/Source/QtDialog/QCMakeWidgets.h
diff options
context:
space:
mode:
authorClinton Stimpson <clinton@elemtech.com>2009-03-12 15:19:27 (GMT)
committerClinton Stimpson <clinton@elemtech.com>2009-03-12 15:19:27 (GMT)
commitc54f47635c7f4eda101cc092605481efb9e5275d (patch)
tree2157d540e011660f7d3db31ffb4b7929f3fc61c2 /Source/QtDialog/QCMakeWidgets.h
parentdd7b48c9c386ffd7fa184284403988df85a38279 (diff)
downloadCMake-c54f47635c7f4eda101cc092605481efb9e5275d.zip
CMake-c54f47635c7f4eda101cc092605481efb9e5275d.tar.gz
CMake-c54f47635c7f4eda101cc092605481efb9e5275d.tar.bz2
ENH: Add support for showing combo box for choosing from a list of strings that a cache property can have.
Diffstat (limited to 'Source/QtDialog/QCMakeWidgets.h')
-rw-r--r--Source/QtDialog/QCMakeWidgets.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/Source/QtDialog/QCMakeWidgets.h b/Source/QtDialog/QCMakeWidgets.h
index 231f728..64691b5 100644
--- a/Source/QtDialog/QCMakeWidgets.h
+++ b/Source/QtDialog/QCMakeWidgets.h
@@ -19,6 +19,7 @@
#define QCMakeWidgets_h
#include <QLineEdit>
+#include <QComboBox>
#include <QCompleter>
class QToolButton;
@@ -67,5 +68,25 @@ public:
virtual QString pathFromIndex(const QModelIndex& idx) const;
};
+// editor for strings
+class QCMakeComboBox : public QComboBox
+{
+ Q_OBJECT
+ Q_PROPERTY(QString value READ currentText WRITE setValue USER true);
+public:
+ QCMakeComboBox(QWidget* p, QStringList strings) : QComboBox(p)
+ {
+ this->addItems(strings);
+ }
+ void setValue(const QString& v)
+ {
+ int i = this->findText(v);
+ if(i != -1)
+ {
+ this->setCurrentIndex(i);
+ }
+ }
+};
+
#endif