diff options
author | Alexander Drozdov <adrozdoff@gmail.com> | 2016-10-10 09:49:46 +1000 |
---|---|---|
committer | Alexander Drozdov <adrozdoff@gmail.com> | 2016-10-10 15:07:30 +0000 |
commit | 76b76f2723d9709133ce9a7be057b092609096ba (patch) | |
tree | 45c75664d44562c943ea08da98dc36da0428a675 /src/plugins/cmakeprojectmanager/configmodel.h | |
parent | 9e67dfbe17e5b9064086ddd8f64649f257984a6a (diff) |
CMakeProjectManager: Support drop down selector for options
CMake provides "hack" for cmake-gui, that allows set options variants
and select then from drop down list. Allows Qt Creator re-use this
solution.
See:
- https://blog.kitware.com/constraining-values-with-comboboxes-in-cmake-cmake-gui/
- http://blog.bethcodes.com/cmake-tips-tricks-drop-down-list
Drop down values can be added to option via:
SET_PROPERTY(CACHE OptionName PROPERTY STRINGS Option1 Option2 Option3)
This solution should not restrict to provide any other value, it
provides only suggestion for user to select one of prdefined values.
Change-Id: I8fc52155775f1e04979db8206bb42363df9359e8
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins/cmakeprojectmanager/configmodel.h')
-rw-r--r-- | src/plugins/cmakeprojectmanager/configmodel.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/plugins/cmakeprojectmanager/configmodel.h b/src/plugins/cmakeprojectmanager/configmodel.h index 5fe63baa0f..0542481718 100644 --- a/src/plugins/cmakeprojectmanager/configmodel.h +++ b/src/plugins/cmakeprojectmanager/configmodel.h @@ -34,6 +34,11 @@ class ConfigModel : public QAbstractTableModel Q_OBJECT public: + enum Roles { + ItemTypeRole = Qt::UserRole, + ItemValuesRole + }; + class DataItem { public: enum Type { BOOLEAN, FILE, DIRECTORY, STRING, UNKNOWN}; @@ -43,6 +48,7 @@ public: bool isAdvanced = false; QString value; QString description; + QStringList values; }; explicit ConfigModel(QObject *parent = nullptr); @@ -58,7 +64,8 @@ public: void appendConfiguration(const QString &key, const QString &value = QString(), const DataItem::Type type = DataItem::UNKNOWN, - const QString &description = QString()); + const QString &description = QString(), + const QStringList &values = QStringList()); void setConfiguration(const QList<DataItem> &config); void flush(); void resetAllChanges(); |