diff options
author | Clinton Stimpson <clinton@elemtech.com> | 2009-03-12 15:19:27 (GMT) |
---|---|---|
committer | Clinton Stimpson <clinton@elemtech.com> | 2009-03-12 15:19:27 (GMT) |
commit | c54f47635c7f4eda101cc092605481efb9e5275d (patch) | |
tree | 2157d540e011660f7d3db31ffb4b7929f3fc61c2 /Source/QtDialog/QCMakeWidgets.h | |
parent | dd7b48c9c386ffd7fa184284403988df85a38279 (diff) | |
download | CMake-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.h | 21 |
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 |