diff options
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 |