diff --git a/plugins/cmake/settings/cmakecachedelegate.cpp b/plugins/cmake/settings/cmakecachedelegate.cpp --- a/plugins/cmake/settings/cmakecachedelegate.cpp +++ b/plugins/cmake/settings/cmakecachedelegate.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -50,6 +51,19 @@ connect(box, &QCheckBox::toggled, this, &CMakeCacheDelegate::checkboxToggled); ret = box; } + else if(type==QLatin1String("STRING")) + { + QModelIndex stringsIdx=index.sibling(index.row(), 5); + QString strings=typeIdx.model()->data(stringsIdx, Qt::DisplayRole).toString(); + if (!strings.isEmpty()) { + QComboBox* comboBox = new QComboBox(parent); + comboBox->setEditable(true); + comboBox->addItems(strings.split(';')); + ret = comboBox; + } else { + ret=QItemDelegate::createEditor(parent, option, index); + } + } else if(type==QLatin1String("PATH") || type==QLatin1String("FILEPATH")) { KUrlRequester *r=new KUrlRequester(parent); diff --git a/plugins/cmake/settings/cmakecachemodel.cpp b/plugins/cmake/settings/cmakecachemodel.cpp --- a/plugins/cmake/settings/cmakecachemodel.cpp +++ b/plugins/cmake/settings/cmakecachemodel.cpp @@ -52,6 +52,7 @@ labels.append(i18n("Value")); labels.append(i18n("Comment")); labels.append(i18n("Advanced")); + labels.append(i18n("Strings")); setHorizontalHeaderLabels(labels); QFile file(m_filePath.toLocalFile()); @@ -91,16 +92,20 @@ if(flag==QLatin1String("INTERNAL")) { m_internal.insert(name); - } else if(flag==QLatin1String("ADVANCED")) + } else if(flag==QLatin1String("ADVANCED") || flag==QLatin1String("STRINGS")) { if(variablePos.contains(name)) { int pos=variablePos[name]; - QStandardItem *p = item(pos, 4); + + // if the flag is not ADVANCED, it's STRINGS. + // The latter is stored in column 5 + int column = flag==QLatin1String("ADVANCED") ? 4 : 5; + QStandardItem *p = item(pos, column); if(!p) { p=new QStandardItem(value); - setItem(pos, 4, p); + setItem(pos, column, p); } else { @@ -118,7 +123,9 @@ lineItems[0]->setText(lineItems[0]->text()+'-'+flag); } insertRow(currentIdx, lineItems); - variablePos[name]=currentIdx; + if (!variablePos.contains(name)) { + variablePos[name]=currentIdx; + } currentIdx++; currentComment.clear(); } diff --git a/plugins/cmake/settings/cmakepreferences.cpp b/plugins/cmake/settings/cmakepreferences.cpp --- a/plugins/cmake/settings/cmakepreferences.cpp +++ b/plugins/cmake/settings/cmakepreferences.cpp @@ -197,6 +197,7 @@ m_prefsUi->cacheList->hideColumn(1); m_prefsUi->cacheList->hideColumn(3); m_prefsUi->cacheList->hideColumn(4); + m_prefsUi->cacheList->hideColumn(5); m_prefsUi->cacheList->horizontalHeader()->resizeSection(0, 200); if( m_currentModel ) {