summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-06-02 13:17:12 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-06-02 13:17:24 (GMT)
commit961ca77a7a272fb5cde7e07671a51e9110f9ef36 (patch)
tree86a6f8090aba5c7fd613603db642ce89f2237d8c /Source
parenta432b1075c8808c6e4c925d3f4d4ce94c5477bab (diff)
parente1b2c0108f84ff6deaae8c4469a871caf4854a9c (diff)
downloadCMake-961ca77a7a272fb5cde7e07671a51e9110f9ef36.zip
CMake-961ca77a7a272fb5cde7e07671a51e9110f9ef36.tar.gz
CMake-961ca77a7a272fb5cde7e07671a51e9110f9ef36.tar.bz2
Merge topic 'gitlab-ci-ninja-multi'
e1b2c0108f gitlab-ci: add a Ninja Multi-Config test job 1e8ecfccdd gitlab-ci: also build ncurses and Qt code on Linux 95721f0a82 ci: install ncurses and Qt development into the Fedora 31 image ed2fe558b0 CursesDialog: resolve clang-tidy warnings 44f1744bed QtDialog: avoid using deprecated APIs Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4832
Diffstat (limited to 'Source')
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx6
-rw-r--r--Source/CursesDialog/cmCursesStringWidget.cxx10
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx13
-rw-r--r--Source/QtDialog/QCMakeCacheView.cxx43
-rw-r--r--Source/QtDialog/RegexExplorer.cxx3
5 files changed, 53 insertions, 22 deletions
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index 14eadd9..6fc556c 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -854,11 +854,7 @@ void cmCursesMainForm::HandleInput()
}
// switch advanced on/off
else if (key == 't') {
- if (this->AdvancedMode) {
- this->AdvancedMode = false;
- } else {
- this->AdvancedMode = true;
- }
+ this->AdvancedMode = !this->AdvancedMode;
getmaxyx(stdscr, y, x);
this->RePost();
this->Render(1, 1, x, y);
diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx
index c629478..4830d63 100644
--- a/Source/CursesDialog/cmCursesStringWidget.cxx
+++ b/Source/CursesDialog/cmCursesStringWidget.cxx
@@ -105,12 +105,10 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm,
if (!this->InEdit && (key != 10 && key != KEY_ENTER && key != 'i')) {
return false;
}
- // enter edit with return and i (vim binding)
- if (!this->InEdit && (key == 10 || key == KEY_ENTER || key == 'i')) {
- this->OnReturn(fm, w);
- }
- // leave edit with return (but not i -- not a toggle)
- else if (this->InEdit && (key == 10 || key == KEY_ENTER)) {
+ // toggle edit with return
+ if ((key == 10 || key == KEY_ENTER)
+ // enter edit with i (and not-edit mode)
+ || (!this->InEdit && key == 'i')) {
this->OnReturn(fm, w);
} else if (key == KEY_DOWN || key == ctrl('n') || key == KEY_UP ||
key == ctrl('p') || key == KEY_NPAGE || key == ctrl('d') ||
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 930f300..6dbfe11 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -595,7 +595,11 @@ void CMakeSetupDialog::doHelp()
QDialog dialog;
QFontMetrics met(this->font());
+#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
+ int msgWidth = met.horizontalAdvance(msg);
+#else
int msgWidth = met.width(msg);
+#endif
dialog.setMinimumSize(msgWidth / 15, 20);
dialog.setWindowTitle(tr("Help"));
QVBoxLayout* l = new QVBoxLayout(&dialog);
@@ -1056,14 +1060,7 @@ void CMakeSetupDialog::enterState(CMakeSetupDialog::State s)
this->GenerateAction->setEnabled(false);
this->OpenProjectButton->setEnabled(false);
this->GenerateButton->setText(tr("&Stop"));
- } else if (s == ReadyConfigure) {
- this->setEnabledState(true);
- this->GenerateButton->setEnabled(true);
- this->GenerateAction->setEnabled(true);
- this->ConfigureButton->setEnabled(true);
- this->ConfigureButton->setText(tr("&Configure"));
- this->GenerateButton->setText(tr("&Generate"));
- } else if (s == ReadyGenerate) {
+ } else if (s == ReadyConfigure || s == ReadyGenerate) {
this->setEnabledState(true);
this->GenerateButton->setEnabled(true);
this->GenerateAction->setEnabled(true);
diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx
index 3e6a49e..40cc89c 100644
--- a/Source/QtDialog/QCMakeCacheView.cxx
+++ b/Source/QtDialog/QCMakeCacheView.cxx
@@ -209,6 +209,10 @@ void QCMakeCacheModel::clear()
void QCMakeCacheModel::setProperties(const QCMakePropertyList& props)
{
+#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
+ this->beginResetModel();
+#endif
+
QSet<QCMakeProperty> newProps;
QSet<QCMakeProperty> newProps2;
@@ -231,8 +235,13 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props)
if (View == FlatView) {
QCMakePropertyList newP = newProps.toList();
QCMakePropertyList newP2 = newProps2.toList();
+#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
+ std::sort(newP.begin(), newP.end());
+ std::sort(newP2.begin(), newP2.end());
+#else
qSort(newP);
qSort(newP2);
+#endif
int row_count = 0;
foreach (QCMakeProperty const& p, newP) {
this->insertRow(row_count);
@@ -262,10 +271,17 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props)
parentItems.append(
new QStandardItem(key.isEmpty() ? tr("Ungrouped Entries") : key));
parentItems.append(new QStandardItem());
+#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
+ parentItems[0]->setData(QBrush(QColor(255, 100, 100)),
+ Qt::BackgroundRole);
+ parentItems[1]->setData(QBrush(QColor(255, 100, 100)),
+ Qt::BackgroundRole);
+#else
parentItems[0]->setData(QBrush(QColor(255, 100, 100)),
Qt::BackgroundColorRole);
parentItems[1]->setData(QBrush(QColor(255, 100, 100)),
Qt::BackgroundColorRole);
+#endif
parentItems[0]->setData(1, GroupRole);
parentItems[1]->setData(1, GroupRole);
root->appendRow(parentItems);
@@ -305,7 +321,11 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props)
}
this->blockSignals(b);
+#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
+ this->endResetModel();
+#else
this->reset();
+#endif
}
QCMakeCacheModel::ViewType QCMakeCacheModel::viewType() const
@@ -315,6 +335,10 @@ QCMakeCacheModel::ViewType QCMakeCacheModel::viewType() const
void QCMakeCacheModel::setViewType(QCMakeCacheModel::ViewType t)
{
+#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
+ this->beginResetModel();
+#endif
+
this->View = t;
QCMakePropertyList props = this->properties();
@@ -330,7 +354,11 @@ void QCMakeCacheModel::setViewType(QCMakeCacheModel::ViewType t)
this->setProperties(oldProps);
this->setProperties(props);
this->blockSignals(b);
+#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
+ this->endResetModel();
+#else
this->reset();
+#endif
}
void QCMakeCacheModel::setPropertyData(const QModelIndex& idx1,
@@ -356,10 +384,15 @@ void QCMakeCacheModel::setPropertyData(const QModelIndex& idx1,
}
if (isNew) {
+#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
+ this->setData(idx1, QBrush(QColor(255, 100, 100)), Qt::BackgroundRole);
+ this->setData(idx2, QBrush(QColor(255, 100, 100)), Qt::BackgroundRole);
+#else
this->setData(idx1, QBrush(QColor(255, 100, 100)),
Qt::BackgroundColorRole);
this->setData(idx2, QBrush(QColor(255, 100, 100)),
Qt::BackgroundColorRole);
+#endif
}
}
@@ -409,7 +442,11 @@ void QCMakeCacheModel::breakProperties(
reorgProps.append((*iter)[0]);
iter = tmp.erase(iter);
} else {
+#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
+ std::sort(iter->begin(), iter->end());
+#else
qSort(*iter);
+#endif
++iter;
}
}
@@ -639,9 +676,15 @@ QSize QCMakeCacheModelDelegate::sizeHint(const QStyleOptionViewItem& option,
// increase to checkbox size
QStyleOptionButton opt;
opt.QStyleOption::operator=(option);
+#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
+ sz = sz.expandedTo(
+ style->subElementRect(QStyle::SE_ItemViewItemCheckIndicator, &opt, nullptr)
+ .size());
+#else
sz = sz.expandedTo(
style->subElementRect(QStyle::SE_ViewItemCheckIndicator, &opt, nullptr)
.size());
+#endif
return sz;
}
diff --git a/Source/QtDialog/RegexExplorer.cxx b/Source/QtDialog/RegexExplorer.cxx
index 746fd8a..6194940 100644
--- a/Source/QtDialog/RegexExplorer.cxx
+++ b/Source/QtDialog/RegexExplorer.cxx
@@ -147,9 +147,6 @@ bool RegexExplorer::stripEscapes(std::string& source)
} else if (nextc == 'n') {
result.append(1, '\n');
in++;
- } else if (nextc == 't') {
- result.append(1, '\t');
- in++;
} else if (isalnum(nextc) || nextc == '\0') {
return false;
} else {