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>
This commit is contained in:
Alexander Drozdov
2016-10-10 09:49:46 +10:00
parent 9e67dfbe17
commit 76b76f2723
11 changed files with 158 additions and 10 deletions

View File

@@ -245,6 +245,7 @@ QList<ConfigModel::DataItem> CMakeBuildConfiguration::completeCMakeConfiguration
j.key = QString::fromUtf8(i.key);
j.value = QString::fromUtf8(i.value);
j.description = QString::fromUtf8(i.documentation);
j.values = i.values;
j.isAdvanced = i.isAdvanced || i.type == CMakeConfigItem::INTERNAL;
switch (i.type) {
@@ -280,6 +281,7 @@ void CMakeBuildConfiguration::setCurrentCMakeConfiguration(const QList<ConfigMod
ni.value = i.value.toUtf8();
ni.documentation = i.description.toUtf8();
ni.isAdvanced = i.isAdvanced;
ni.values = i.values;
switch (i.type) {
case CMakeProjectManager::ConfigModel::DataItem::BOOLEAN:
ni.type = CMakeConfigItem::BOOL;