diff options
author | Brad King <brad.king@kitware.com> | 2021-05-10 16:21:38 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-05-10 16:21:45 (GMT) |
commit | a77cda587b145d55fdac10588b54f0b951bce3a6 (patch) | |
tree | 578c9570d29218ce2d6fbd85224c6366051ae887 | |
parent | 2ee55f9718264d716eeabc9d61ede6e434443fd1 (diff) | |
parent | 6c657173d806aa81d1508830c10a16236b5358b9 (diff) | |
download | CMake-a77cda587b145d55fdac10588b54f0b951bce3a6.zip CMake-a77cda587b145d55fdac10588b54f0b951bce3a6.tar.gz CMake-a77cda587b145d55fdac10588b54f0b951bce3a6.tar.bz2 |
Merge topic 'build-with-qt6-deprecations'
6c657173d8 cmake-gui: Address deprecation warnings with Qt6
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Sankhesh Jhaveri <sankhesh.jhaveri@kitware.com>
Merge-request: !6107
-rw-r--r-- | Source/QtDialog/CMakeSetup.cxx | 11 | ||||
-rw-r--r-- | Source/QtDialog/CMakeSetupDialog.cxx | 4 | ||||
-rw-r--r-- | Source/QtDialog/QCMake.cxx | 7 |
3 files changed, 17 insertions, 5 deletions
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 5debdb8..8ffa3e7 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -112,7 +112,10 @@ int main(int argc, char** argv) cmAddPluginPath(); #endif -#if QT_VERSION >= 0x050600 +// HighDpiScaling is always enabled starting with Qt6, but will still issue a +// deprecation warning if you try to set the attribute for it +#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) && \ + QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif @@ -132,9 +135,9 @@ int main(int argc, char** argv) translationsDir.cd(QString::fromLocal8Bit(".." CMAKE_DATA_DIR)); translationsDir.cd("i18n"); QTranslator translator; - QString transfile = QString("cmake_%1").arg(QLocale::system().name()); - translator.load(transfile, translationsDir.path()); - QApplication::installTranslator(&translator); + if (translator.load(QLocale(), "cmake", "_", translationsDir.path())) { + QApplication::installTranslator(&translator); + } // app setup QApplication::setApplicationName("CMakeSetup"); diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 0313088..1785571 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -178,7 +178,11 @@ CMakeSetupDialog::CMakeSetupDialog() &CMakeSetupDialog::doOutputErrorNext); a->setShortcut(QKeySequence(Qt::Key_F8)); auto* s = new QShortcut(this); +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) s->setKey(QKeySequence(Qt::CTRL + Qt::Key_Period)); +#else + s->setKey(QKeySequence(Qt::CTRL | Qt::Key_Period)); +#endif QObject::connect(s, &QShortcut::activated, this, &CMakeSetupDialog::doOutputErrorNext); // in Eclipse diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 6796e25..a83622a 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -334,7 +334,12 @@ void QCMake::setProperties(const QCMakePropertyList& newProps) toremove.append(QString::fromLocal8Bit(key.c_str())); } else { prop = props[idx]; - if (prop.Value.type() == QVariant::Bool) { +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) + const bool isBool = prop.Value.type() == QVariant::Bool; +#else + const bool isBool = prop.Value.metaType() == QMetaType::fromType<bool>(); +#endif + if (isBool) { state->SetCacheEntryValue(key, prop.Value.toBool() ? "ON" : "OFF"); } else { state->SetCacheEntryValue(key, |