From 134d69121e893426db2ea67a6bc6e22a749b6529 Mon Sep 17 00:00:00 2001 From: Sankhesh Jhaveri Date: Mon, 22 Feb 2021 17:11:37 -0500 Subject: cmake-gui: Restore search bar for cache view and environment dialog This was broken by commit f1de6f6682 (cmake-gui: Support building against Qt6, 2020-12-17, v3.20.0-rc1~205^2~7). Fixes: #21850 --- Source/QtDialog/EnvironmentDialog.cxx | 6 ++++++ Source/QtDialog/QCMakeCacheView.cxx | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/Source/QtDialog/EnvironmentDialog.cxx b/Source/QtDialog/EnvironmentDialog.cxx index 0339d1d..9c8e892 100644 --- a/Source/QtDialog/EnvironmentDialog.cxx +++ b/Source/QtDialog/EnvironmentDialog.cxx @@ -110,8 +110,14 @@ EnvironmentDialog::EnvironmentDialog(const QProcessEnvironment& environment, &EnvironmentDialog::addEntry); QObject::connect(this->RemoveEntry, &QAbstractButton::clicked, this, &EnvironmentDialog::removeSelectedEntries); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) + QObject::connect(this->Search, &QLineEdit::textChanged, this->m_filter, + QOverload::of( + &EnvironmentSearchFilter::setFilterRegularExpression)); +#else QObject::connect(this->Search, &QLineEdit::textChanged, this->m_filter, &EnvironmentSearchFilter::setFilterFixedString); +#endif QObject::connect(this->Environment->selectionModel(), &QItemSelectionModel::selectionChanged, this, &EnvironmentDialog::selectionChanged); diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index 7c9032e..536b92d 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -170,7 +170,11 @@ bool QCMakeCacheView::showAdvanced() const void QCMakeCacheView::setSearchFilter(const QString& s) { +#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) + this->SearchFilter->setFilterRegularExpression(s); +#else this->SearchFilter->setFilterFixedString(s); +#endif } QCMakeCacheModel::QCMakeCacheModel(QObject* p) -- cgit v0.12