From 1d44b4114d88f7a86dcd5b1625aead344533ac8f Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Tue, 13 Jun 2023 10:14:26 -0400 Subject: [PATCH 01/12] COMP: Fix QFlags deprecation warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes warnings like the following: /path/to/CTK/Libs/Widgets/ctkRangeSlider.cpp:776:26: warning: ‘constexpr QFlags::QFlags(QFlags::Zero) [with Enum = ctkRangeSliderPrivate::Handle; QFlags::Zero = int QFlags::Private::*]’ is deprecated: Use default constructor instead [-Wdeprecated-declarations] 776 | d->m_SelectedHandles = 0; | ^ --- Applications/ctkPluginBrowser/ctkPluginResourcesTreeModel.cpp | 4 +++- Libs/PluginFramework/ctkPluginStorageSQL.cpp | 2 +- Libs/PluginFramework/ctkPlugins.cpp | 2 +- Libs/Visualization/VTK/Widgets/ctkVTKPropertyWidget.cpp | 2 +- Libs/Widgets/Plugins/ctkPopupWidgetPlugin.cpp | 2 +- Libs/Widgets/ctkRangeSlider.cpp | 4 ++-- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Applications/ctkPluginBrowser/ctkPluginResourcesTreeModel.cpp b/Applications/ctkPluginBrowser/ctkPluginResourcesTreeModel.cpp index 774eb5a102..1b99c7a269 100644 --- a/Applications/ctkPluginBrowser/ctkPluginResourcesTreeModel.cpp +++ b/Applications/ctkPluginBrowser/ctkPluginResourcesTreeModel.cpp @@ -204,7 +204,9 @@ QVariant ctkPluginResourcesTreeModel::data(const QModelIndex &index, int role) c Qt::ItemFlags ctkPluginResourcesTreeModel::flags(const QModelIndex &index) const { if (!index.isValid()) - return 0; + { + return Qt::ItemFlags(); + } return Qt::ItemIsEnabled | Qt::ItemIsSelectable; } diff --git a/Libs/PluginFramework/ctkPluginStorageSQL.cpp b/Libs/PluginFramework/ctkPluginStorageSQL.cpp index 11815d1d82..5241282d09 100644 --- a/Libs/PluginFramework/ctkPluginStorageSQL.cpp +++ b/Libs/PluginFramework/ctkPluginStorageSQL.cpp @@ -361,7 +361,7 @@ QLibrary::LoadHints ctkPluginStorageSQL::getPluginLoadHints() const return loadHintsVariant.value(); } } - return QLibrary::LoadHints(0); + return QLibrary::LoadHints(); } //---------------------------------------------------------------------------- diff --git a/Libs/PluginFramework/ctkPlugins.cpp b/Libs/PluginFramework/ctkPlugins.cpp index c79c6133c9..f697767954 100644 --- a/Libs/PluginFramework/ctkPlugins.cpp +++ b/Libs/PluginFramework/ctkPlugins.cpp @@ -342,7 +342,7 @@ void ctkPlugins::startPlugins(const QList& slist) const { try { - plugin->start(0); + plugin->start(); } catch (const ctkPluginException& pe) { diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKPropertyWidget.cpp b/Libs/Visualization/VTK/Widgets/ctkVTKPropertyWidget.cpp index 007e80ffc8..764bc4f084 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKPropertyWidget.cpp +++ b/Libs/Visualization/VTK/Widgets/ctkVTKPropertyWidget.cpp @@ -138,7 +138,7 @@ vtkProperty* ctkVTKPropertyWidget::property()const ctkVTKPropertyWidget::GroupsState ctkVTKPropertyWidget::groupsState()const { Q_D(const ctkVTKPropertyWidget); - ctkVTKPropertyWidget::GroupsState state = 0; + ctkVTKPropertyWidget::GroupsState state; ctkVTKPropertyWidget* constThis = const_cast(this); if (d->RepresentationCollapsibleGroupBox->isVisibleTo(constThis) ) { diff --git a/Libs/Widgets/Plugins/ctkPopupWidgetPlugin.cpp b/Libs/Widgets/Plugins/ctkPopupWidgetPlugin.cpp index ea39f9cfe6..98c9f4c5a0 100644 --- a/Libs/Widgets/Plugins/ctkPopupWidgetPlugin.cpp +++ b/Libs/Widgets/Plugins/ctkPopupWidgetPlugin.cpp @@ -33,7 +33,7 @@ QWidget *ctkPopupWidgetPlugin::createWidget(QWidget* widgetParent) { ctkPopupWidget* newWidget = new ctkPopupWidget(widgetParent); // if the widget is a tooltip, it wouldn't accept children - newWidget->setWindowFlags(0); + newWidget->setWindowFlags(Qt::WindowFlags()); // if the widget auto hides, it disappear from the workplace and don't allow // children anymore. newWidget->setAutoHide(false); diff --git a/Libs/Widgets/ctkRangeSlider.cpp b/Libs/Widgets/ctkRangeSlider.cpp index a20a99b242..89261f785a 100644 --- a/Libs/Widgets/ctkRangeSlider.cpp +++ b/Libs/Widgets/ctkRangeSlider.cpp @@ -111,7 +111,7 @@ ctkRangeSliderPrivate::ctkRangeSliderPrivate(ctkRangeSlider& object) this->m_SubclassClickOffset = 0; this->m_SubclassPosition = 0; this->m_SubclassWidth = 0.0; - this->m_SelectedHandles = 0; + this->m_SelectedHandles = ctkRangeSliderPrivate::Handles(); this->m_SymmetricMoves = false; } @@ -773,7 +773,7 @@ void ctkRangeSlider::mouseReleaseEvent(QMouseEvent* mouseEvent) this->QSlider::mouseReleaseEvent(mouseEvent); setSliderDown(false); - d->m_SelectedHandles = 0; + d->m_SelectedHandles = ctkRangeSliderPrivate::Handles(); this->update(); } From 6c62d84e72a933686d3407ae7d4144eec1ecb5d1 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Tue, 13 Jun 2023 19:19:18 -0400 Subject: [PATCH 02/12] COMP: Update QtSOAP to fix deprecation warnings List of changes: $ git shortlog 9c321151f..2e967e902 --no-merges Jean-Christophe Fillion-Robin (10): COMP: Remove deprecated use of QLinkedList in Qt >= 5.15 STYLE: Strip trailing spaces STYLE: Convert tabs into spaces STYLE: Improve attribution by ignoring bulk formatting STYLE: Ignore indentation and trailing space changes in blame history COMP: Remove deprecated use of QString::sprintf with Qt >= 5.15 STYLE: Convert CMake-language commands to lower case STYLE: Remove CMake-language block-end command arguments STYLE: Ignore cmake style changes in blame history COMP: Update CMake minimum required version from 2.8.12 to 3.0 --- CMakeExternals/QtSOAP.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeExternals/QtSOAP.cmake b/CMakeExternals/QtSOAP.cmake index 8821234b27..72640ea370 100644 --- a/CMakeExternals/QtSOAP.cmake +++ b/CMakeExternals/QtSOAP.cmake @@ -24,7 +24,7 @@ endif() if(NOT DEFINED QtSOAP_DIR) - set(revision_tag 9c321151f19c87504eb55d53802eaf42e11bb989) + set(revision_tag 2e967e902c27b4ab76f8dcbffbf6037eac4abd05) if(${proj}_REVISION_TAG) set(revision_tag ${${proj}_REVISION_TAG}) endif() From 1b7277652043f13dd160d74c15794c2efc488fe4 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Tue, 13 Jun 2023 19:40:53 -0400 Subject: [PATCH 03/12] COMP: Fix deprecated use of QLabel::pixmap() in org.commontk.dah plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes warning like the following: /path/to/CTK/Plugins/org.commontk.dah.cmdlinemoduleapp/ctkCommandLineModuleAppLogic.cpp:307:58: warning: ‘const QPixmap* QLabel::pixmap() const’ is deprecated: Use the other overload which returns QPixmap by-value [-Wdeprecated-declarations] 307 | const QPixmap* pixmap = ui.PlaceHolderForImage->pixmap(); | ^ --- .../ctkCommandLineModuleAppLogic.cpp | 9 +++++++++ .../ctkExampleDicomAppLogic.cpp | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/Plugins/org.commontk.dah.cmdlinemoduleapp/ctkCommandLineModuleAppLogic.cpp b/Plugins/org.commontk.dah.cmdlinemoduleapp/ctkCommandLineModuleAppLogic.cpp index 2500ac8ad2..ab2e08fbc6 100644 --- a/Plugins/org.commontk.dah.cmdlinemoduleapp/ctkCommandLineModuleAppLogic.cpp +++ b/Plugins/org.commontk.dah.cmdlinemoduleapp/ctkCommandLineModuleAppLogic.cpp @@ -304,8 +304,13 @@ void ctkCommandLineModuleAppLogic::onLoadDataClicked() void ctkCommandLineModuleAppLogic::onCreateSecondaryCapture() { +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + QPixmap pixmap = ui.PlaceHolderForImage->pixmap(Qt::ReturnByValue); + if (!pixmap.isNull()) +#else const QPixmap* pixmap = ui.PlaceHolderForImage->pixmap(); if(pixmap!=NULL) +#endif { QString templatefilename = QDir(OutputLocation).absolutePath(); if(templatefilename.isEmpty()==false) templatefilename.append('/'); @@ -325,7 +330,11 @@ void ctkCommandLineModuleAppLogic::onCreateSecondaryCapture() outputtmp.close(); } +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + pixmap.save(inputFileName); +#else pixmap->save(inputFileName); +#endif ModuleFrontend->setValue("fileVar", inputFileName); ModuleFrontend->setValue("dirVar", outputFileName); diff --git a/Plugins/org.commontk.dah.exampleapp/ctkExampleDicomAppLogic.cpp b/Plugins/org.commontk.dah.exampleapp/ctkExampleDicomAppLogic.cpp index 96c295448c..c27fb3571a 100644 --- a/Plugins/org.commontk.dah.exampleapp/ctkExampleDicomAppLogic.cpp +++ b/Plugins/org.commontk.dah.exampleapp/ctkExampleDicomAppLogic.cpp @@ -280,8 +280,13 @@ void ctkExampleDicomAppLogic::onLoadDataClicked() void ctkExampleDicomAppLogic::onCreateSecondaryCapture() { +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + QPixmap tmppixmap = ui.PlaceHolderForImage->pixmap(Qt::ReturnByValue); + if (!tmppixmap.isNull()) +#else const QPixmap* pixmap = ui.PlaceHolderForImage->pixmap(); if(pixmap!=NULL) +#endif { QStringList preferredProtocols; preferredProtocols.append("file:"); @@ -296,7 +301,11 @@ void ctkExampleDicomAppLogic::onCreateSecondaryCapture() QString filename = QFileInfo(tempfile->fileName()).absoluteFilePath(); qDebug() << "Created file: " << filename; tempfile->close(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + // tmppixmap is already set +#else QPixmap tmppixmap(*pixmap); +#endif QPainter painter(&tmppixmap); painter.setPen(Qt::white); painter.setFont(QFont("Arial", 15)); From 85d173ce46f863afddc8c45feef844828e3030e6 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 15 Jun 2023 01:29:16 -0400 Subject: [PATCH 04/12] COMP: Update QtTesting to fix deprecation warnings List of changes: $ git shortlog b5324a213..a86bee551 --no-merges Jean-Christophe Fillion-Robin (3): COMP: Fix split deprecation warnings using Qt::SkipEmptyParts COMP: Fix QString::null deprecation warnings COMP: Fix deprecated use of QWheelEvent functions delta(), pos(), x(), y() --- CMakeExternals/QtTesting.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeExternals/QtTesting.cmake b/CMakeExternals/QtTesting.cmake index e6197be6c4..a0e3f3ae56 100644 --- a/CMakeExternals/QtTesting.cmake +++ b/CMakeExternals/QtTesting.cmake @@ -27,7 +27,7 @@ if(NOT DEFINED QtTesting_DIR) if("${CMAKE_CXX_STANDARD}" STREQUAL "98") set(revision_tag c44b32fdea827be737e8c2f5608ffbc2e3bd08b2) else() - set(revision_tag b5324a213dc3c4abd7b588575ea926db57aa981e) + set(revision_tag a86bee55104f553a1cb82b9cf0b109d9f1e95dbf) # ctk-2019-03-14-b5324a2 endif() if(${proj}_REVISION_TAG) set(revision_tag ${${proj}_REVISION_TAG}) From 13555d128183e9e22ad324e8ec074c999fa98b49 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 14 Jun 2023 00:54:19 -0400 Subject: [PATCH 05/12] COMP: Fix QWheelEvent deprecated warning in ctkVTKRenderViewEventPlayer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes the following warnings: /path/to/CTK/Libs/Visualization/VTK/Widgets/ctkVTKRenderViewEventTranslator.cpp:77:45: warning: ‘int QWheelEvent::x() const’ is deprecated: Use position() [-Wdeprecated-declarations] 77 | double normalized_x = wheelEvent->x()/static_cast(size.width()/2.0); | ^ /path/to/CTK/Libs/Visualization/VTK/Widgets/ctkVTKRenderViewEventTranslator.cpp:78:45: warning: ‘int QWheelEvent::y() const’ is deprecated: Use position() [-Wdeprecated-declarations] 78 | double normalized_y = wheelEvent->y()/static_cast(size.height()/2.0); | ^ /path/to/CTK/Libs/Visualization/VTK/Widgets/ctkVTKRenderViewEventTranslator.cpp:79:42: warning: ‘int QWheelEvent::delta() const’ is deprecated: Use angleDelta() [-Wdeprecated-declarations] 79 | int numStep = (wheelEvent->delta() > 0 ) ? 1 : 0; | ^ --- .../VTK/Widgets/ctkVTKRenderViewEventTranslator.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKRenderViewEventTranslator.cpp b/Libs/Visualization/VTK/Widgets/ctkVTKRenderViewEventTranslator.cpp index 591a84f3f6..31cb493f7a 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKRenderViewEventTranslator.cpp +++ b/Libs/Visualization/VTK/Widgets/ctkVTKRenderViewEventTranslator.cpp @@ -74,9 +74,18 @@ bool ctkVTKRenderViewEventTranslator::translateEvent(QObject *Object, if(wheelEvent) { QSize size = widget->size(); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) + double normalized_x = wheelEvent->position().x() / static_cast(size.width() / 2.0); + double normalized_y = wheelEvent->position().y() / static_cast(size.height() / 2.0); +#else double normalized_x = wheelEvent->x()/static_cast(size.width()/2.0); double normalized_y = wheelEvent->y()/static_cast(size.height()/2.0); +#endif +#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) + int numStep = (wheelEvent->angleDelta().y() > 0 ) ? 1 : 0; +#else int numStep = (wheelEvent->delta() > 0 ) ? 1 : 0; +#endif int buttons = wheelEvent->buttons(); int modifiers = wheelEvent->modifiers(); emit emit recordEvent(Object, "mouseWheel", QString("(%1,%2,%3,%4,%5)") From f29cabb9762b54432026e8d6bbb922244962ea37 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 13 Apr 2023 12:04:29 -0400 Subject: [PATCH 06/12] COMP: Fix build of plugin tests This commit fixes a regression introduced in 8ec913626 (COMP: Fix Qt4 build adding fallback implementation for qUtf8Printable()) It addresses error like the following: In file included from /path/to/CTK/Libs/PluginFramework/ctkPluginConstants.h:27, from /path/to/CTK/Plugins/org.commontk.eventadmin/Testing/Cpp/ctkEventAdminImplPerfTestMain.cpp:26: /path/to/CTK-build/CTK-build/Libs/PluginFramework/ctkPluginFrameworkExport.h:11:10: fatal error: ctkCompatibility_p.h: No such file or directory 11 | #include "ctkCompatibility_p.h" | ^~~~~~~~~~~~~~~~~~~~~~ --- Plugins/org.commontk.configadmin/Testing/Cpp/CMakeLists.txt | 3 +++ Plugins/org.commontk.eventadmin/Testing/Cpp/CMakeLists.txt | 3 +++ Plugins/org.commontk.metatype/Testing/Cpp/CMakeLists.txt | 3 +++ 3 files changed, 9 insertions(+) diff --git a/Plugins/org.commontk.configadmin/Testing/Cpp/CMakeLists.txt b/Plugins/org.commontk.configadmin/Testing/Cpp/CMakeLists.txt index 33237a5540..fd47cead9b 100644 --- a/Plugins/org.commontk.configadmin/Testing/Cpp/CMakeLists.txt +++ b/Plugins/org.commontk.configadmin/Testing/Cpp/CMakeLists.txt @@ -12,6 +12,9 @@ set(test_executable ${PROJECT_NAME}CppTests) set(${test_executable}_DEPENDENCIES ${fw_lib} ${fwtestutil_lib} CTKCore) +# Ensure "ctkCompatibility_p.h" included from the export header is found +list(APPEND ${test_executable}_DEPENDENCIES CTKCore) + set(my_includes) ctkFunctionGetIncludeDirs(my_includes ${test_executable}) include_directories(${my_includes}) diff --git a/Plugins/org.commontk.eventadmin/Testing/Cpp/CMakeLists.txt b/Plugins/org.commontk.eventadmin/Testing/Cpp/CMakeLists.txt index 0f06759552..51016bb159 100644 --- a/Plugins/org.commontk.eventadmin/Testing/Cpp/CMakeLists.txt +++ b/Plugins/org.commontk.eventadmin/Testing/Cpp/CMakeLists.txt @@ -14,6 +14,9 @@ set(test_executable ${PROJECT_NAME}CppTests) set(${test_executable}_DEPENDENCIES ${fw_lib} ${fwtestutil_lib}) +# Ensure "ctkCompatibility_p.h" included from the export header is found +list(APPEND ${test_executable}_DEPENDENCIES CTKCore) + set(my_includes) ctkFunctionGetIncludeDirs(my_includes ${test_executable}) include_directories(${my_includes}) diff --git a/Plugins/org.commontk.metatype/Testing/Cpp/CMakeLists.txt b/Plugins/org.commontk.metatype/Testing/Cpp/CMakeLists.txt index 1d305b6105..a10c0ed229 100644 --- a/Plugins/org.commontk.metatype/Testing/Cpp/CMakeLists.txt +++ b/Plugins/org.commontk.metatype/Testing/Cpp/CMakeLists.txt @@ -12,6 +12,9 @@ set(test_executable ${PROJECT_NAME}CppTests) set(${test_executable}_DEPENDENCIES ${fw_lib} ${fwtestutil_lib}) +# Ensure "ctkCompatibility_p.h" included from the export header is found +list(APPEND ${test_executable}_DEPENDENCIES CTKCore) + set(my_includes) ctkFunctionGetIncludeDirs(my_includes ${test_executable}) include_directories(${my_includes}) From 66603a2ad0d73edcfda167fee318ccdca7648c11 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 15 Jun 2023 02:31:04 -0400 Subject: [PATCH 07/12] COMP: Fix unused function warning related to ctkFileCompleter::nameFilters() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes the following warning: /path/to/CTK/Libs/Widgets/ctkPathLineEdit.cpp:212:13: warning: ‘QStringList {anonymous}::ctkFileCompleter::nameFilters() const’ defined but not used [-Wunused-function] 212 | QStringList ctkFileCompleter::nameFilters() const | ^~~~~~~~~~~~~~~~ --- Libs/Widgets/ctkPathLineEdit.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/Libs/Widgets/ctkPathLineEdit.cpp b/Libs/Widgets/ctkPathLineEdit.cpp index 9bd9cbe788..245fdf2d8b 100644 --- a/Libs/Widgets/ctkPathLineEdit.cpp +++ b/Libs/Widgets/ctkPathLineEdit.cpp @@ -110,7 +110,11 @@ class ctkFileCompleter : public QCompleter // and the global shared file system models are used. If name filters are set then // a custom custom file system is created for the widget. void setNameFilters(const QStringList& filters); - QStringList nameFilters() const; + + // Since nameFilters() function may be relevant when more work will be done, + // it is commented to quiet the "-Wunused-function" warning. + // + // QStringList nameFilters() const; protected: QFileSystemModel* CustomFileSystemModel; @@ -209,15 +213,19 @@ void ctkFileCompleter::setNameFilters(const QStringList& filters) } //----------------------------------------------------------------------------- -QStringList ctkFileCompleter::nameFilters() const -{ - QFileSystemModel* fileSystemModel = this->fileSystemModel(); - if (!fileSystemModel) - { - return QStringList(); - } - return fileSystemModel->nameFilters(); -} +// Since nameFilters() function may be relevant when more work will be done, +// it is commented to quiet the "-Wunused-function" warning. +// +//----------------------------------------------------------------------------- +//QStringList ctkFileCompleter::nameFilters() const +//{ +// QFileSystemModel* fileSystemModel = this->fileSystemModel(); +// if (!fileSystemModel) +// { +// return QStringList(); +// } +// return fileSystemModel->nameFilters(); +//} //----------------------------------------------------------------------------- QFileSystemModel* ctkFileCompleter::fileSystemModel() const From 8d2aeb97e8fc8b01e4642c5a523525210bc17b68 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 15 Jun 2023 02:44:06 -0400 Subject: [PATCH 08/12] COMP: Fix deprecated use of QDesktopWidget::primaryScreen() in ctkSettings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes the following warning: /path/to/CTK/Libs/Widgets/ctkSettings.cpp:138:74: warning: ‘int QDesktopWidget::primaryScreen() const’ is deprecated: Use QGuiApplication::primaryScreen() [-Wdeprecated-declarations] 138 | QRect desktopRect = desktop.availableGeometry( desktop.primaryScreen() ); | ^ --- Libs/Widgets/ctkSettings.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Libs/Widgets/ctkSettings.cpp b/Libs/Widgets/ctkSettings.cpp index 67f76598fa..331d163fa3 100644 --- a/Libs/Widgets/ctkSettings.cpp +++ b/Libs/Widgets/ctkSettings.cpp @@ -53,7 +53,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Qt includes #include #include +#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) +#include +#include +#else #include +#endif //----------------------------------------------------------------------------- ctkSettings::ctkSettings(const QString& organization, @@ -133,9 +138,13 @@ void ctkSettings::restoreState(const QString& key, QMainWindow& window) { QPoint windowTopLeft = this->value("Position").toPoint(); QRect mwRect(windowTopLeft, window.size()); - + +#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) + QRect desktopRect = QGuiApplication::primaryScreen()->availableGeometry(); +#else QDesktopWidget desktop; QRect desktopRect = desktop.availableGeometry( desktop.primaryScreen() ); +#endif // try moving it to keep size if(!desktopRect.contains(mwRect)) { From 21fb4fdea01c69f37c1609c6d8974a3742f22868 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 15 Jun 2023 03:05:36 -0400 Subject: [PATCH 09/12] COMP: Fix deprecated use of QDesktopWidget in ctkTreeComboBox MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes the following warning: /path/to/CTK/Libs/Widgets/ctkTreeComboBox.cpp:243:48: warning: ‘const QRect QDesktopWidget::availableGeometry(int) const’ is deprecated: Use QGuiApplication::screens() [-Wdeprecated-declarations] 243 | QApplication::desktop()->screenNumber(this)); | ^ ^ --- Libs/Widgets/ctkTreeComboBox.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Libs/Widgets/ctkTreeComboBox.cpp b/Libs/Widgets/ctkTreeComboBox.cpp index be16c30522..40eb8d093e 100644 --- a/Libs/Widgets/ctkTreeComboBox.cpp +++ b/Libs/Widgets/ctkTreeComboBox.cpp @@ -20,7 +20,11 @@ // Qt includes #include +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) +#include +#else #include +#endif #include #include #include @@ -239,8 +243,12 @@ void ctkTreeComboBox::resizePopup() this->initStyleOption(&opt); QRect listRect(style->subControlRect(QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxListBoxPopup, this)); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) + QRect screen = this->screen()->availableGeometry(); +#else QRect screen = QApplication::desktop()->availableGeometry( QApplication::desktop()->screenNumber(this)); +#endif QPoint below = this->mapToGlobal(listRect.bottomLeft()); int belowHeight = screen.bottom() - below.y(); QPoint above = this->mapToGlobal(listRect.topLeft()); From 1b0929038425a1aaee8b1708cc57afe2e451301c Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 15 Jun 2023 03:22:17 -0400 Subject: [PATCH 10/12] COMP: Fix unused variable warning in ctkVTKAbstractViewTest1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes the following warning: /path/to/CTK/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKAbstractViewTest1.cpp:126:8: warning: unused variable ‘sliceViewWasPaused’ [-Wunused-variable] 126 | bool sliceViewWasPaused = sliceView.pauseRender(); | ^~~~~~~~~~~~~~~~~~ --- .../VTK/Widgets/Testing/Cpp/ctkVTKAbstractViewTest1.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKAbstractViewTest1.cpp b/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKAbstractViewTest1.cpp index 979593d4ba..d005acbb04 100644 --- a/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKAbstractViewTest1.cpp +++ b/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKAbstractViewTest1.cpp @@ -124,6 +124,7 @@ int ctkVTKAbstractViewTest1(int argc, char * argv [] ) CHECK_BOOL(RenderCount == 0, false); bool sliceViewWasPaused = sliceView.pauseRender(); + CHECK_BOOL(sliceViewWasPaused, true); RenderCount = 0; sliceView.scheduleRender(); sleep_ms(100); From 111b974c185652606a4984d577c54cce111768ab Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 15 Jun 2023 03:28:32 -0400 Subject: [PATCH 11/12] COMP: Fix QFlags deprectation warning in ctkQtResourcesTreeModel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes the following warning: /path/to/CTK/Applications/ctkPluginBrowser/ctkQtResourcesTreeModel.cpp:195:12: warning: ‘constexpr QFlags::QFlags(QFlags::Zero) [with Enum = Qt::ItemFlag; QFlags::Zero = int QFlags::Private::*]’ is deprecated: Use default constructor instead [-Wdeprecated-declarations] 195 | return 0; | ^ --- Applications/ctkPluginBrowser/ctkQtResourcesTreeModel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Applications/ctkPluginBrowser/ctkQtResourcesTreeModel.cpp b/Applications/ctkPluginBrowser/ctkQtResourcesTreeModel.cpp index fdd686b00b..2ee1b9c2da 100644 --- a/Applications/ctkPluginBrowser/ctkQtResourcesTreeModel.cpp +++ b/Applications/ctkPluginBrowser/ctkQtResourcesTreeModel.cpp @@ -192,7 +192,7 @@ QVariant ctkQtResourcesTreeModel::data(const QModelIndex &index, int role) const Qt::ItemFlags ctkQtResourcesTreeModel::flags(const QModelIndex &index) const { if (!index.isValid()) - return 0; + return Qt::ItemFlags(); return Qt::ItemIsEnabled | Qt::ItemIsSelectable; } From 1e7646ba2484492ab75668e004e9a7f4ee7f5be3 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 15 Jun 2023 03:41:43 -0400 Subject: [PATCH 12/12] COMP: Fix -Wint-in-bool-context warning in ctkErrorLogModelTerminalOutputTest1 This fixes the following warning: /path/to/CTK/Libs/Widgets/Testing/Cpp/ctkErrorLogModelTerminalOutputTest1.cpp:127:87: warning: enum constant in boolean context [-Wint-in-bool-context] 127 | currentTerminalOutputEnabled, ctkErrorLogTerminalOutput::All); | ^ It is a following of fc9a964cc (Add multi-thread support to ErrorLog model) where the boolean check was originally introduced. --- .../Cpp/ctkErrorLogModelTerminalOutputTest1.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Libs/Widgets/Testing/Cpp/ctkErrorLogModelTerminalOutputTest1.cpp b/Libs/Widgets/Testing/Cpp/ctkErrorLogModelTerminalOutputTest1.cpp index b8aff85ef7..8b1f3e2cfa 100644 --- a/Libs/Widgets/Testing/Cpp/ctkErrorLogModelTerminalOutputTest1.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkErrorLogModelTerminalOutputTest1.cpp @@ -109,9 +109,9 @@ int ctkErrorLogModelTerminalOutputTest1(int argc, char * argv []) QString errorMsg; ctkErrorLogModel model; - ctkErrorLogTerminalOutput::TerminalOutputs currentTerminalOutputEnabled = model.terminalOutputs(); - errorMsg = checkBoolean(__LINE__, "TerminalOutputEnabled", - currentTerminalOutputEnabled, ctkErrorLogTerminalOutput::None); + ctkErrorLogTerminalOutput::TerminalOutputs currentTerminalOutput = model.terminalOutputs(); + errorMsg = checkInteger(__LINE__, "TerminalOutput", + currentTerminalOutput, ctkErrorLogTerminalOutput::None); if (!errorMsg.isEmpty()) { model.disableAllMsgHandler(); @@ -122,9 +122,9 @@ int ctkErrorLogModelTerminalOutputTest1(int argc, char * argv []) model.setTerminalOutputs(ctkErrorLogTerminalOutput::All); - currentTerminalOutputEnabled = model.terminalOutputs(); - errorMsg = checkBoolean(__LINE__, "TerminalOutputEnabled", - currentTerminalOutputEnabled, ctkErrorLogTerminalOutput::All); + currentTerminalOutput = model.terminalOutputs(); + errorMsg = checkInteger(__LINE__, "TerminalOutput", + currentTerminalOutput, ctkErrorLogTerminalOutput::All); if (!errorMsg.isEmpty()) { model.disableAllMsgHandler();