From ac4c0d755999c2a039f5a2142e5dc2824504d782 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Fri, 14 Apr 2023 02:33:42 -0400 Subject: [PATCH 001/115] BUG: Fix regression in ctkDateRangeWidget This commit fixes ctkDateRangeWidgetTest1 failure introduced in 591820e20 (COMP: Fix QDateTime Start and End time deprecation warning) --- Libs/Widgets/ctkDateRangeWidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libs/Widgets/ctkDateRangeWidget.cpp b/Libs/Widgets/ctkDateRangeWidget.cpp index 4660a7b799..17dbc07db7 100644 --- a/Libs/Widgets/ctkDateRangeWidget.cpp +++ b/Libs/Widgets/ctkDateRangeWidget.cpp @@ -67,7 +67,7 @@ void ctkDateRangeWidgetPrivate::autoselectRadioButton() QDate endDate = q->endDateTime().date(); #if (QT_VERSION >= QT_VERSION_CHECK(5,14,0)) QDateTime startOfDay = q->startDateTime().date().startOfDay(); - QDateTime endOfDay = q->startDateTime().date().endOfDay(); + QDateTime endOfDay = q->endDateTime().date().startOfDay(); #else QDateTime startOfDay = QDateTime(q->startDateTime().date()); QDateTime endOfDay = QDateTime(q->endDateTime().date()); @@ -200,7 +200,7 @@ void ctkDateRangeWidget::setDateTimeRange(QDateTime startDateTime, QDateTime end void ctkDateRangeWidget::setDateRange(QDate startDate, QDate endDate) { #if (QT_VERSION >= QT_VERSION_CHECK(5,14,0)) - this->setDateTimeRange(startDate.startOfDay(), endDate.endOfDay()); + this->setDateTimeRange(startDate.startOfDay(), endDate.startOfDay()); #else this->setDateTimeRange(QDateTime(startDate), QDateTime(endDate)); #endif From a17882bbd9f760a73363cfad2d353ce7d4c3c112 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Fri, 14 Apr 2023 02:35:02 -0400 Subject: [PATCH 002/115] BUG: Remove obsolete error message in ctkDateRangeWidget::displayTime Following 9021b4f7f2 (Cleanup ctkDateRangeWidget), support for displaying time was introduced. --- Libs/Widgets/ctkDateRangeWidget.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Libs/Widgets/ctkDateRangeWidget.cpp b/Libs/Widgets/ctkDateRangeWidget.cpp index 17dbc07db7..b4e88c9caf 100644 --- a/Libs/Widgets/ctkDateRangeWidget.cpp +++ b/Libs/Widgets/ctkDateRangeWidget.cpp @@ -27,9 +27,6 @@ // CTK includes #include "ctkDateRangeWidget.h" #include "ui_ctkDateRangeWidget.h" -#include "ctkLogger.h" - -static ctkLogger logger("org.commontk.libs.widgets.ctkDateRangeWidget"); //----------------------------------------------------------------------------- class ctkDateRangeWidgetPrivate: public Ui_ctkDateRangeWidget @@ -286,7 +283,6 @@ void ctkDateRangeWidget::setDisplayTime(bool displayTime) // ------------------------------------------------------------------------- bool ctkDateRangeWidget::displayTime()const { - logger.error("including time in the date range is not supported now"); Q_D(const ctkDateRangeWidget); return d->DisplayTime; } From 8814db0a3d6bae4ab57bab74515c31aa52e7b5b9 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Fri, 14 Apr 2023 02:36:14 -0400 Subject: [PATCH 003/115] COMP: Fix QDateTime deprecation warnings in ctkDateRangeWidgetTest1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes warings like the following: /path/to/CTK/Libs/Widgets/Testing/Cpp/ctkDateRangeWidgetTest1.cpp:41:51: warning: ‘QDateTime::QDateTime(const QDate&)’ is deprecated: Use QDate::startOfDay() [-Wdeprecated-declarations] 41 | QDateTime today = QDateTime(QDate::currentDate()); | ^ --- Libs/Widgets/Testing/Cpp/ctkDateRangeWidgetTest1.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Libs/Widgets/Testing/Cpp/ctkDateRangeWidgetTest1.cpp b/Libs/Widgets/Testing/Cpp/ctkDateRangeWidgetTest1.cpp index 8c1eda53e9..086a066225 100644 --- a/Libs/Widgets/Testing/Cpp/ctkDateRangeWidgetTest1.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkDateRangeWidgetTest1.cpp @@ -35,7 +35,11 @@ int ctkDateRangeWidgetTest1(int argc, char * argv [] ) { QApplication app(argc, argv); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) + QDateTime today = QDate::currentDate().startOfDay(); +#else QDateTime today = QDateTime(QDate::currentDate()); +#endif QDateTime tomorrow = today.addDays(1); QDateTime yesterday = today.addDays(-1); QDateTime lastWeek = today.addDays(-7); @@ -112,8 +116,13 @@ int ctkDateRangeWidgetTest1(int argc, char * argv [] ) return EXIT_FAILURE; } +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) + dateRange.setDateTimeRange(QDate(-2, -9,12345678).startOfDay(), + QDate(2010, 15, 32).startOfDay()); +#else dateRange.setDateTimeRange(QDateTime(QDate(-2, -9,12345678)), QDateTime(QDate(2010, 15, 32))); +#endif if (!dateRange.isAnyDate() || dateRange.startDateTime() == lastMonth || dateRange.endDateTime() == today) From ff517a3378a95ceb191548eb83d65f25c4a7b77a Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Fri, 14 Apr 2023 02:42:52 -0400 Subject: [PATCH 004/115] STYLE: Simplify handling of Qt4 & Qt5 API differences in ctkDateRangeWidget Partially revert 591820e20 (COMP: Fix QDateTime Start and End time deprecation warning) removing the introduction of "startOfDay" and "endOfDay" ivars. --- Libs/Widgets/ctkDateRangeWidget.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Libs/Widgets/ctkDateRangeWidget.cpp b/Libs/Widgets/ctkDateRangeWidget.cpp index b4e88c9caf..91d3b34620 100644 --- a/Libs/Widgets/ctkDateRangeWidget.cpp +++ b/Libs/Widgets/ctkDateRangeWidget.cpp @@ -62,13 +62,6 @@ void ctkDateRangeWidgetPrivate::autoselectRadioButton() Q_Q(ctkDateRangeWidget); QDate startDate = q->startDateTime().date(); QDate endDate = q->endDateTime().date(); - #if (QT_VERSION >= QT_VERSION_CHECK(5,14,0)) - QDateTime startOfDay = q->startDateTime().date().startOfDay(); - QDateTime endOfDay = q->endDateTime().date().startOfDay(); - #else - QDateTime startOfDay = QDateTime(q->startDateTime().date()); - QDateTime endOfDay = QDateTime(q->endDateTime().date()); - #endif if (this->ForceSelectRange) { this->SelectRangeRadioButton->setChecked(true); @@ -77,8 +70,13 @@ void ctkDateRangeWidgetPrivate::autoselectRadioButton() { this->AnyDateRadioButton->setChecked(true); } - else if (q->startDateTime() != startOfDay || - q->endDateTime() != endOfDay) +#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0)) + else if (q->startDateTime() != q->startDateTime().date().startOfDay() || + q->endDateTime() != q->endDateTime().date().startOfDay()) +#else + else if (q->startDateTime() != QDateTime(q->startDateTime().date()) || + q->endDateTime() != QDateTime(q->endDateTime().date())) +#endif { this->SelectRangeRadioButton->setChecked(true); } From 4472eff8a4950214080f8ef82a6ccaa9801bc09c Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Fri, 14 Apr 2023 03:50:15 -0400 Subject: [PATCH 005/115] COMP: Fix -Wimplicit-fallthrough warnings in PluginFramework This commit adds the comment recognized by the GCC when using Qt < 5.8. See https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-fallthrough It fixes warnings like the following: /path/to/CTK/Libs/PluginFramework/ctkPlugin_p.cpp:350:5: warning: this statement may fall through [-Wimplicit-fallthrough=] 350 | if (operation.fetchAndAddOrdered(0) == ACTIVATING) return; // finalization already in progress. | ^~ --- Libs/PluginFramework/ctkPluginFramework.cpp | 10 ++++++++++ Libs/PluginFramework/ctkPlugin_p.cpp | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/Libs/PluginFramework/ctkPluginFramework.cpp b/Libs/PluginFramework/ctkPluginFramework.cpp index dfcc0196a4..7312edc986 100644 --- a/Libs/PluginFramework/ctkPluginFramework.cpp +++ b/Libs/PluginFramework/ctkPluginFramework.cpp @@ -106,8 +106,18 @@ void ctkPluginFramework::start(const ctkPlugin::StartOptions& options) switch (d->state) { case INSTALLED: +#if (QT_VERSION >= QT_VERSION_CHECK(5,8,0)) + Q_FALLTHROUGH(); +#else + /* FALLTHRU */ +#endif case RESOLVED: d->init(); +#if (QT_VERSION >= QT_VERSION_CHECK(5,8,0)) + Q_FALLTHROUGH(); +#else + /* FALLTHRU */ +#endif case STARTING: d->operation.fetchAndStoreOrdered(ctkPluginPrivate::ACTIVATING); break; diff --git a/Libs/PluginFramework/ctkPlugin_p.cpp b/Libs/PluginFramework/ctkPlugin_p.cpp index df2345f75e..84311b1e18 100644 --- a/Libs/PluginFramework/ctkPlugin_p.cpp +++ b/Libs/PluginFramework/ctkPlugin_p.cpp @@ -349,6 +349,11 @@ void ctkPluginPrivate::finalizeActivation() case ctkPlugin::STARTING: if (operation.fetchAndAddOrdered(0) == ACTIVATING) return; // finalization already in progress. // Lazy activation; fall through to RESOLVED. +#if (QT_VERSION >= QT_VERSION_CHECK(5,8,0)) + Q_FALLTHROUGH(); +#else + /* FALLTHRU */ +#endif case ctkPlugin::RESOLVED: { //6: From d78f749d774bd9fb5baaa7d65dcd5d909587fe96 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Fri, 14 Apr 2023 03:51:21 -0400 Subject: [PATCH 006/115] COMP: Fix -Wdeprecated-declarations related to QWeakPointer 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/PluginFramework/ctkPlugin_p.cpp:532:29: warning: ‘T* QWeakPointer::data() const [with T = ctkPlugin]’ is deprecated: Use toStrongRef() instead, and data() on the returned QSharedPointer [-Wdeprecated-declarations] 532 | this->q_func().data()->start(); | ^ --- Libs/PluginFramework/ctkPlugin_p.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libs/PluginFramework/ctkPlugin_p.cpp b/Libs/PluginFramework/ctkPlugin_p.cpp index 84311b1e18..c46289af62 100644 --- a/Libs/PluginFramework/ctkPlugin_p.cpp +++ b/Libs/PluginFramework/ctkPlugin_p.cpp @@ -534,7 +534,7 @@ void ctkPluginPrivate::update0(const QUrl& updateLocation, bool wasActive) { try { - this->q_func().data()->start(); + this->q_func().toStrongRef()->start(); } catch (const ctkPluginException& pe) { @@ -588,7 +588,7 @@ void ctkPluginPrivate::update0(const QUrl& updateLocation, bool wasActive) { try { - this->q_func().data()->start(); + this->q_func().toStrongRef()->start(); } catch (const ctkPluginException& pe) { From 259528e1a9662a74e4ed61e4c5b07e9dd6790370 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Fri, 14 Apr 2023 04:00:27 -0400 Subject: [PATCH 007/115] COMP: Fix -Wcatch-value in ctkPlugin 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/PluginFramework/ctkPlugin_p.cpp:544:17: warning: catching polymorphic type ‘class std::bad_cast’ by value [-Wcatch-value=] 544 | catch (std::bad_cast) | ^~~~~~~~ --- Libs/PluginFramework/ctkPlugin_p.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libs/PluginFramework/ctkPlugin_p.cpp b/Libs/PluginFramework/ctkPlugin_p.cpp index c46289af62..ddf829b745 100644 --- a/Libs/PluginFramework/ctkPlugin_p.cpp +++ b/Libs/PluginFramework/ctkPlugin_p.cpp @@ -546,7 +546,7 @@ void ctkPluginPrivate::update0(const QUrl& updateLocation, bool wasActive) const ctkPluginException& pe = dynamic_cast(e); throw pe; } - catch (std::bad_cast) + catch (const std::bad_cast&) { throw ctkPluginException(QString("Failed to get update plugin: ") + e.what(), ctkPluginException::UNSPECIFIED); From b17c2716df5caea5b6ea7bdcfc664140893a16cb Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Fri, 14 Apr 2023 04:01:08 -0400 Subject: [PATCH 008/115] STYLE: Consistently catch exceptions by reference --- Libs/DICOM/Widgets/ctkDICOMAppWidget.cpp | 2 +- .../org.commontk.pluginfwtest/ctkPluginFrameworkTestSuite.cpp | 4 ++-- .../org.commontk.configadmin/ctkConfigurationAdminImpl.cpp | 2 +- Plugins/org.commontk.configadmin/ctkConfigurationStore.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Libs/DICOM/Widgets/ctkDICOMAppWidget.cpp b/Libs/DICOM/Widgets/ctkDICOMAppWidget.cpp index c6f3289231..50a2f961b0 100644 --- a/Libs/DICOM/Widgets/ctkDICOMAppWidget.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMAppWidget.cpp @@ -405,7 +405,7 @@ void ctkDICOMAppWidget::setDatabaseDirectory(const QString& directory) { d->DICOMDatabase->openDatabase( databaseFileName ); } - catch (std::exception &) + catch (const std::exception &) { std::cerr << "Database error: " << qPrintable(d->DICOMDatabase->lastError()) << "\n"; d->DICOMDatabase->closeDatabase(); diff --git a/Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkPluginFrameworkTestSuite.cpp b/Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkPluginFrameworkTestSuite.cpp index e2d399286d..f6c62643dd 100644 --- a/Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkPluginFrameworkTestSuite.cpp +++ b/Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkPluginFrameworkTestSuite.cpp @@ -211,7 +211,7 @@ void ctkPluginFrameworkTestSuite::frame020a() { pA = ctkPluginFrameworkTestUtil::installPlugin(pc, "pluginA_test"); } - catch (ctkPluginException& e) + catch (const ctkPluginException& e) { QFAIL(e.what()); } @@ -388,7 +388,7 @@ void ctkPluginFrameworkTestSuite::frame040a() qDebug() << "Expected exception" << pe; exception = true; } - // catch (SecurityException secA) { + // catch (const SecurityException& secA) { // QFAIL("framework test plugin " + secA + " :FRAME040A:FAIL"); // teststatus = false; // exception = true; diff --git a/Plugins/org.commontk.configadmin/ctkConfigurationAdminImpl.cpp b/Plugins/org.commontk.configadmin/ctkConfigurationAdminImpl.cpp index 8964cd1aba..0b850d9cd4 100644 --- a/Plugins/org.commontk.configadmin/ctkConfigurationAdminImpl.cpp +++ b/Plugins/org.commontk.configadmin/ctkConfigurationAdminImpl.cpp @@ -80,7 +80,7 @@ QList ctkConfigurationAdminImpl::listConfigurations(const Q //{ configurationAdminFactory->checkConfigurationPermission(); //} - //catch (SecurityException e) { + //catch (const SecurityException& e) { // filterString = "(&(" + ConfigurationAdmin.SERVICE_BUNDLELOCATION + "=" + bundle.getLocation() + ")" + filterString + ")"; //} QList configs = configurationStore->listConfigurations(ctkLDAPSearchFilter(filterString)); diff --git a/Plugins/org.commontk.configadmin/ctkConfigurationStore.cpp b/Plugins/org.commontk.configadmin/ctkConfigurationStore.cpp index b7a12f8f58..04470da013 100644 --- a/Plugins/org.commontk.configadmin/ctkConfigurationStore.cpp +++ b/Plugins/org.commontk.configadmin/ctkConfigurationStore.cpp @@ -102,7 +102,7 @@ void ctkConfigurationStore::saveConfiguration(const QString& pid, ctkConfigurati // } // }); // } -// catch (PrivilegedActionException e) +// catch (const PrivilegedActionException& e) // { // throw (IOException) e.getException(); // } From 757b21d51ebe957fd3a6b8f30ebc0ab5fa759186 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Fri, 14 Apr 2023 09:08:57 -0400 Subject: [PATCH 009/115] COMP: Fix -Wsign-promo in Widgets & DICOMWidgets 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/Testing/Cpp/ctkCheckableHeaderViewTest1.cpp:76:73: warning: passing ‘Qt::CheckState’ chooses ‘int’ over ‘uint’ {aka ‘unsigned int’} [-Wsign-promo] 76 | model.setHeaderData(0, Qt::Horizontal, Qt::Checked, Qt::CheckStateRole); | --- Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMBrowserTest.cpp | 4 ++-- Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMModelTest2.cpp | 2 +- .../Widgets/Testing/Cpp/ctkDICOMServerNodeWidgetTest1.cpp | 2 +- Libs/DICOM/Widgets/ctkDICOMBrowser.cpp | 8 ++++---- .../ctkCheckableHeaderViewEventTranslatorPlayerTest1.cpp | 4 ++-- Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewTest1.cpp | 2 +- Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewTest2.cpp | 2 +- Libs/Widgets/Testing/Cpp/ctkCheckableModelHelperTest1.cpp | 2 +- Libs/Widgets/Testing/Cpp/ctkCheckableModelHelperTest2.cpp | 2 +- Libs/Widgets/ctkCheckableComboBoxEventTranslator.cpp | 2 +- Libs/Widgets/ctkMaterialPropertyWidget.cpp | 2 +- 11 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMBrowserTest.cpp b/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMBrowserTest.cpp index cca1fe6041..58009e74e6 100644 --- a/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMBrowserTest.cpp +++ b/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMBrowserTest.cpp @@ -151,10 +151,10 @@ void ctkDICOMBrowserTester::testImportDirectoryMode() QComboBox* comboBox = browser.importDialog()->bottomWidget()->findChild(); - comboBox->setCurrentIndex(comboBox->findData(ctkDICOMBrowser::ImportDirectoryCopy)); + comboBox->setCurrentIndex(comboBox->findData(static_cast(ctkDICOMBrowser::ImportDirectoryCopy))); QCOMPARE(browser.importDirectoryMode(), ctkDICOMBrowser::ImportDirectoryCopy); - comboBox->setCurrentIndex(comboBox->findData(ctkDICOMBrowser::ImportDirectoryAddLink)); + comboBox->setCurrentIndex(comboBox->findData(static_cast(ctkDICOMBrowser::ImportDirectoryAddLink))); QCOMPARE(browser.importDirectoryMode(), ctkDICOMBrowser::ImportDirectoryAddLink); } diff --git a/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMModelTest2.cpp b/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMModelTest2.cpp index 3c0e883941..faf1f43acf 100644 --- a/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMModelTest2.cpp +++ b/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMModelTest2.cpp @@ -87,7 +87,7 @@ int ctkDICOMModelTest2( int argc, char * argv [] ) headerView->checkableModelHelper()->setPropagateDepth(-1); headerView->checkableModelHelper()->setForceCheckability(true); viewer.setHeader(headerView); - model.setHeaderData(0, Qt::Horizontal, Qt::Checked, Qt::CheckStateRole); + model.setHeaderData(0, Qt::Horizontal, static_cast(Qt::Checked), Qt::CheckStateRole); qDebug() << "new: " << headerView->isHidden(); topLevel.show(); if (argc <= 3 || QString(argv[3]) != "-I") diff --git a/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMServerNodeWidgetTest1.cpp b/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMServerNodeWidgetTest1.cpp index b6721fa80d..01bb5658be 100644 --- a/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMServerNodeWidgetTest1.cpp +++ b/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMServerNodeWidgetTest1.cpp @@ -109,7 +109,7 @@ int ctkDICOMServerNodeWidgetTest1( int argc, char * argv [] ) } QMap serverNode; serverNode["Name"] = QString("TestName"); - serverNode["CheckState"] = Qt::Unchecked; + serverNode["CheckState"] = static_cast(Qt::Unchecked); serverNode["AETitle"] = QString("TestAETitle"); serverNode["Address"] = QString("TestAddress"); serverNode["Port"] = 12345; diff --git a/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp b/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp index 5ba8c025e7..72a8c332d6 100644 --- a/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp @@ -362,8 +362,8 @@ void ctkDICOMBrowserPrivate::init() // Initialize directoryMode widget QFormLayout *layout = new QFormLayout; QComboBox* importDirectoryModeComboBox = new QComboBox(); - importDirectoryModeComboBox->addItem(ctkDICOMBrowser::tr("Add Link"), ctkDICOMBrowser::ImportDirectoryAddLink); - importDirectoryModeComboBox->addItem(ctkDICOMBrowser::tr("Copy"), ctkDICOMBrowser::ImportDirectoryCopy); + importDirectoryModeComboBox->addItem(ctkDICOMBrowser::tr("Add Link"), static_cast(ctkDICOMBrowser::ImportDirectoryAddLink)); + importDirectoryModeComboBox->addItem(ctkDICOMBrowser::tr("Copy"), static_cast(ctkDICOMBrowser::ImportDirectoryCopy)); importDirectoryModeComboBox->setToolTip( ctkDICOMBrowser::tr("Indicate if the files should be copied to the local database" " directory or if only links should be created ?")); @@ -374,7 +374,7 @@ void ctkDICOMBrowserPrivate::init() // Default values importDirectoryModeComboBox->setCurrentIndex( - importDirectoryModeComboBox->findData(q->importDirectoryMode())); + importDirectoryModeComboBox->findData(static_cast(q->importDirectoryMode()))); //Initialize import widget this->ImportDialog = new ctkFileDialog(); @@ -1064,7 +1064,7 @@ void ctkDICOMBrowser::setImportDirectoryMode(ctkDICOMBrowser::ImportDirectoryMod return; // Native dialog does not support modifying or getting widget elements. } QComboBox* comboBox = d->ImportDialog->bottomWidget()->findChild(); - comboBox->setCurrentIndex(comboBox->findData(mode)); + comboBox->setCurrentIndex(comboBox->findData(static_cast(mode))); } //---------------------------------------------------------------------------- diff --git a/Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewEventTranslatorPlayerTest1.cpp b/Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewEventTranslatorPlayerTest1.cpp index 83d7ac2e7c..37c4a0d81e 100644 --- a/Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewEventTranslatorPlayerTest1.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewEventTranslatorPlayerTest1.cpp @@ -103,7 +103,7 @@ int ctkCheckableHeaderViewEventTranslatorPlayerTest1(int argc, char * argv [] ) table.setModel(&model); // Header is checked by default - model.setHeaderData(0, Qt::Horizontal, Qt::Checked, Qt::CheckStateRole); + model.setHeaderData(0, Qt::Horizontal, static_cast(Qt::Checked), Qt::CheckStateRole); QHeaderView* previousHeaderView = table.horizontalHeader(); #if QT_VERSION < QT_VERSION_CHECK(5,0,0) @@ -128,7 +128,7 @@ int ctkCheckableHeaderViewEventTranslatorPlayerTest1(int argc, char * argv [] ) table.setHorizontalHeader(headerView); // Header is checked by default - model.setHeaderData(1, Qt::Horizontal, Qt::Checked, Qt::CheckStateRole); + model.setHeaderData(1, Qt::Horizontal, static_cast(Qt::Checked), Qt::CheckStateRole); QSignalSpy spy1(headerView, SIGNAL(sectionPressed(int))); diff --git a/Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewTest1.cpp b/Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewTest1.cpp index 7a57907928..3ab3a54988 100644 --- a/Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewTest1.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewTest1.cpp @@ -73,7 +73,7 @@ int ctkCheckableHeaderViewTest1(int argc, char * argv [] ) table.setModel(&model); // Header is checked by default - model.setHeaderData(0, Qt::Horizontal, Qt::Checked, Qt::CheckStateRole); + model.setHeaderData(0, Qt::Horizontal, static_cast(Qt::Checked), Qt::CheckStateRole); QHeaderView* previousHeaderView = table.horizontalHeader(); #if (QT_VERSION >= 0x50000) diff --git a/Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewTest2.cpp b/Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewTest2.cpp index 2249e5417d..0b4ea1597d 100644 --- a/Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewTest2.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewTest2.cpp @@ -62,7 +62,7 @@ int ctkCheckableHeaderViewTest2(int argc, char * argv [] ) QTreeView view; view.setModel(&model); - model.setHeaderData(0, Qt::Horizontal, Qt::Checked, Qt::CheckStateRole); + model.setHeaderData(0, Qt::Horizontal, static_cast(Qt::Checked), Qt::CheckStateRole); QHeaderView* previousHeaderView = view.header(); #if (QT_VERSION >= 0x50000) diff --git a/Libs/Widgets/Testing/Cpp/ctkCheckableModelHelperTest1.cpp b/Libs/Widgets/Testing/Cpp/ctkCheckableModelHelperTest1.cpp index 250639aa0a..01840c875c 100644 --- a/Libs/Widgets/Testing/Cpp/ctkCheckableModelHelperTest1.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkCheckableModelHelperTest1.cpp @@ -158,7 +158,7 @@ int ctkCheckableModelHelperTest1(int argc, char * argv [] ) { // Header is checked by default - model.setHeaderData(0, Qt::Horizontal, Qt::Checked, Qt::CheckStateRole); + model.setHeaderData(0, Qt::Horizontal, static_cast(Qt::Checked), Qt::CheckStateRole); QScopedPointer modelHelper(new ctkCheckableModelHelper(Qt::Horizontal)); modelHelper->setModel(&model); diff --git a/Libs/Widgets/Testing/Cpp/ctkCheckableModelHelperTest2.cpp b/Libs/Widgets/Testing/Cpp/ctkCheckableModelHelperTest2.cpp index b1012bafbc..6c8b497161 100644 --- a/Libs/Widgets/Testing/Cpp/ctkCheckableModelHelperTest2.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkCheckableModelHelperTest2.cpp @@ -61,7 +61,7 @@ int ctkCheckableModelHelperTest2(int argc, char * argv [] ) QTreeView view; view.setModel(&model); - model.setHeaderData(0, Qt::Horizontal, Qt::Checked, Qt::CheckStateRole); + model.setHeaderData(0, Qt::Horizontal, static_cast(Qt::Checked), Qt::CheckStateRole); ctkCheckableModelHelper headerView(Qt::Horizontal); headerView.setPropagateDepth(-1); diff --git a/Libs/Widgets/ctkCheckableComboBoxEventTranslator.cpp b/Libs/Widgets/ctkCheckableComboBoxEventTranslator.cpp index 7bb0247ca9..4c07400188 100644 --- a/Libs/Widgets/ctkCheckableComboBoxEventTranslator.cpp +++ b/Libs/Widgets/ctkCheckableComboBoxEventTranslator.cpp @@ -102,7 +102,7 @@ void ctkCheckableComboBoxEventTranslator::onDataChanged(const QModelIndex&,const { QModelIndex startIndex = checkableCombo->model()->index(0,0, checkableCombo->rootModelIndex()); QModelIndexList uncheckedList = checkableCombo->model()->match( - startIndex, Qt::CheckStateRole, Qt::Unchecked, -1, Qt::MatchRecursive); + startIndex, Qt::CheckStateRole, static_cast(Qt::Unchecked), -1, Qt::MatchRecursive); QStringList uncheckedStringList; foreach (QModelIndex index, uncheckedList) { diff --git a/Libs/Widgets/ctkMaterialPropertyWidget.cpp b/Libs/Widgets/ctkMaterialPropertyWidget.cpp index 5997ecf994..c743c4c6e6 100644 --- a/Libs/Widgets/ctkMaterialPropertyWidget.cpp +++ b/Libs/Widgets/ctkMaterialPropertyWidget.cpp @@ -348,7 +348,7 @@ void ctkMaterialPropertyWidget::addPreset( QListWidgetItem* item = d->PresetsListWidget->item(d->PresetsListWidget->count()-1); item->setToolTip(label); // TODO: implement addPreset for PBR interpolation - item->setData(ctkMaterialPropertyWidgetPrivate::InterpolationModeRole, InterpolationGouraud); + item->setData(ctkMaterialPropertyWidgetPrivate::InterpolationModeRole, static_cast(InterpolationGouraud)); if (color.isValid()) { item->setData(ctkMaterialPropertyWidgetPrivate::ColorRole, color); From 6c206fa518d202dc1870bebe4c07fcab2d7ac444 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Fri, 14 Apr 2023 09:13:56 -0400 Subject: [PATCH 010/115] COMP: Fix -Wunused-function in ctkCoordinatesWidgetValueProxyTest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit removes function that became obsolete in b9d0ab9d9 (Apply ValueProxy to widgets min and max ) and fixes the following warning: /path/to/CTK/Libs/Widgets/Testing/Cpp/ctkCoordinatesWidgetValueProxyTest.cpp:75:9: warning: ‘QString {anonymous}::coordinatesFromValue(double)’ defined but not used [-Wunused-function] 75 | QString coordinatesFromValue(double val) | ^~~~~~~~~~~~~~~~~~~~ --- .../Testing/Cpp/ctkCoordinatesWidgetValueProxyTest.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Libs/Widgets/Testing/Cpp/ctkCoordinatesWidgetValueProxyTest.cpp b/Libs/Widgets/Testing/Cpp/ctkCoordinatesWidgetValueProxyTest.cpp index 2589355733..0581884b8c 100644 --- a/Libs/Widgets/Testing/Cpp/ctkCoordinatesWidgetValueProxyTest.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkCoordinatesWidgetValueProxyTest.cpp @@ -71,12 +71,6 @@ public slots: int AcknowledgedSignals; }; -// ---------------------------------------------------------------------------- -QString coordinatesFromValue(double val) -{ - return QString("%1,%1,%1").arg(val); -} - } // end namespace // ---------------------------------------------------------------------------- From 8c8ee4dedb7ef2173e9840620ac822bfb644fa59 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Fri, 14 Apr 2023 12:50:52 -0400 Subject: [PATCH 011/115] COMP: Fix -Wdeprecated-declarations in ctkPluginAbstractTracked using std::list 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/PluginFramework/ctkPluginAbstractTracked_p.h:251:3: warning: ‘template class QLinkedList’ is deprecated: Use std::list instead [-Wdeprecated-declarations] 251 | QLinkedList initial; | ^~~~~~~~~~~ --- Libs/PluginFramework/ctkPluginAbstractTracked_p.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Libs/PluginFramework/ctkPluginAbstractTracked_p.h b/Libs/PluginFramework/ctkPluginAbstractTracked_p.h index d04bf01203..051e77d2ee 100644 --- a/Libs/PluginFramework/ctkPluginAbstractTracked_p.h +++ b/Libs/PluginFramework/ctkPluginAbstractTracked_p.h @@ -26,7 +26,11 @@ #include #include #include +#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) +#include +#else #include +#endif #include /** @@ -248,7 +252,11 @@ class ctkPluginAbstractTracked : public QMutex * * @GuardedBy this */ +#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) + std::list initial; +#else QLinkedList initial; +#endif /** * Common logic to add an item to the tracker used by track and From 2c51c1fda18d6b791a0ed615faf25b6bb5cebb21 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Fri, 14 Apr 2023 18:07:12 -0400 Subject: [PATCH 012/115] COMP: Fix -Wdeprecated-declarations in ctkPluginAbstractTracked MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes warnings like the following by leveraging ctkUtils functions. /path/to/CTK/Libs/PluginFramework/ctkPluginAbstractTracked_p.h:251:3: warning: ‘template class QLinkedList’ is deprecated: Use std::list instead [-Wdeprecated-declarations] 251 | QLinkedList initial; | ^~~~~~~~~~~ --- Libs/PluginFramework/ctkPluginAbstractTracked.tpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Libs/PluginFramework/ctkPluginAbstractTracked.tpp b/Libs/PluginFramework/ctkPluginAbstractTracked.tpp index c3755a55b1..b4782cea19 100644 --- a/Libs/PluginFramework/ctkPluginAbstractTracked.tpp +++ b/Libs/PluginFramework/ctkPluginAbstractTracked.tpp @@ -19,11 +19,12 @@ =============================================================================*/ - #include "ctkPluginAbstractTracked_p.h" #include +#include + //---------------------------------------------------------------------------- template const bool ctkPluginAbstractTracked::DEBUG_FLAG = false; @@ -90,7 +91,7 @@ void ctkPluginAbstractTracked::trackInitial() * move the first item from the initial list to the adding list * within this synchronized block. */ - item = initial.takeFirst(); + item = ctk::takeFirst(initial); if (tracked.value(item)) { /* if we are already tracking this item */ @@ -190,7 +191,7 @@ void ctkPluginAbstractTracked::untrack(S item, R related) T object(0); { QMutexLocker lock(this); - if (initial.removeOne(item)) + if (ctk::removeOne(initial, item)) { /* if this item is already in the list * of initial references to process */ From 32d547ebe56ccc4aa278da1dfb18cf368581841e Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Mon, 17 Apr 2023 02:04:51 -0400 Subject: [PATCH 013/115] COMP: Fix -Wtype-limits in ctkDICOMItem::Decode 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/DICOM/Core/ctkDICOMItem.cpp: In member function ‘QString ctkDICOMItem::Decode(const DcmTag&, const OFString&) const’: /path/to/CTK/Libs/DICOM/Core/ctkDICOMItem.cpp:432:38: warning: comparison is always true due to limited range of data type [-Wtype-limits] if (32 <= raw[i] && raw[i] < 128) ^ --- Libs/DICOM/Core/ctkDICOMItem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libs/DICOM/Core/ctkDICOMItem.cpp b/Libs/DICOM/Core/ctkDICOMItem.cpp index bdc916f1e9..75744ff3b7 100644 --- a/Libs/DICOM/Core/ctkDICOMItem.cpp +++ b/Libs/DICOM/Core/ctkDICOMItem.cpp @@ -429,7 +429,7 @@ QString ctkDICOMItem::Decode( const DcmTag& tag, const OFString& raw ) const QString asciiString; for (size_t i = 0; i < raw.length(); i++) { - if (32 <= raw[i] && raw[i] < 128) + if (32 <= static_cast(raw[i]) && static_cast(raw[i]) < 128) { asciiString += raw[i]; } From 8299376285dedadd4ee8f67172bb28cd4228fc88 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Mon, 17 Apr 2023 02:29:35 -0400 Subject: [PATCH 014/115] COMP: Fix -Woverloaded-virtual in ctkVTKSurfaceMaterialPropertyWidget MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes the following warning introduced in 7b48c481a (ENH: Add support for PBR material properties in material property widgets): In file included from /path/to/CTK/Libs/Visualization/VTK/Widgets/ctkVTKSurfaceMaterialPropertyWidget.h:25:0, from /path/to/CTK-build/CTK-build/Libs/Visualization/VTK/Widgets/ui_ctkVTKPropertyWidget.h:27, from /path/to/CTK/Libs/Visualization/VTK/Widgets/ctkVTKPropertyWidget.cpp:26: /path/to/CTK/Libs/Widgets/ctkMaterialPropertyWidget.h:183:16: warning: ‘virtual void ctkMaterialPropertyWidget::onInterpolationModeChanged(int)’ was hidden [-Woverloaded-virtual] virtual void onInterpolationModeChanged(int interpolationModeIndex); ^ In file included from /path/to/CTK-build/CTK-build/Libs/Visualization/VTK/Widgets/ui_ctkVTKPropertyWidget.h:27:0, from /path/to/CTK/Libs/Visualization/VTK/Widgets/ctkVTKPropertyWidget.cpp:26: /path/to/CTK/Libs/Visualization/VTK/Widgets/ctkVTKSurfaceMaterialPropertyWidget.h:59:16: warning: by ‘virtual void ctkVTKSurfaceMaterialPropertyWidget::onInterpolationModeChanged(ctkMaterialPropertyWidget::InterpolationMode)’ [-Woverloaded-virtual] virtual void onInterpolationModeChanged(ctkMaterialPropertyWidget::InterpolationMode newMode); ^ --- .../VTK/Widgets/ctkVTKSurfaceMaterialPropertyWidget.cpp | 2 +- .../VTK/Widgets/ctkVTKSurfaceMaterialPropertyWidget.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKSurfaceMaterialPropertyWidget.cpp b/Libs/Visualization/VTK/Widgets/ctkVTKSurfaceMaterialPropertyWidget.cpp index cc8f25f095..2102745a3e 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKSurfaceMaterialPropertyWidget.cpp +++ b/Libs/Visualization/VTK/Widgets/ctkVTKSurfaceMaterialPropertyWidget.cpp @@ -170,7 +170,7 @@ void ctkVTKSurfaceMaterialPropertyWidget::onOpacityChanged(double newOpacity) // -------------------------------------------------------------------------- void ctkVTKSurfaceMaterialPropertyWidget::onInterpolationModeChanged( - ctkMaterialPropertyWidget::InterpolationMode newInterpolationMode) + int newInterpolationMode) { Q_D(ctkVTKSurfaceMaterialPropertyWidget); this->Superclass::onInterpolationModeChanged(newInterpolationMode); diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKSurfaceMaterialPropertyWidget.h b/Libs/Visualization/VTK/Widgets/ctkVTKSurfaceMaterialPropertyWidget.h index 3e019bc8fb..35616e6ca6 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKSurfaceMaterialPropertyWidget.h +++ b/Libs/Visualization/VTK/Widgets/ctkVTKSurfaceMaterialPropertyWidget.h @@ -56,7 +56,7 @@ protected Q_SLOTS: virtual void onColorChanged(const QColor& newColor); virtual void onOpacityChanged(double newOpacity); - virtual void onInterpolationModeChanged(ctkMaterialPropertyWidget::InterpolationMode newMode); + virtual void onInterpolationModeChanged(int newInterpolationMode); virtual void onAmbientChanged(double newAmbient); virtual void onDiffuseChanged(double newDiffuse); virtual void onSpecularChanged(double newSpecular); From bab80db930c5ebe95d8ea07c098da914138eb882 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Mon, 17 Apr 2023 02:46:54 -0400 Subject: [PATCH 015/115] COMP: Fix -Wdeprecated-declarations in ctkPluginAbstractTracked MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes the following warning using QAtomicInteger::loadRelaxed introduced in Qt 5.14: /path/to/CTK/Libs/PluginFramework/ctkPluginAbstractTracked.tpp:284:28: warning: ‘T QBasicAtomicInteger::load() const [with T = int]’ is deprecated: Use loadRelaxed [-Wdeprecated-declarations] 284 | return trackingCount.load(); | ~~~~~~~~~~~~~~~~~~^~ --- Libs/PluginFramework/ctkPluginAbstractTracked.tpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Libs/PluginFramework/ctkPluginAbstractTracked.tpp b/Libs/PluginFramework/ctkPluginAbstractTracked.tpp index b4782cea19..1754385d61 100644 --- a/Libs/PluginFramework/ctkPluginAbstractTracked.tpp +++ b/Libs/PluginFramework/ctkPluginAbstractTracked.tpp @@ -280,8 +280,10 @@ int ctkPluginAbstractTracked::getTrackingCount() const { #if QT_VERSION < QT_VERSION_CHECK(5,0,0) return trackingCount; -#else +#elif QT_VERSION < QT_VERSION_CHECK(5,14,0) return trackingCount.load(); +#else + return trackingCount.loadRelaxed(); #endif } From b2755f79ec1add3bb4667ed1698dce0bad1487e3 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Mon, 17 Apr 2023 02:57:21 -0400 Subject: [PATCH 016/115] COMP: Fix -Wdeprecated-declarations in ctkTransferFunctionView 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/ctkTransferFunctionView.cpp: In member function ‘virtual void ctkTransferFunctionView::resizeEvent(QResizeEvent*)’: /path/to/CTK/Libs/Widgets/ctkTransferFunctionView.cpp:96:29: warning: ‘void QGraphicsView::setMatrix(const QMatrix&, bool)’ is deprecated: Use setTransform() [-Wdeprecated-declarations] 96 | this->setMatrix(zoomMatrix); | ^ In file included from /path/to/Qt/5.15.2/gcc_64/include/QtWidgets/QGraphicsView:1, from /path/to/CTK/Libs/Widgets/ctkTransferFunctionView.h:25, from /path/to/CTK/Libs/Widgets/ctkTransferFunctionView.cpp:33: /path/to/Qt/5.15.2/gcc_64/include/QtWidgets/qgraphicsview.h:170:48: note: declared here 170 | QT_DEPRECATED_X("Use setTransform()") void setMatrix(const QMatrix &matrix, bool combine = false); | --- Libs/Widgets/ctkTransferFunctionView.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Libs/Widgets/ctkTransferFunctionView.cpp b/Libs/Widgets/ctkTransferFunctionView.cpp index 695a879d06..eb9ea1ed4a 100644 --- a/Libs/Widgets/ctkTransferFunctionView.cpp +++ b/Libs/Widgets/ctkTransferFunctionView.cpp @@ -90,10 +90,19 @@ void ctkTransferFunctionView::resizeEvent(QResizeEvent * event) } } */ +#if (QT_VERSION >= QT_VERSION_CHECK(5,15,0)) + QTransform zoomTransform; + zoomTransform.scale(event->size().width(), event->size().height()); +#else QMatrix zoomMatrix; zoomMatrix.scale(event->size().width(), event->size().height()); +#endif bool blocked = this->blockSignals(true); +#if (QT_VERSION >= QT_VERSION_CHECK(5,15,0)) + this->setTransform(zoomTransform); +#else this->setMatrix(zoomMatrix); +#endif this->blockSignals(blocked); this->QGraphicsView::resizeEvent(event); // Control points are resized by the view transform, we want From e6632421274a5dd9cebed881f5714a8aed6e63b9 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Mon, 17 Apr 2023 03:19:34 -0400 Subject: [PATCH 017/115] COMP: Fix deprecated warning related to QWidget::getContentsMargins() 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/ctkTreeComboBox.cpp:294:68: warning: ‘void QWidget::getContentsMargins(int*, int*, int*, int*) const’ is deprecated: use contentsMargins() [-Wdeprecated-declarations] 294 | container->getContentsMargins(0, &marginTop, 0, &marginBottom); | ^ --- Libs/Widgets/ctkFlowLayout.cpp | 25 +++++++++---------------- Libs/Widgets/ctkTreeComboBox.cpp | 15 ++++++--------- 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/Libs/Widgets/ctkFlowLayout.cpp b/Libs/Widgets/ctkFlowLayout.cpp index 3d22cfe653..628ce28ed4 100644 --- a/Libs/Widgets/ctkFlowLayout.cpp +++ b/Libs/Widgets/ctkFlowLayout.cpp @@ -112,15 +112,14 @@ QSize ctkFlowLayoutPrivate::maxSizeHint(int *visibleItemsCount)const int ctkFlowLayoutPrivate::doLayout(const QRect& rect, bool testOnly)const { Q_Q(const ctkFlowLayout); - int left, top, right, bottom; - q->getContentsMargins(&left, &top, &right, &bottom); - QRect effectiveRect = rect.adjusted(+left, +top, -right, -bottom); + QMargins margins = q->contentsMargins(); + QRect effectiveRect = rect.adjusted(+margins.left(), +margins.top(), -margins.right(), -margins.bottom()); QPoint pos = QPoint(effectiveRect.x(), effectiveRect.y()); int length = 0; int max = this->Orientation == Qt::Horizontal ? effectiveRect.right() + 1 : effectiveRect.bottom() + 1; - int maxX = left + right; - int maxY = top + bottom; + int maxX = margins.left() + margins.right(); + int maxY = margins.top() + margins.bottom(); QSize maxItemSize = this->AlignItems ? this->maxSizeHint() : QSize(); int spaceX = q->horizontalSpacing(); @@ -157,7 +156,7 @@ int ctkFlowLayoutPrivate::doLayout(const QRect& rect, bool testOnly)const QRect geometry = previousItem->geometry(); geometry.adjust(0, 0, max + space - pos.x(), 0); previousItem->setGeometry(geometry); - maxX = qMax(maxX, geometry.right() + right); + maxX = qMax(maxX, geometry.right() + margins.right()); } pos = QPoint(effectiveRect.x(), pos.y() + length + space); next = pos + QPoint(itemSize.width() + space, 0); @@ -176,8 +175,8 @@ int ctkFlowLayoutPrivate::doLayout(const QRect& rect, bool testOnly)const item->setGeometry(QRect(pos, item->sizeHint())); } - maxX = qMax( maxX , pos.x() + item->sizeHint().width() + right); - maxY = qMax( maxY , pos.y() + item->sizeHint().height() + bottom); + maxX = qMax( maxX , pos.x() + item->sizeHint().width() + margins.right()); + maxY = qMax( maxY , pos.y() + item->sizeHint().height() + margins.bottom()); pos = next; length = qMax(length, this->Orientation == Qt::Horizontal ? itemSize.height() : itemSize.width()); @@ -415,9 +414,7 @@ QSize ctkFlowLayout::minimumSize() const } size = size.expandedTo(item->minimumSize()); } - int left, top, right, bottom; - this->getContentsMargins(&left, &top, &right, &bottom); - size += QSize(left+right, top+bottom); + size += this->contentsRect().size(); return size; } @@ -478,9 +475,7 @@ QSize ctkFlowLayout::sizeHint() const size += QSize((countX-1) * this->horizontalSpacing(), (countY-1) * this->verticalSpacing()); // Add margins - int left, top, right, bottom; - this->getContentsMargins(&left, &top, &right, &bottom); - size += QSize(left+right, top+bottom); + size += this->contentsRect().size(); return size; } @@ -507,8 +502,6 @@ ctkFlowLayout* ctkFlowLayout::replaceLayout(QWidget* widget) flowLayout->setPreferredExpandingDirections( isVerticalLayout ? Qt::Vertical : Qt::Horizontal); flowLayout->setAlignItems(false); - int margins[4]; - oldLayout->getContentsMargins(&margins[0],&margins[1],&margins[2],&margins[3]); QLayoutItem* item = 0; while((item = oldLayout->takeAt(0))) { diff --git a/Libs/Widgets/ctkTreeComboBox.cpp b/Libs/Widgets/ctkTreeComboBox.cpp index c5ece5c6d5..be16c30522 100644 --- a/Libs/Widgets/ctkTreeComboBox.cpp +++ b/Libs/Widgets/ctkTreeComboBox.cpp @@ -290,15 +290,12 @@ void ctkTreeComboBox::resizePopup() int heightMargin = 0;//2*container->spacing(); // add the frame of the container - int marginTop, marginBottom; - container->getContentsMargins(0, &marginTop, 0, &marginBottom); - heightMargin += marginTop + marginBottom; - - //add the frame of the view - this->view()->getContentsMargins(0, &marginTop, 0, &marginBottom); - //marginTop += static_cast(QObjectPrivate::get(this->view()))->top; - //marginBottom += static_cast(QObjectPrivate::get(this->view()))->bottom; - heightMargin += marginTop + marginBottom; + QMargins cMargins = container->contentsMargins(); + heightMargin += cMargins.top() + cMargins.bottom(); + + // add the frame of the view + QMargins vMargins = this->view()->contentsMargins(); + heightMargin += vMargins.top() + vMargins.bottom(); listRect.setHeight(listRect.height() + heightMargin); } From 7548615559331b9cb37a3e7a77de32385cb8c5d7 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Mon, 17 Apr 2023 03:48:19 -0400 Subject: [PATCH 018/115] COMP: Fix -Wdeprecated-declarations related to QProcess::start() 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/Applications/ctkDICOMHost/Testing/Cpp/ctkDICOMHostTest1.cpp:34:24: warning: ‘void QProcess::start(const QString&, QIODevice::OpenMode)’ is deprecated: Use QProcess::start(const QString &program, const QStringList &arguments,OpenMode mode = ReadWrite) instead [-Wdeprecated-declarations] 34 | process.start(command); | ^ --- Applications/ctkDICOM/Testing/Cpp/ctkDICOMTest1.cpp | 2 +- Applications/ctkDICOM2/Testing/Cpp/ctkDICOM2Test1.cpp | 2 +- Applications/ctkDICOMHost/Testing/Cpp/ctkDICOMHostTest1.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Applications/ctkDICOM/Testing/Cpp/ctkDICOMTest1.cpp b/Applications/ctkDICOM/Testing/Cpp/ctkDICOMTest1.cpp index d6230a1938..968dff12fa 100644 --- a/Applications/ctkDICOM/Testing/Cpp/ctkDICOMTest1.cpp +++ b/Applications/ctkDICOM/Testing/Cpp/ctkDICOMTest1.cpp @@ -38,7 +38,7 @@ int ctkDICOMTest1(int argc, char * argv []) } QString command = app.arguments().at(1); QProcess process; - process.start(command); + process.start(command, /* arguments= */ QStringList()); bool res = process.waitForStarted(); if (!res) { diff --git a/Applications/ctkDICOM2/Testing/Cpp/ctkDICOM2Test1.cpp b/Applications/ctkDICOM2/Testing/Cpp/ctkDICOM2Test1.cpp index ea4c4ba5a3..407849c939 100644 --- a/Applications/ctkDICOM2/Testing/Cpp/ctkDICOM2Test1.cpp +++ b/Applications/ctkDICOM2/Testing/Cpp/ctkDICOM2Test1.cpp @@ -38,7 +38,7 @@ int ctkDICOM2Test1(int argc, char * argv []) } QString command = app.arguments().at(1); QProcess process; - process.start(command); + process.start(command, /* arguments= */ QStringList()); bool res = process.waitForStarted(); if (!res) { diff --git a/Applications/ctkDICOMHost/Testing/Cpp/ctkDICOMHostTest1.cpp b/Applications/ctkDICOMHost/Testing/Cpp/ctkDICOMHostTest1.cpp index 252039cae4..dfb870b4a3 100644 --- a/Applications/ctkDICOMHost/Testing/Cpp/ctkDICOMHostTest1.cpp +++ b/Applications/ctkDICOMHost/Testing/Cpp/ctkDICOMHostTest1.cpp @@ -31,7 +31,7 @@ int ctkDICOMHostTest1(int argc, char * argv []) QCoreApplication app(argc, argv); QString command = QString("ctkDICOMHost"); QProcess process; - process.start(command); + process.start(command, /* arguments= */ QStringList()); bool res = process.waitForStarted(); if (!res) { From 2acba97da908cb94255b079a73fea28294637167 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Mon, 17 Apr 2023 03:57:40 -0400 Subject: [PATCH 019/115] COMP: Fix -Wdeprecated-declarations related to QProcess::pid() 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/CommandLineModules/Backend/LocalProcess/ctkCmdLineModuleProcessWatcher.cpp:104:26: warning: ‘Q_PID QProcess::pid() const’ is deprecated: Use processId() instead [-Wdeprecated-declarations] 104 | if (::kill(process.pid(), SIGSTOP)) | ^ --- .../LocalProcess/ctkCmdLineModuleProcessWatcher.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Libs/CommandLineModules/Backend/LocalProcess/ctkCmdLineModuleProcessWatcher.cpp b/Libs/CommandLineModules/Backend/LocalProcess/ctkCmdLineModuleProcessWatcher.cpp index 7ece875485..16ba209a3b 100644 --- a/Libs/CommandLineModules/Backend/LocalProcess/ctkCmdLineModuleProcessWatcher.cpp +++ b/Libs/CommandLineModules/Backend/LocalProcess/ctkCmdLineModuleProcessWatcher.cpp @@ -101,7 +101,11 @@ void ctkCmdLineModuleProcessWatcher::pauseProcess() if (processPaused || !futureInterface.isPaused()) return; #ifdef Q_OS_UNIX +#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) + if (::kill(process.processId(), SIGSTOP)) +#else if (::kill(process.pid(), SIGSTOP)) +#endif { // error futureInterface.setPaused(false); @@ -119,7 +123,11 @@ void ctkCmdLineModuleProcessWatcher::resumeProcess() if (!processPaused) return; #ifdef Q_OS_UNIX +#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) + if(::kill(process.processId(), SIGCONT)) +#else if(::kill(process.pid(), SIGCONT)) +#endif { // error futureInterface.setPaused(true); From 878d5d0f038ae6e407e0cbd0d963cf19cc832f64 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Fri, 14 Apr 2023 00:55:56 -0400 Subject: [PATCH 020/115] STYLE: Consistently name the PluginFramework performance test The table below summarized the test names before and after for both PluginFramework test and performance test. | | org_commontk_pluginfwtest | org_commontk_pluginfwtest_perf | |--------|---------------------------|--------------------------------| | Before | CTKPluginFramework | org_commontk_pluginfwtest_perf | | After | CTKPluginFramework | CTKPluginFrameworkTests.perf | --- .../Testing/org.commontk.pluginfwtest.perf/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libs/PluginFramework/Testing/org.commontk.pluginfwtest.perf/CMakeLists.txt b/Libs/PluginFramework/Testing/org.commontk.pluginfwtest.perf/CMakeLists.txt index 7944efe0d1..045889dbba 100644 --- a/Libs/PluginFramework/Testing/org.commontk.pluginfwtest.perf/CMakeLists.txt +++ b/Libs/PluginFramework/Testing/org.commontk.pluginfwtest.perf/CMakeLists.txt @@ -54,5 +54,5 @@ target_link_libraries(${test_executable} add_dependencies(${test_executable} ${PROJECT_NAME}) -add_test(${PROJECT_NAME}Tests ${CPP_TEST_PATH}/${test_executable}) -set_property(TEST ${PROJECT_NAME}Tests PROPERTY LABELS ${PROJECT_NAME}) +add_test(${fw_lib}Tests.perf ${CPP_TEST_PATH}/${test_executable}) +set_property(TEST ${fw_lib}Tests.perf PROPERTY LABELS ${fw_lib}.perf) From 3119697386a5c7473e669ad82b7e851bbfa7f671 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Fri, 14 Apr 2023 01:26:39 -0400 Subject: [PATCH 021/115] BUG: Ensure PluginFramework tests do not run in concurrently This commit associates a resource lock called "ctkPluginStorage" with each test, this ensures different processes do no attempt to update the database at the same time. --- .../Testing/FrameworkTestPlugins/app_test/CMakeLists.txt | 1 + .../Testing/org.commontk.pluginfwtest.perf/CMakeLists.txt | 1 + .../Testing/org.commontk.pluginfwtest/CMakeLists.txt | 1 + 3 files changed, 3 insertions(+) diff --git a/Libs/PluginFramework/Testing/FrameworkTestPlugins/app_test/CMakeLists.txt b/Libs/PluginFramework/Testing/FrameworkTestPlugins/app_test/CMakeLists.txt index 1571256fcb..401d183765 100644 --- a/Libs/PluginFramework/Testing/FrameworkTestPlugins/app_test/CMakeLists.txt +++ b/Libs/PluginFramework/Testing/FrameworkTestPlugins/app_test/CMakeLists.txt @@ -59,3 +59,4 @@ add_dependencies(${test_executable} ${PROJECT_NAME}) add_test(${fw_lib}AppTests ${CPP_TEST_PATH}/${test_executable}) set_property(TEST ${fw_lib}AppTests PROPERTY LABELS ${fw_lib}) set_property(TEST ${fw_lib}AppTests PROPERTY ENVIRONMENT "QT_FATAL_WARNINGS=1") +set_property(TEST ${fw_lib}AppTests PROPERTY RESOURCE_LOCK ctkPluginStorage) diff --git a/Libs/PluginFramework/Testing/org.commontk.pluginfwtest.perf/CMakeLists.txt b/Libs/PluginFramework/Testing/org.commontk.pluginfwtest.perf/CMakeLists.txt index 045889dbba..1355bd0ea2 100644 --- a/Libs/PluginFramework/Testing/org.commontk.pluginfwtest.perf/CMakeLists.txt +++ b/Libs/PluginFramework/Testing/org.commontk.pluginfwtest.perf/CMakeLists.txt @@ -56,3 +56,4 @@ add_dependencies(${test_executable} ${PROJECT_NAME}) add_test(${fw_lib}Tests.perf ${CPP_TEST_PATH}/${test_executable}) set_property(TEST ${fw_lib}Tests.perf PROPERTY LABELS ${fw_lib}.perf) +set_property(TEST ${fw_lib}Tests.perf PROPERTY RESOURCE_LOCK ctkPluginStorage) diff --git a/Libs/PluginFramework/Testing/org.commontk.pluginfwtest/CMakeLists.txt b/Libs/PluginFramework/Testing/org.commontk.pluginfwtest/CMakeLists.txt index fbe0a82849..90d1f51ff2 100644 --- a/Libs/PluginFramework/Testing/org.commontk.pluginfwtest/CMakeLists.txt +++ b/Libs/PluginFramework/Testing/org.commontk.pluginfwtest/CMakeLists.txt @@ -63,3 +63,4 @@ add_dependencies(${test_executable} ${PROJECT_NAME}) add_test(${fw_lib}Tests ${CPP_TEST_PATH}/${test_executable}) set_property(TEST ${fw_lib}Tests PROPERTY LABELS ${fw_lib}) +set_property(TEST ${fw_lib}Tests PROPERTY RESOURCE_LOCK ctkPluginStorage) From 7e3f68bb771ad8bbff23f9e643534fea507538fc Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Tue, 13 Jun 2023 22:53:48 -0400 Subject: [PATCH 022/115] COMP: Fix deprecated use of QSet::toList() in ctkWorkflowButtonBoxWidget 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/ctkWorkflowButtonBoxWidget.cpp:200:72: warning: ‘static QSet QSet::fromList(const QList&) [with T = ctkWorkflowStep*]’ is deprecated: Use QSet(list.begin(), list.end()) instead. [-Wdeprecated-declarations] 200 | QSet::fromList(this->GoToButtonToStepMap.values()); | ^ --- Libs/Widgets/ctkWorkflowButtonBoxWidget.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Libs/Widgets/ctkWorkflowButtonBoxWidget.cpp b/Libs/Widgets/ctkWorkflowButtonBoxWidget.cpp index 3f1823abe8..3e4d4a9c41 100644 --- a/Libs/Widgets/ctkWorkflowButtonBoxWidget.cpp +++ b/Libs/Widgets/ctkWorkflowButtonBoxWidget.cpp @@ -194,10 +194,17 @@ void ctkWorkflowButtonBoxWidgetPrivate::updateGoToButtons(ctkWorkflowStep* curre Q_ASSERT(q->layout()); // Change the buttons only if the set of steps to have goTo buttons is either empty or has changed +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) + QList finishSteps = this->Workflow->finishSteps(); + QSet goToStepsToHaveButtons(finishSteps.begin(), finishSteps.end()); + QList steps = this->GoToButtonToStepMap.values(); + QSet goToStepsThatHaveButtons(steps.begin(), steps.end()); +#else QSet goToStepsToHaveButtons = QSet::fromList(this->Workflow->finishSteps()); QSet goToStepsThatHaveButtons = QSet::fromList(this->GoToButtonToStepMap.values()); +#endif // Remove the buttons if the set of steps to have goTo buttons has changed if (goToStepsThatHaveButtons != goToStepsToHaveButtons) From 03dc7947dca283df1d4458446f3b7afe5ca1dd54 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Tue, 13 Jun 2023 22:59:31 -0400 Subject: [PATCH 023/115] COMP: Fix -Wdeprecated-declarations in ctkSoapConnectionRunnable 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/Plugins/org.commontk.dah.core/ctkSoapConnectionRunnable.cpp:146:27: warning: ‘QByteArray& QByteArray::append(const QString&)’ is deprecated: Use QString's toUtf8(), toLatin1() or toLocal8Bit() [-Wdeprecated-declarations] 146 | block.append(content); | ^ --- Plugins/org.commontk.dah.core/ctkSoapConnectionRunnable.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/org.commontk.dah.core/ctkSoapConnectionRunnable.cpp b/Plugins/org.commontk.dah.core/ctkSoapConnectionRunnable.cpp index e1907764f8..ed1a15b88a 100644 --- a/Plugins/org.commontk.dah.core/ctkSoapConnectionRunnable.cpp +++ b/Plugins/org.commontk.dah.core/ctkSoapConnectionRunnable.cpp @@ -140,10 +140,10 @@ void ctkSoapConnectionRunnable::readClient(QTcpSocket& socket) QByteArray block; block.append("HTTP/1.1 200 OK\n"); block.append("Content-Type: text/xml;charset=utf-8\n"); - block.append("Content-Length: ").append(QString::number(content.size())).append("\n"); + block.append("Content-Length: ").append(QString::number(content.size()).toUtf8()).append("\n"); block.append("\n"); - block.append(content); + block.append(content.toUtf8()); CTK_SOAP_LOG_LOWLEVEL( << block ); From e52f10fb1823bbca135cbad075d7265e832babc2 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Tue, 13 Jun 2023 23:49:11 -0400 Subject: [PATCH 024/115] COMP: Remove deprecated use of QSqlError::number() in ctkPluginStorageSQL 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/PluginFramework/ctkPluginStorageSQL.cpp:737:46: warning: ‘int QSqlError::number() const’ is deprecated [-Wdeprecated-declarations] 737 | int result = query->lastError().number(); | ^ --- Libs/PluginFramework/ctkPluginStorageSQL.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Libs/PluginFramework/ctkPluginStorageSQL.cpp b/Libs/PluginFramework/ctkPluginStorageSQL.cpp index 53a9935eca..b72901c6fd 100644 --- a/Libs/PluginFramework/ctkPluginStorageSQL.cpp +++ b/Libs/PluginFramework/ctkPluginStorageSQL.cpp @@ -733,13 +733,17 @@ void ctkPluginStorageSQL::executeQuery(QSqlQuery *query, const QString &statemen } ctkPluginDatabaseException::Type errorType; - int result = query->lastError().number(); - if (result == 26 || result == 11) //SQLILTE_NOTADB || SQLITE_CORRUPT +#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)) + QString result = query->lastError().nativeErrorCode(); +#else + QString result = QString::number(query->lastError().number()); +#endif + if (result == "26" || result == "11") //SQLILTE_NOTADB || SQLITE_CORRUPT { qWarning() << "ctkPluginFramework:- Database file is corrupt or invalid:" << getDatabasePath(); errorType = ctkPluginDatabaseException::DB_FILE_INVALID; } - else if (result == 8) //SQLITE_READONLY + else if (result == "8") // SQLITE_READONLY errorType = ctkPluginDatabaseException::DB_WRITE_ERROR; else errorType = ctkPluginDatabaseException::DB_SQL_ERROR; @@ -1009,13 +1013,17 @@ void ctkPluginStorageSQL::beginTransaction(QSqlQuery *query, TransactionType typ success = query->exec(QLatin1String("BEGIN IMMEDIATE")); if (!success) { - int result = query->lastError().number(); - if (result == 26 || result == 11) //SQLITE_NOTADB || SQLITE_CORRUPT +#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)) + QString result = query->lastError().nativeErrorCode(); +#else + QString result = QString::number(query->lastError().number()); +#endif + if (result == "26" || result == "11") // SQLITE_NOTADB || SQLITE_CORRUPT { throw ctkPluginDatabaseException(QString("ctkPluginFramework: Database file is corrupt or invalid: %1").arg(getDatabasePath()), ctkPluginDatabaseException::DB_FILE_INVALID); } - else if (result == 8) //SQLITE_READONLY + else if (result == "8") // SQLITE_READONLY { throw ctkPluginDatabaseException(QString("ctkPluginFramework: Insufficient permissions to write to database: %1").arg(getDatabasePath()), ctkPluginDatabaseException::DB_WRITE_ERROR); From 1ae2166fb7b5937b4659af5edfa4972ca72ef94d Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 14 Jun 2023 00:18:49 -0400 Subject: [PATCH 025/115] COMP: Fix -Wdeprecated-declarations in ctkCommandLineModuleExplorerMain 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/ctkCommandLineModuleExplorer/ctkCommandLineModuleExplorerMain.cpp:146:47: warning: ‘QByteArray& QByteArray::append(const QString&)’ is deprecated: Use QString's toUtf8(), toLatin1() or toLocal8Bit() [-Wdeprecated-declarations] 146 | byteArray.append(args["string"].toString()); | ^ --- .../ctkCommandLineModuleExplorerMain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Applications/ctkCommandLineModuleExplorer/ctkCommandLineModuleExplorerMain.cpp b/Applications/ctkCommandLineModuleExplorer/ctkCommandLineModuleExplorerMain.cpp index 45f89593ad..391f1a48f1 100644 --- a/Applications/ctkCommandLineModuleExplorer/ctkCommandLineModuleExplorerMain.cpp +++ b/Applications/ctkCommandLineModuleExplorer/ctkCommandLineModuleExplorerMain.cpp @@ -143,7 +143,7 @@ int main(int argc, char** argv) else if (args.contains("string")) { QByteArray byteArray; - byteArray.append(args["string"].toString()); + byteArray.append(args["string"].toString().toUtf8()); QBuffer buffer(&byteArray); buffer.open(QIODevice::ReadOnly); From b438c4e0235a257cea45f1fdc154f45ca26e266c Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Tue, 13 Jun 2023 22:49:22 -0400 Subject: [PATCH 026/115] COMP: Fix deprecated use of QSet::toList() in ctkPluginStorageSQL 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/PluginFramework/ctkPluginStorageSQL.cpp:699:23: warning: ‘QList QSet::toList() const [with T = QString]’ is deprecated: Use values() instead. [-Wdeprecated-declarations] 699 | return paths.toList(); | ^ --- Libs/PluginFramework/ctkPluginStorageSQL.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Libs/PluginFramework/ctkPluginStorageSQL.cpp b/Libs/PluginFramework/ctkPluginStorageSQL.cpp index b72901c6fd..11815d1d82 100644 --- a/Libs/PluginFramework/ctkPluginStorageSQL.cpp +++ b/Libs/PluginFramework/ctkPluginStorageSQL.cpp @@ -29,6 +29,7 @@ #include "ctkPluginFrameworkUtil_p.h" #include "ctkPluginFrameworkContext_p.h" #include "ctkServiceException.h" +#include "ctkUtils.h" #include #include @@ -696,7 +697,7 @@ QStringList ctkPluginStorageSQL::findResourcesPath(int archiveKey, const QString } } - return paths.toList(); + return ctk::qSetToQStringList(paths); } //---------------------------------------------------------------------------- From 12711976fb13fd74959396f7f64fe648e853cdaa Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 14 Jun 2023 01:15:31 -0400 Subject: [PATCH 027/115] COMP: Fix deprecated use of QFileDialog::DirectoryOnly in ctkDICOMBrowser 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/DICOM/Widgets/ctkDICOMBrowser.cpp:1633:45: warning: ‘QFileDialog::DirectoryOnly’ is deprecated: Use setOption(ShowDirsOnly, true) instead [-Wdeprecated-declarations] 1633 | directoryDialog->setFileMode(QFileDialog::DirectoryOnly); | ^~~~~~~~~~~~~ --- Libs/DICOM/Widgets/ctkDICOMBrowser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp b/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp index 72a8c332d6..07ce251447 100644 --- a/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp @@ -1625,7 +1625,7 @@ void ctkDICOMBrowser::exportSelectedItems(ctkDICOMModel::IndexType level) Q_D(const ctkDICOMBrowser); ctkFileDialog* directoryDialog = new ctkFileDialog(); directoryDialog->setOption(QFileDialog::ShowDirsOnly); - directoryDialog->setFileMode(QFileDialog::DirectoryOnly); + directoryDialog->setFileMode(QFileDialog::Directory); bool res = directoryDialog->exec(); if (!res) { From 2ce5e5d716d033d531e23feef22ffbbf546be8d7 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 14 Jun 2023 01:25:39 -0400 Subject: [PATCH 028/115] COMP: Fix deprecated use of QList::swap() in ctkDICOMTableView 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/DICOM/Widgets/ctkDICOMTableView.cpp:358:49: warning: ‘void QList::swap(int, int) [with T = int]’ is deprecated: Use QList::swapItemsAt() [-Wdeprecated-declarations] 358 | columnIndicesByVisualIndex.swap(j, j+1); | ^ --- Libs/DICOM/Widgets/ctkDICOMTableView.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Libs/DICOM/Widgets/ctkDICOMTableView.cpp b/Libs/DICOM/Widgets/ctkDICOMTableView.cpp index 69da9c7308..e571237427 100644 --- a/Libs/DICOM/Widgets/ctkDICOMTableView.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMTableView.cpp @@ -346,7 +346,11 @@ void ctkDICOMTableViewPrivate::applyColumnProperties() { if (columnIndicesByVisualIndex[j] > columnIndicesByVisualIndex[j+1]) { +#if (QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)) + columnIndicesByVisualIndex.swapItemsAt(j, j+1); +#else columnIndicesByVisualIndex.swap(j, j+1); +#endif header->swapSections(j, j+1); } } @@ -360,7 +364,11 @@ void ctkDICOMTableViewPrivate::applyColumnProperties() { if (columnWeights[j] > columnWeights[j+1]) { +#if (QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)) + columnWeights.swapItemsAt(j, j+1); +#else columnWeights.swap(j, j+1); +#endif header->swapSections(j, j+1); } } From 158c2fccf74b199e5767ea1290b3cd21a266e255 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 14 Jun 2023 01:28:38 -0400 Subject: [PATCH 029/115] COMP: Fix -Wdeprecated-declarations in ctkDICOMBrowserTester 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/DICOM/Widgets/Testing/Cpp/ctkDICOMBrowserTest.cpp:79:49: warning: ‘QDir& QDir::operator=(const QString&)’ is deprecated: Use QDir::setPath() instead [-Wdeprecated-declarations] 79 | this->DICOMDir = dataDir.filePath("Data/DICOM"); | ^ --- Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMBrowserTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMBrowserTest.cpp b/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMBrowserTest.cpp index 58009e74e6..93e1bf7690 100644 --- a/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMBrowserTest.cpp +++ b/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMBrowserTest.cpp @@ -76,7 +76,7 @@ void ctkDICOMBrowserTester::initTestCase() QDir dataDir = QDir(QProcessEnvironment::systemEnvironment().value("CTKData_DIR", "")); QVERIFY(dataDir.exists()); - this->DICOMDir = dataDir.filePath("Data/DICOM"); + this->DICOMDir.setPath(dataDir.filePath("Data/DICOM")); QVERIFY(this->DICOMDir.exists()); this->DatabaseDirectoryName = QDir::tempPath() + "/ctkDICOMBrowserTest-Database"; From 724c154927732e55537b9476cf0b970c08a09bdc Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 14 Jun 2023 01:31:01 -0400 Subject: [PATCH 030/115] COMP: Fix deprecated use of QFileDialog::DirectoryOnly in ctkFileDialogTest1 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/Testing/Cpp/ctkFileDialogTest1.cpp:47:40: warning: ‘QFileDialog::DirectoryOnly’ is deprecated: Use setOption(ShowDirsOnly, true) instead [-Wdeprecated-declarations] 47 | fileDialog->setFileMode(QFileDialog::DirectoryOnly); | ^~~~~~~~~~~~~ --- Libs/Widgets/Testing/Cpp/ctkFileDialogTest1.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Libs/Widgets/Testing/Cpp/ctkFileDialogTest1.cpp b/Libs/Widgets/Testing/Cpp/ctkFileDialogTest1.cpp index 32e85b800f..6caa008a2c 100644 --- a/Libs/Widgets/Testing/Cpp/ctkFileDialogTest1.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkFileDialogTest1.cpp @@ -44,7 +44,8 @@ int testSelectionMode(ctkFileDialog* fileDialog) CHECK_INT(fileDialog->selectionMode(), static_cast(QAbstractItemView::SingleSelection)); fileDialog->setSelectionMode(QAbstractItemView::ExtendedSelection); - fileDialog->setFileMode(QFileDialog::DirectoryOnly); + fileDialog->setFileMode(QFileDialog::Directory); + fileDialog->setOption(QFileDialog::ShowDirsOnly); CHECK_INT(fileDialog->selectionMode(), static_cast(QAbstractItemView::SingleSelection)); fileDialog->setSelectionMode(QAbstractItemView::ExtendedSelection); From 3437bee743f4c4a2dbcf8abefd7f46d9812639ab Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Tue, 13 Jun 2023 10:14:26 -0400 Subject: [PATCH 031/115] 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 d32d368e7f22d250c15affb402f4d8a2a60a268c Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Tue, 13 Jun 2023 19:19:18 -0400 Subject: [PATCH 032/115] 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 59068054c162e12208a39b884512a95db1f09a9d Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Tue, 13 Jun 2023 19:40:53 -0400 Subject: [PATCH 033/115] 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 fe3091bbce5e1cce2e8a7b598cff97263e2d0fc1 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 15 Jun 2023 01:29:16 -0400 Subject: [PATCH 034/115] 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 a1e8d4f5c954d6886998a47ed585c00fdeefcfe5 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 14 Jun 2023 00:54:19 -0400 Subject: [PATCH 035/115] 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 234a64450816b527ea5461b6502d6caae23c6622 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 13 Apr 2023 12:04:29 -0400 Subject: [PATCH 036/115] 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 35f2497e1f0d88f776ab3818091e3b2cd5432c31 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 15 Jun 2023 02:31:04 -0400 Subject: [PATCH 037/115] 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 6f07dd4f435b9aeafdd51dfac5b76c4bae78b53a Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 15 Jun 2023 02:44:06 -0400 Subject: [PATCH 038/115] 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 9068b8fa2d4ea87eb50722d6b4bbfc49e62974f3 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 15 Jun 2023 03:05:36 -0400 Subject: [PATCH 039/115] 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 e0cbe09caf06d06d773abfc8a7adb69369869c2d Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 15 Jun 2023 03:22:17 -0400 Subject: [PATCH 040/115] 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 ae4cfd308637d96ed6748469752b090223f9ae6d Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 15 Jun 2023 03:28:32 -0400 Subject: [PATCH 041/115] 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 aa4a717152052812627a020c7f4110ccb8f7bfc8 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 15 Jun 2023 03:41:43 -0400 Subject: [PATCH 042/115] 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(); From db4d84ffccbdb455ca044ac9b208c8ee1e6e3131 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 14 Jun 2023 00:23:04 -0400 Subject: [PATCH 043/115] COMP: Fix -Wdeprecated-declarations related to ctkDICOMImage 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/DICOM/Widgets/ctkDICOMImage.cpp:122:25: warning: ‘QByteArray& QByteArray::append(const QString&)’ is deprecated: Use QString's toUtf8(), toLatin1() or toLocal8Bit() [-Wdeprecated-declarations] 122 | buffer.append(header); | ^ /path/to/CTK/Libs/DICOM/Widgets/ctkDICOMItemView.cpp:323:25: warning: ‘QByteArray& QByteArray::append(const QString&)’ is deprecated: Use QString's toUtf8(), toLatin1() or toLocal8Bit() [-Wdeprecated-declarations] 323 | buffer.append(header); | ^ Co-authored-by: James Butler Co-authored-by: Andras Lasso --- Libs/DICOM/Widgets/ctkDICOMImage.cpp | 2 +- Libs/DICOM/Widgets/ctkDICOMItemView.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Libs/DICOM/Widgets/ctkDICOMImage.cpp b/Libs/DICOM/Widgets/ctkDICOMImage.cpp index 161edbf0c7..a931c9ff94 100644 --- a/Libs/DICOM/Widgets/ctkDICOMImage.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMImage.cpp @@ -119,7 +119,7 @@ QImage ctkDICOMImage::frame(int frame) const const unsigned long length = width * height + offset; /* create output buffer for DicomImage class */ QByteArray buffer; - buffer.append(header); + buffer.append(header.toUtf8()); buffer.resize(length); /* copy PGM header to buffer */ diff --git a/Libs/DICOM/Widgets/ctkDICOMItemView.cpp b/Libs/DICOM/Widgets/ctkDICOMItemView.cpp index 5c36069719..84fd0c1cfd 100644 --- a/Libs/DICOM/Widgets/ctkDICOMItemView.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMItemView.cpp @@ -320,7 +320,7 @@ void ctkDICOMItemView::addImage( DicomImage & dcmImage, bool defaultIntensity ) /* create output buffer for DicomImage class */ QByteArray buffer; /* copy header to output buffer and resize it for pixel data */ - buffer.append(header); + buffer.append(header.toUtf8()); buffer.resize(length); /* render pixel data to buffer */ From 01963f446f7917f1068fc231d0014c20bced42d7 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 14 Jun 2023 00:43:44 -0400 Subject: [PATCH 044/115] COMP: Fix deprecated use of QTime::start()/elapsed() in ctkVTKAbstractView 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/ctkVTKAbstractView.cpp:207:26: warning: ‘void QTime::start()’ is deprecated: Use QElapsedTimer instead [-Wdeprecated-declarations] 207 | d->RequestTime.start(); | ^ /path/to/CTK/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.cpp:210:35: warning: ‘int QTime::elapsed() const’ is deprecated: Use QElapsedTimer instead [-Wdeprecated-declarations] 210 | else if (d->RequestTime.elapsed() > msecsBeforeRender) | ^ --- Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.cpp | 4 ++++ Libs/Visualization/VTK/Widgets/ctkVTKAbstractView_p.h | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.cpp b/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.cpp index 4411c77522..965108b671 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.cpp +++ b/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.cpp @@ -245,7 +245,11 @@ void ctkVTKAbstractView::forceRender() // The timer can be stopped if it hasn't timed out yet. d->RequestTimer->stop(); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) + d->RequestTime.invalidate(); +#else d->RequestTime = QTime(); +#endif //logger.trace(QString("forceRender - RenderEnabled: %1") // .arg(d->RenderEnabled ? "true" : "false")); diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView_p.h b/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView_p.h index b8acf61253..76693d7508 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView_p.h +++ b/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView_p.h @@ -22,6 +22,10 @@ #define __ctkVTKAbstractView_p_h // Qt includes +#include +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) +#include +#endif #include #include class QTimer; @@ -64,7 +68,11 @@ class ctkVTKAbstractViewPrivate : public QObject vtkSmartPointer RenderWindow; #endif QTimer* RequestTimer; +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) + QElapsedTimer RequestTime; +#else QTime RequestTime; +#endif bool RenderEnabled; double MaximumUpdateRate; bool FPSVisible; From 5d241ecc539dcee182a78b03ecf78514a7fba58c Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 14 Jun 2023 00:48:02 -0400 Subject: [PATCH 045/115] COMP: Fix -Wdeprecated-declarations in ctkDICOMThumbnailGenerator 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/DICOM/Widgets/ctkDICOMThumbnailGenerator.cpp:174:23: warning: ‘QByteArray& QByteArray::append(const QString&)’ is deprecated: Use QString's toUtf8(), toLatin1() or toLocal8Bit() [-Wdeprecated-declarations] 174 | buffer.append(header); | ^ Co-authored-by: James Butler Co-authored-by: Andras Lasso --- Libs/DICOM/Widgets/ctkDICOMThumbnailGenerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libs/DICOM/Widgets/ctkDICOMThumbnailGenerator.cpp b/Libs/DICOM/Widgets/ctkDICOMThumbnailGenerator.cpp index 3439f3d1b0..a99ee51705 100644 --- a/Libs/DICOM/Widgets/ctkDICOMThumbnailGenerator.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMThumbnailGenerator.cpp @@ -171,7 +171,7 @@ bool ctkDICOMThumbnailGenerator::generateThumbnail(DicomImage *dcmImage, QImage& /* create output buffer for DicomImage class */ QByteArray buffer; /* copy header to output buffer and resize it for pixel data */ - buffer.append(header); + buffer.append(header.toUtf8()); buffer.resize(length); /* render pixel data to buffer */ From 491614f129e09e30682cbb7322ced540eba71ec0 Mon Sep 17 00:00:00 2001 From: Davide Punzo Date: Thu, 29 Jun 2023 04:39:25 -0400 Subject: [PATCH 046/115] ENH: ErrorLogWidget improvements - Layout orientation can be configured: it allows better use of available space if the window is very tall or wide (e.g., when in a docking widget). - Added userViewed() signal: it can be used to detect that the user viewed messages. - Home/End keys now jump to first/last message (not to the first/last cell of the current row). - Small cosmetic fix: "All" button height now matches other buttons in the row, regardless of screen resolution. Co-authored-by: Jean-Christophe Fillion-Robin Co-authored-by: Andras Lasso --- .../Widgets/Resources/UI/ctkErrorLogWidget.ui | 30 ++++-- Libs/Widgets/ctkErrorLogWidget.cpp | 100 ++++++++++++++++++ Libs/Widgets/ctkErrorLogWidget.h | 20 ++++ 3 files changed, 143 insertions(+), 7 deletions(-) diff --git a/Libs/Widgets/Resources/UI/ctkErrorLogWidget.ui b/Libs/Widgets/Resources/UI/ctkErrorLogWidget.ui index 20c126f624..0e6b9805ca 100644 --- a/Libs/Widgets/Resources/UI/ctkErrorLogWidget.ui +++ b/Libs/Widgets/Resources/UI/ctkErrorLogWidget.ui @@ -6,15 +6,30 @@ 0 0 - 754 - 429 + 463 + 428 Log messages - - + + + 5 + + + 5 + + + 5 + + + 5 + + + 1 + + @@ -72,7 +87,7 @@ - + true @@ -94,8 +109,9 @@ - - + + + diff --git a/Libs/Widgets/ctkErrorLogWidget.cpp b/Libs/Widgets/ctkErrorLogWidget.cpp index 70d468e56a..20ce273c29 100644 --- a/Libs/Widgets/ctkErrorLogWidget.cpp +++ b/Libs/Widgets/ctkErrorLogWidget.cpp @@ -21,6 +21,8 @@ // Qt includes #include #include +#include +#include #include // CTK includes @@ -37,6 +39,8 @@ class ctkErrorLogWidgetPrivate : public Ui_ctkErrorLogWidget typedef ctkErrorLogWidgetPrivate Self; ctkErrorLogWidgetPrivate(ctkErrorLogWidget& object); + Qt::Orientation LayoutOrientation; + ctkErrorLogLevel::LogLevels ErrorButtonFilter; ctkErrorLogLevel::LogLevels WarningButtonFilter; ctkErrorLogLevel::LogLevels InfoButtonFilter; @@ -53,6 +57,7 @@ class ctkErrorLogWidgetPrivate : public Ui_ctkErrorLogWidget ctkErrorLogWidgetPrivate::ctkErrorLogWidgetPrivate(ctkErrorLogWidget& object) : q_ptr(&object) { + this->LayoutOrientation = Qt::Vertical; this->ErrorButtonFilter = ctkErrorLogLevel::Error | ctkErrorLogLevel::Critical | ctkErrorLogLevel::Fatal; this->WarningButtonFilter = ctkErrorLogLevel::Warning; this->InfoButtonFilter = ctkErrorLogLevel::Info | ctkErrorLogLevel::Debug | ctkErrorLogLevel::Trace | ctkErrorLogLevel::Status; @@ -63,12 +68,20 @@ void ctkErrorLogWidgetPrivate::init() { Q_Q(ctkErrorLogWidget); +#if QT_VERSION >= QT_VERSION_CHECK(5,2,0) + this->ErrorLogDescription->setPlaceholderText(ctkErrorLogWidget::tr("Select messages in the list to see details here.")); +#endif + // this->ShowAllEntryButton->setIcon(); this->ShowErrorEntryButton->setIcon(q->style()->standardIcon(QStyle::SP_MessageBoxCritical)); this->ShowWarningEntryButton->setIcon(q->style()->standardIcon(QStyle::SP_MessageBoxWarning)); this->ShowInfoEntryButton->setIcon(q->style()->standardIcon(QStyle::SP_MessageBoxInformation)); this->ClearButton->setIcon(q->style()->standardIcon(QStyle::SP_DialogDiscardButton)); + // Make the iconless "All" button the same height as other buttons that have icons + // (they are shown in the same row, so it does not look nice if their height is different) + this->ShowAllEntryButton->setFixedHeight(this->ShowErrorEntryButton->sizeHint().height()); + QObject::connect(this->ShowAllEntryButton, SIGNAL(clicked()), q, SLOT(setAllEntriesVisible())); @@ -83,6 +96,12 @@ void ctkErrorLogWidgetPrivate::init() QObject::connect(this->ClearButton, SIGNAL(clicked()), q, SLOT(removeEntries())); + + QScrollBar* verticalScrollBar = this->ErrorLogTableView->verticalScrollBar(); + QObject::connect(verticalScrollBar, SIGNAL(valueChanged(int)), + q, SIGNAL(userViewed())); + + this->ErrorLogTableView->installEventFilter(q); } // -------------------------------------------------------------------------- @@ -186,6 +205,53 @@ void ctkErrorLogWidget::setColumnHidden(int columnId, bool hidden) const d->ErrorLogTableView->setColumnHidden(columnId, hidden); } +// -------------------------------------------------------------------------- +void ctkErrorLogWidget::setLayoutOrientation(Qt::Orientation orientation) +{ + Q_D(ctkErrorLogWidget); + if (d->LayoutOrientation == orientation) + { + return; + } + + d->ctkErrorLogGridLayout->removeWidget(d->ErrorLogDescription); + + int errorLogTableViewIndex = d->ctkErrorLogGridLayout->indexOf(d->ErrorLogTableView); + int errorLogTableViewRowIndex = -1; + int errorLogTableViewColIndex = -1; + int errorLogTableViewRowSpan = -1; + int errorLogTableViewColSpan = -1; + + d->ctkErrorLogGridLayout->getItemPosition(errorLogTableViewIndex, + &errorLogTableViewRowIndex, &errorLogTableViewColIndex, + &errorLogTableViewRowSpan, &errorLogTableViewColSpan); + + if (orientation == Qt::Vertical) + { + // Description is below message table + d->ctkErrorLogGridLayout->addWidget(d->ErrorLogDescription, + errorLogTableViewRowIndex + 1, errorLogTableViewColIndex, // row, col + 1, 1); // rowSpan, colSpan + } + else + { + // Description is in a second column, beside the message table. + // Specifying rowSpan = -1 ensures the widget fills the entire second column. + d->ctkErrorLogGridLayout->addWidget(d->ErrorLogDescription, + 0, errorLogTableViewColIndex + 1, // row, col + -1, 1); // rowSpan, colSpan + } + + d->LayoutOrientation = orientation; +} + +// -------------------------------------------------------------------------- +Qt::Orientation ctkErrorLogWidget::layoutOrientation() const +{ + Q_D(const ctkErrorLogWidget); + return d->LayoutOrientation; +} + // -------------------------------------------------------------------------- void ctkErrorLogWidget::setAllEntriesVisible(bool visibility) { @@ -259,6 +325,7 @@ void ctkErrorLogWidget::onLogLevelFilterChanged() d->ShowErrorEntryButton->setChecked(logLevelFilter & d->ErrorButtonFilter); d->ShowWarningEntryButton->setChecked(logLevelFilter & d->WarningButtonFilter); d->ShowInfoEntryButton->setChecked(logLevelFilter & d->InfoButtonFilter); + emit userViewed(); } // -------------------------------------------------------------------------- @@ -266,6 +333,7 @@ void ctkErrorLogWidget::removeEntries() { Q_ASSERT(this->errorLogModel()); this->errorLogModel()->clear(); + emit userViewed(); } // -------------------------------------------------------------------------- @@ -296,5 +364,37 @@ void ctkErrorLogWidget::onSelectionChanged(const QItemSelection & selected, d->ErrorLogDescription->setText(descriptions.join("\n")); + emit userViewed(); + // fprintf(stdout, "onSelectionChanged: %d\n", start.msecsTo(QTime::currentTime())); } + +//--------------------------------------------------------------------------- +bool ctkErrorLogWidget::eventFilter(QObject* target, QEvent* event) +{ + Q_D(ctkErrorLogWidget); + if (target == d->ErrorLogTableView && event->type() == QEvent::KeyPress) + { + // Make Home/End keys jump to first/last message in the list + // (without this, the keys would jump to the first/last cell in the current row) + QKeyEvent* keyEvent = static_cast(event); + if (keyEvent->key() == Qt::Key_Home) + { + QModelIndex firstIndex = d->ErrorLogTableView->model()->index(0, 0); + QItemSelectionModel* select = d->ErrorLogTableView->selectionModel(); + select->select(firstIndex, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows); + d->ErrorLogTableView->scrollToTop(); + return true; + } + else if (keyEvent->key() == Qt::Key_End) + { + int rowCount = d->ErrorLogTableView->model()->rowCount(); + QModelIndex lastIndex = d->ErrorLogTableView->model()->index(rowCount - 1, 0); + QItemSelectionModel* select = d->ErrorLogTableView->selectionModel(); + select->select(lastIndex, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows); + d->ErrorLogTableView->scrollToBottom(); + return true; + } + } + return this->Superclass::eventFilter(target, event); +} diff --git a/Libs/Widgets/ctkErrorLogWidget.h b/Libs/Widgets/ctkErrorLogWidget.h index 6e049c58c8..c8fcd1cd02 100644 --- a/Libs/Widgets/ctkErrorLogWidget.h +++ b/Libs/Widgets/ctkErrorLogWidget.h @@ -37,6 +37,7 @@ class QModelIndex; class CTK_WIDGETS_EXPORT ctkErrorLogWidget : public QWidget { Q_OBJECT + Q_PROPERTY(Qt::Orientation layoutOrientation READ layoutOrientation WRITE setLayoutOrientation) public: typedef QWidget Superclass; explicit ctkErrorLogWidget(QWidget* parentWidget = 0); @@ -49,7 +50,24 @@ class CTK_WIDGETS_EXPORT ctkErrorLogWidget : public QWidget /// \sa ctkErrorLogModel::ColumnsIds Q_INVOKABLE void setColumnHidden(int columnId, bool hidden) const; + /// This property describes how the list of errors and error description are organized. + /// The orientation must be Qt::Horizontal (the widgets are side-by-side) or Qt::Vertical (the widgets are above-under). + /// The default is Qt::Vertical. + Qt::Orientation layoutOrientation() const; + +Q_SIGNALS: + + /// Emitted if the user interacted with the widget to view messages + /// (scrolled the message list, changed filter criteria, etc.). + /// This can be useful if the application shows a "new message" notification + /// when a new message is logged: the application can hide the notification + /// when this signal is emitted, because it indicates that the user had a look + /// at the messages. + void userViewed(); + public Q_SLOTS: + void setLayoutOrientation(Qt::Orientation orientation); + void setAllEntriesVisible(bool visibility = true); void setErrorEntriesVisible(bool visibility); @@ -70,6 +88,8 @@ protected Q_SLOTS: void onSelectionChanged(const QItemSelection & selected, const QItemSelection & deselected); protected: + bool eventFilter(QObject* target, QEvent* event); + QScopedPointer d_ptr; private: From ab32470d578d0ab0f4a88ce9fa93253176620f62 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 3 Nov 2021 20:59:26 -0400 Subject: [PATCH 047/115] COMP: Update ctkCompilerDetections_p.h to include CTK_OVERRIDE --- Libs/Core/ctkCompilerDetections_p.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Libs/Core/ctkCompilerDetections_p.h b/Libs/Core/ctkCompilerDetections_p.h index 10cb1bbbe5..7b03ab427b 100644 --- a/Libs/Core/ctkCompilerDetections_p.h +++ b/Libs/Core/ctkCompilerDetections_p.h @@ -38,4 +38,10 @@ # define CTK_NULLPTR NULL #endif +#if (__cplusplus >= 201103L) || ( defined(_MSC_VER) && _MSC_VER >= 1700 ) +# define CTK_OVERRIDE override +#else +# define CTK_OVERRIDE +#endif + #endif From 96166c32b0cf753ef976a4dbd45f07ab03a9f638 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 3 Nov 2021 21:05:11 -0400 Subject: [PATCH 048/115] COMP: Fix Qt4/C++98 build updating Widget & DICOM libraries to use CTK_OVERRIDE --- .../ctkDICOMDisplayedFieldGeneratorDefaultRule.h | 12 ++++++------ ...tkDICOMDisplayedFieldGeneratorLastStudyDateRule.h | 12 ++++++------ ...splayedFieldGeneratorPatientNumberOfStudiesRule.h | 12 ++++++------ ...FieldGeneratorRadiotherapySeriesDescriptionRule.h | 12 ++++++------ .../ctkDICOMDisplayedFieldGeneratorRuleFactory.h | 2 +- ...ICOMDisplayedFieldGeneratorSeriesImageCountRule.h | 12 ++++++------ ...MDisplayedFieldGeneratorStudyNumberOfSeriesRule.h | 12 ++++++------ Libs/Widgets/ctkCheckablePushButton.h | 8 ++++---- Libs/Widgets/ctkPathLineEdit.cpp | 2 +- 9 files changed, 42 insertions(+), 42 deletions(-) diff --git a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorDefaultRule.h b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorDefaultRule.h index 13596f579c..85dbe4795a 100644 --- a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorDefaultRule.h +++ b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorDefaultRule.h @@ -35,31 +35,31 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMDisplayedFieldGeneratorDefaultRule : public { public: /// Get name of rule - QString name()const override; + QString name()const CTK_OVERRIDE; /// Clone displayed field generator rule. Override to return a new instance of the rule sub-class - ctkDICOMDisplayedFieldGeneratorAbstractRule* clone() override; + ctkDICOMDisplayedFieldGeneratorAbstractRule* clone() CTK_OVERRIDE; /// Specify list of DICOM tags required by the rule. These tags will be included in the tag cache - QStringList getRequiredDICOMTags() override; + QStringList getRequiredDICOMTags() CTK_OVERRIDE; /// Register placeholder strings that still mean that a given field can be considered empty. /// Used when merging the original database content with the displayed fields generated by the rules. /// Example: SeriesDescription -> Unnamed Series - void registerEmptyFieldNames(QMap emptyFieldsSeries, QMap emptyFieldstudies, QMap emptyFieldsPatients) override; + void registerEmptyFieldNames(QMap emptyFieldsSeries, QMap emptyFieldstudies, QMap emptyFieldsPatients) CTK_OVERRIDE; /// Generate displayed fields for a certain instance based on its cached tags /// The way these generated fields will be used is defined by \sa mergeDisplayedFieldsForInstance void getDisplayedFieldsForInstance( const QMap &cachedTagsForInstance, QMap &displayedFieldsForCurrentSeries, - QMap &displayedFieldsForCurrentStudy, QMap &displayedFieldsForCurrentPatient ) override; + QMap &displayedFieldsForCurrentStudy, QMap &displayedFieldsForCurrentPatient ) CTK_OVERRIDE; /// Define rules of merging initial database values with new values generated by the rule plugins void mergeDisplayedFieldsForInstance( const QMap &initialFieldsSeries, const QMap &initialFieldsStudy, const QMap &initialFieldsPatient, const QMap &newFieldsSeries, const QMap &newFieldsStudy, const QMap &newFieldsPatient, QMap &mergedFieldsSeries, QMap &mergedFieldsStudy, QMap &mergedFieldsPatient, - const QMap &emptyFieldsSeries, const QMap &emptyFieldsStudy, const QMap &emptyFieldsPatient ) override; + const QMap &emptyFieldsSeries, const QMap &emptyFieldsStudy, const QMap &emptyFieldsPatient ) CTK_OVERRIDE; protected: QString humanReadablePatientName(QString dicomPatientName); diff --git a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorLastStudyDateRule.h b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorLastStudyDateRule.h index ad38e6b57a..6bf837f4a0 100644 --- a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorLastStudyDateRule.h +++ b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorLastStudyDateRule.h @@ -37,29 +37,29 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMDisplayedFieldGeneratorLastStudyDateRule : p explicit ctkDICOMDisplayedFieldGeneratorLastStudyDateRule(); /// Get name of rule - QString name()const override; + QString name()const CTK_OVERRIDE; /// Clone displayed field generator rule. Override to return a new instance of the rule sub-class - ctkDICOMDisplayedFieldGeneratorAbstractRule* clone() override; + ctkDICOMDisplayedFieldGeneratorAbstractRule* clone() CTK_OVERRIDE; /// Specify list of DICOM tags required by the rule. These tags will be included in the tag cache - QStringList getRequiredDICOMTags() override; + QStringList getRequiredDICOMTags() CTK_OVERRIDE; /// Generate displayed fields for a certain instance based on its cached tags /// The way these generated fields will be used is defined by \sa mergeDisplayedFieldsForInstance void getDisplayedFieldsForInstance( const QMap &cachedTagsForInstance, QMap &displayedFieldsForCurrentSeries, - QMap &displayedFieldsForCurrentStudy, QMap &displayedFieldsForCurrentPatient ) override; + QMap &displayedFieldsForCurrentStudy, QMap &displayedFieldsForCurrentPatient ) CTK_OVERRIDE; /// Start updating displayed fields (reset counters, etc.). No-op by default. - void startUpdate() override; + void startUpdate() CTK_OVERRIDE; /// End updating displayed fields (accumulate stored variables, compute final result, etc.). No-op by default. /// Has a chance to update any field in the series, study, or patient field maps, based on /// the maps themselves or the database. void endUpdate(QMap > &displayedFieldsMapSeries, QMap > &displayedFieldsMapStudy, - QMap > &displayedFieldsMapPatient) override; + QMap > &displayedFieldsMapPatient) CTK_OVERRIDE; protected: /// Composite IDs (containing PatientID, PatientName, PatientBirthDate) of patients that contain instances of which displayed fields are updated in this run. diff --git a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorPatientNumberOfStudiesRule.h b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorPatientNumberOfStudiesRule.h index 98ac47480d..5a9b29969b 100644 --- a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorPatientNumberOfStudiesRule.h +++ b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorPatientNumberOfStudiesRule.h @@ -37,29 +37,29 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMDisplayedFieldGeneratorPatientNumberOfStudie explicit ctkDICOMDisplayedFieldGeneratorPatientNumberOfStudiesRule(); /// Get name of rule - QString name()const override; + QString name()const CTK_OVERRIDE; /// Clone displayed field generator rule. Override to return a new instance of the rule sub-class - ctkDICOMDisplayedFieldGeneratorAbstractRule* clone() override; + ctkDICOMDisplayedFieldGeneratorAbstractRule* clone() CTK_OVERRIDE; /// Specify list of DICOM tags required by the rule. These tags will be included in the tag cache - QStringList getRequiredDICOMTags() override; + QStringList getRequiredDICOMTags() CTK_OVERRIDE; /// Generate displayed fields for a certain instance based on its cached tags /// The way these generated fields will be used is defined by \sa mergeDisplayedFieldsForInstance void getDisplayedFieldsForInstance( const QMap &cachedTagsForInstance, QMap &displayedFieldsForCurrentSeries, - QMap &displayedFieldsForCurrentStudy, QMap &displayedFieldsForCurrentPatient ) override; + QMap &displayedFieldsForCurrentStudy, QMap &displayedFieldsForCurrentPatient ) CTK_OVERRIDE; /// Start updating displayed fields (reset counters, etc.). No-op by default. - void startUpdate() override; + void startUpdate() CTK_OVERRIDE; /// End updating displayed fields (accumulate stored variables, compute final result, etc.). No-op by default. /// Has a chance to update any field in the series, study, or patient field maps, based on /// the maps themselves or the database. void endUpdate(QMap > &displayedFieldsMapSeries, QMap > &displayedFieldsMapStudy, - QMap > &displayedFieldsMapPatient) override; + QMap > &displayedFieldsMapPatient) CTK_OVERRIDE; protected: /// Composite IDs (containing PatientID, PatientName, PatientBirthDate) of patients that contain instances of which displayed fields are updated in this run. diff --git a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRadiotherapySeriesDescriptionRule.h b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRadiotherapySeriesDescriptionRule.h index e8e6a35453..4a74bb7605 100644 --- a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRadiotherapySeriesDescriptionRule.h +++ b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRadiotherapySeriesDescriptionRule.h @@ -39,31 +39,31 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMDisplayedFieldGeneratorRadiotherapySeriesDes explicit ctkDICOMDisplayedFieldGeneratorRadiotherapySeriesDescriptionRule(); /// Get name of rule - QString name()const override; + QString name()const CTK_OVERRIDE; /// Clone displayed field generator rule. Override to return a new instance of the rule sub-class - ctkDICOMDisplayedFieldGeneratorAbstractRule* clone() override; + ctkDICOMDisplayedFieldGeneratorAbstractRule* clone() CTK_OVERRIDE; /// Specify list of DICOM tags required by the rule. These tags will be included in the tag cache - QStringList getRequiredDICOMTags() override; + QStringList getRequiredDICOMTags() CTK_OVERRIDE; /// Register placeholder strings that still mean that a given field can be considered empty. /// Used when merging the original database content with the displayed fields generated by the rules. /// Example: SeriesDescription -> Unnamed Series - void registerEmptyFieldNames(QMap emptyFieldsSeries, QMap emptyFieldsStudies, QMap emptyFieldsPatients) override; + void registerEmptyFieldNames(QMap emptyFieldsSeries, QMap emptyFieldsStudies, QMap emptyFieldsPatients) CTK_OVERRIDE; /// Generate displayed fields for a certain instance based on its cached tags /// The way these generated fields will be used is defined by \sa mergeDisplayedFieldsForInstance void getDisplayedFieldsForInstance( const QMap &cachedTagsForInstance, QMap &displayedFieldsForCurrentSeries, - QMap &displayedFieldsForCurrentStudy, QMap &displayedFieldsForCurrentPatient ) override; + QMap &displayedFieldsForCurrentStudy, QMap &displayedFieldsForCurrentPatient ) CTK_OVERRIDE; /// Define rules of merging initial database values with new values generated by the rule plugins void mergeDisplayedFieldsForInstance( const QMap &initialFieldsSeries, const QMap &initialFieldsStudy, const QMap &initialFieldsPatient, const QMap &newFieldsSeries, const QMap &newFieldsStudy, const QMap &newFieldsPatient, QMap &mergedFieldsSeries, QMap &mergedFieldsStudy, QMap &mergedFieldsPatient, - const QMap &emptyFieldsSeries, const QMap &emptyFieldsStudy, const QMap &emptyFieldsPatient ) override; + const QMap &emptyFieldsSeries, const QMap &emptyFieldsStudy, const QMap &emptyFieldsPatient ) CTK_OVERRIDE; protected: const QString EmptySeriesDescriptionRtPlan; diff --git a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.h b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.h index 971bca8d81..e20f6ecdf8 100644 --- a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.h +++ b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.h @@ -70,7 +70,7 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMDisplayedFieldGeneratorRuleFactory : public private: ctkDICOMDisplayedFieldGeneratorRuleFactory(QObject* parent=nullptr); - ~ctkDICOMDisplayedFieldGeneratorRuleFactory() override; + ~ctkDICOMDisplayedFieldGeneratorRuleFactory() CTK_OVERRIDE; Q_DISABLE_COPY(ctkDICOMDisplayedFieldGeneratorRuleFactory); friend class ctkDICOMDisplayedFieldGeneratorRuleFactoryCleanup; diff --git a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorSeriesImageCountRule.h b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorSeriesImageCountRule.h index a4628c3cfe..fd38dec96a 100644 --- a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorSeriesImageCountRule.h +++ b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorSeriesImageCountRule.h @@ -37,29 +37,29 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMDisplayedFieldGeneratorSeriesImageCountRule explicit ctkDICOMDisplayedFieldGeneratorSeriesImageCountRule(); /// Get name of rule - QString name()const override; + QString name()const CTK_OVERRIDE; /// Clone displayed field generator rule. Override to return a new instance of the rule sub-class - ctkDICOMDisplayedFieldGeneratorAbstractRule* clone() override; + ctkDICOMDisplayedFieldGeneratorAbstractRule* clone() CTK_OVERRIDE; /// Specify list of DICOM tags required by the rule. These tags will be included in the tag cache - QStringList getRequiredDICOMTags() override; + QStringList getRequiredDICOMTags() CTK_OVERRIDE; /// Generate displayed fields for a certain instance based on its cached tags /// The way these generated fields will be used is defined by \sa mergeDisplayedFieldsForInstance void getDisplayedFieldsForInstance( const QMap &cachedTagsForInstance, QMap &displayedFieldsForCurrentSeries, - QMap &displayedFieldsForCurrentStudy, QMap &displayedFieldsForCurrentPatient ) override; + QMap &displayedFieldsForCurrentStudy, QMap &displayedFieldsForCurrentPatient ) CTK_OVERRIDE; /// Start updating displayed fields (reset counters, etc.). No-op by default. - void startUpdate() override; + void startUpdate() CTK_OVERRIDE; /// End updating displayed fields (accumulate stored variables, compute final result, etc.). No-op by default. /// Has a chance to update any field in the series, study, or patient field maps, based on /// the maps themselves or the database. void endUpdate(QMap > &displayedFieldsMapSeries, QMap > &displayedFieldsMapStudy, - QMap > &displayedFieldsMapPatient) override; + QMap > &displayedFieldsMapPatient) CTK_OVERRIDE; protected: /// Identifiers of the series that contain instances of which displayed fields are updated in this run. diff --git a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorStudyNumberOfSeriesRule.h b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorStudyNumberOfSeriesRule.h index 2edde43af3..2c2de56ef1 100644 --- a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorStudyNumberOfSeriesRule.h +++ b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorStudyNumberOfSeriesRule.h @@ -37,29 +37,29 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMDisplayedFieldGeneratorStudyNumberOfSeriesRu explicit ctkDICOMDisplayedFieldGeneratorStudyNumberOfSeriesRule(); /// Get name of rule - QString name()const override; + QString name()const CTK_OVERRIDE; /// Clone displayed field generator rule. Override to return a new instance of the rule sub-class - ctkDICOMDisplayedFieldGeneratorAbstractRule* clone() override; + ctkDICOMDisplayedFieldGeneratorAbstractRule* clone() CTK_OVERRIDE; /// Specify list of DICOM tags required by the rule. These tags will be included in the tag cache - QStringList getRequiredDICOMTags() override; + QStringList getRequiredDICOMTags() CTK_OVERRIDE; /// Generate displayed fields for a certain instance based on its cached tags /// The way these generated fields will be used is defined by \sa mergeDisplayedFieldsForInstance void getDisplayedFieldsForInstance( const QMap &cachedTagsForInstance, QMap &displayedFieldsForCurrentSeries, - QMap &displayedFieldsForCurrentStudy, QMap &displayedFieldsForCurrentPatient ) override; + QMap &displayedFieldsForCurrentStudy, QMap &displayedFieldsForCurrentPatient ) CTK_OVERRIDE; /// Start updating displayed fields (reset counters, etc.). No-op by default. - void startUpdate() override; + void startUpdate() CTK_OVERRIDE; /// End updating displayed fields (accumulate stored variables, compute final result, etc.). No-op by default. /// Has a chance to update any field in the series, study, or patient field maps, based on /// the maps themselves or the database. void endUpdate(QMap > &displayedFieldsMapSeries, QMap > &displayedFieldsMapStudy, - QMap > &displayedFieldsMapPatient) override; + QMap > &displayedFieldsMapPatient) CTK_OVERRIDE; protected: /// Identifier of studies that contain instances of which displayed fields are updated in this run. diff --git a/Libs/Widgets/ctkCheckablePushButton.h b/Libs/Widgets/ctkCheckablePushButton.h index ac4d022462..a755c329dd 100644 --- a/Libs/Widgets/ctkCheckablePushButton.h +++ b/Libs/Widgets/ctkCheckablePushButton.h @@ -93,13 +93,13 @@ class CTK_WIDGETS_EXPORT ctkCheckablePushButton : public ctkPushButton protected: /// Reimplemented for internal reasons - void mousePressEvent(QMouseEvent* event) override; + void mousePressEvent(QMouseEvent* event) CTK_OVERRIDE; /// Reimplemented for internal reasons - bool hitButton(const QPoint & pos) const override; + bool hitButton(const QPoint & pos) const CTK_OVERRIDE; /// Reimplemented for internal reasons - void checkStateSet() override; + void checkStateSet() CTK_OVERRIDE; /// Reimplemented for internal reasons - void nextCheckState() override; + void nextCheckState() CTK_OVERRIDE; private: Q_DECLARE_PRIVATE(ctkCheckablePushButton); Q_DISABLE_COPY(ctkCheckablePushButton); diff --git a/Libs/Widgets/ctkPathLineEdit.cpp b/Libs/Widgets/ctkPathLineEdit.cpp index 245fdf2d8b..661a609f5a 100644 --- a/Libs/Widgets/ctkPathLineEdit.cpp +++ b/Libs/Widgets/ctkPathLineEdit.cpp @@ -93,7 +93,7 @@ class ctkFileCompleter : public QCompleter ctkFileCompleter(QObject* o, bool showFiles); // Ensure auto-completed file always uses forward-slash as separator - QString pathFromIndex(const QModelIndex& idx) const override; + QString pathFromIndex(const QModelIndex& idx) const CTK_OVERRIDE; // Helper function for getting the current model casted to QFileSystemModel QFileSystemModel* fileSystemModel() const; From facf245e0997f9f62d9a7fc686dc2cee1b606b6c Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 3 Nov 2021 21:11:22 -0400 Subject: [PATCH 049/115] COMP: Fix Qt4/C++98 build using '> >' instead of '>>' in nested templates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes build errors like the following: /path/to/CTK/Libs/DICOM/Core/ctkDICOMQuery.cpp:243:28: error: ‘>>’ should be ‘> >’ within a nested template argument list QList> ctkDICOMQuery::studyAndSeriesInstanceUIDQueried()const ^ --- Libs/DICOM/Core/ctkDICOMQuery.cpp | 4 ++-- Libs/DICOM/Core/ctkDICOMQuery.h | 4 ++-- Libs/DICOM/Widgets/ctkDICOMQueryRetrieveWidget.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Libs/DICOM/Core/ctkDICOMQuery.cpp b/Libs/DICOM/Core/ctkDICOMQuery.cpp index 2188e31875..73e5da41b3 100644 --- a/Libs/DICOM/Core/ctkDICOMQuery.cpp +++ b/Libs/DICOM/Core/ctkDICOMQuery.cpp @@ -100,7 +100,7 @@ class ctkDICOMQueryPrivate QMap Filters; ctkDICOMQuerySCUPrivate SCU; DcmDataset* Query; - QList> StudyAndSeriesInstanceUIDPairList; + QList< QPair > StudyAndSeriesInstanceUIDPairList; QStringList StudyInstanceUIDList; QList StudyDatasetList; bool Canceled; @@ -240,7 +240,7 @@ QMap ctkDICOMQuery::filters()const } //------------------------------------------------------------------------------ -QList> ctkDICOMQuery::studyAndSeriesInstanceUIDQueried()const +QList< QPair > ctkDICOMQuery::studyAndSeriesInstanceUIDQueried()const { Q_D(const ctkDICOMQuery); return d->StudyAndSeriesInstanceUIDPairList; diff --git a/Libs/DICOM/Core/ctkDICOMQuery.h b/Libs/DICOM/Core/ctkDICOMQuery.h index 8c374ae273..613ac55629 100644 --- a/Libs/DICOM/Core/ctkDICOMQuery.h +++ b/Libs/DICOM/Core/ctkDICOMQuery.h @@ -44,7 +44,7 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMQuery : public QObject Q_PROPERTY(QString host READ host WRITE setHost); Q_PROPERTY(int port READ port WRITE setPort); Q_PROPERTY(bool preferCGET READ preferCGET WRITE setPreferCGET); - Q_PROPERTY(QList> studyAndSeriesInstanceUIDQueried READ studyAndSeriesInstanceUIDQueried); + Q_PROPERTY(QList< QPair > studyAndSeriesInstanceUIDQueried READ studyAndSeriesInstanceUIDQueried); Q_PROPERTY(QMap filters READ filters WRITE setFilters); public: @@ -76,7 +76,7 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMQuery : public QObject Q_INVOKABLE bool query(ctkDICOMDatabase& database); /// Access the list of study and series instance UIDs from the last query - QList> studyAndSeriesInstanceUIDQueried()const; + QList< QPair > studyAndSeriesInstanceUIDQueried()const; /// /// Filters are keyword/value pairs as generated by diff --git a/Libs/DICOM/Widgets/ctkDICOMQueryRetrieveWidget.cpp b/Libs/DICOM/Widgets/ctkDICOMQueryRetrieveWidget.cpp index 372ce70e02..a2d1f386bb 100644 --- a/Libs/DICOM/Widgets/ctkDICOMQueryRetrieveWidget.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMQueryRetrieveWidget.cpp @@ -62,7 +62,7 @@ class ctkDICOMQueryRetrieveWidgetPrivate: public Ui_ctkDICOMQueryRetrieveWidget QMap QueriesByServer; QMap QueriesByStudyUID; - std::list> StudyAndSeriesInstanceUIDPairList; + std::list< std::pair > StudyAndSeriesInstanceUIDPairList; QMap RetrievalsByStudyUID; ctkDICOMDatabase QueryResultDatabase; QSharedPointer RetrieveDatabase; From e51d3b7ee0ba179261fc63b945c0cac0b0741c32 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 3 Nov 2021 22:55:39 -0400 Subject: [PATCH 050/115] COMP: Update ctkWrapPythonQt script to consider CTK_NULLPTR --- CMake/ctkWrapPythonQt.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMake/ctkWrapPythonQt.py b/CMake/ctkWrapPythonQt.py index 37c43a78a2..21a44c08a3 100644 --- a/CMake/ctkWrapPythonQt.py +++ b/CMake/ctkWrapPythonQt.py @@ -103,7 +103,7 @@ def ctk_wrap_pythonqt(target, namespace, output_dir, input_files, extra_verbose) # my_class(QObject* newParent ...) # my_class(QWidget* newParent ...) # Constructor with either QWidget or QObject as first parameter - regex = r"[^~]%s[\s\n]*\([\s\n]*((QObject|QWidget)[\s\n]*\*[\s\n]*\w+[\s\n]*(\=[\s\n]*(0|NULL|nullptr)|,.*\=.*\)|\)|\)))" % className + regex = r"[^~]%s[\s\n]*\([\s\n]*((QObject|QWidget)[\s\n]*\*[\s\n]*\w+[\s\n]*(\=[\s\n]*(0|NULL|nullptr|CTK\_NULLPTR)|,.*\=.*\)|\)|\)))" % className res = re.search(regex, content, re.MULTILINE) if res is None: if extra_verbose: @@ -112,7 +112,7 @@ def ctk_wrap_pythonqt(target, namespace, output_dir, input_files, extra_verbose) # Skip wrapping if object has a virtual pure method # "x3b" is the unicode for semicolon - regex = r"virtual[\w\n\s\*\(\)]+\=[\s\n]*(0|NULL|nullptr)[\s\n]*\x3b" + regex = r"virtual[\w\n\s\*\(\)]+\=[\s\n]*(0|NULL|nullptr|CTK\_NULLPTR)[\s\n]*\x3b" res = re.search(regex, content, re.MULTILINE) if res is not None: if extra_verbose: @@ -131,7 +131,7 @@ def ctk_wrap_pythonqt(target, namespace, output_dir, input_files, extra_verbose) if parentClassName is None: # Does constructor signature is of the form: myclass(QObject * parent ...) - regex = r"%s[\s\n]*\([\s\n]*QObject[\s\n]*\*[\s\n]*\w+[\s\n]*(\=[\s\n]*(0|NULL|nullptr)|,.*\=.*\)|\))" % className + regex = r"%s[\s\n]*\([\s\n]*QObject[\s\n]*\*[\s\n]*\w+[\s\n]*(\=[\s\n]*(0|NULL|nullptr|CTK\_NULLPTR)|,.*\=.*\)|\))" % className res = re.search(regex, content, re.MULTILINE) if res is not None: parentClassName = "QObject" @@ -140,7 +140,7 @@ def ctk_wrap_pythonqt(target, namespace, output_dir, input_files, extra_verbose) if parentClassName is None: # Does constructor signature is of the form: myclass(QWidget * parent ...) - regex = r"%s[\s\n]*\([\s\n]*QWidget[\s\n]*\*[\s\n]*\w+[\s\n]*(\=[\s\n]*(0|NULL|nullptr)|,.*\=.*\)|\))" % className + regex = r"%s[\s\n]*\([\s\n]*QWidget[\s\n]*\*[\s\n]*\w+[\s\n]*(\=[\s\n]*(0|NULL|nullptr|CTK\_NULLPTR)|,.*\=.*\)|\))" % className res = re.search(regex, content, re.MULTILINE) if res is not None: parentClassName = "QWidget" From b12415ea257d8d74e5cd6de49fe4caaf77ccf696 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 3 Nov 2021 22:37:33 -0400 Subject: [PATCH 051/115] COMP: Fix Qt4/C++98 build using CTK_NULLPTR instead of nullptr --- Libs/DICOM/Core/ctkDICOMDatabase.cpp | 2 +- Libs/DICOM/Core/ctkDICOMDatabase.h | 4 ++-- Libs/DICOM/Core/ctkDICOMDisplayedFieldGenerator.cpp | 2 +- .../DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.cpp | 4 ++-- Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.h | 2 +- Libs/DICOM/Core/ctkDICOMIndexer.cpp | 4 ++-- Libs/DICOM/Widgets/ctkDICOMTableView.cpp | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Libs/DICOM/Core/ctkDICOMDatabase.cpp b/Libs/DICOM/Core/ctkDICOMDatabase.cpp index ee0300b80b..fb5d405096 100644 --- a/Libs/DICOM/Core/ctkDICOMDatabase.cpp +++ b/Libs/DICOM/Core/ctkDICOMDatabase.cpp @@ -78,7 +78,7 @@ ctkDICOMDatabasePrivate::ctkDICOMDatabasePrivate(ctkDICOMDatabase& o) , LoggedExecVerbose(false) , DisplayedFieldsTableAvailable(false) , UseShortStoragePath(true) - , ThumbnailGenerator(nullptr) + , ThumbnailGenerator(CTK_NULLPTR) , TagCacheVerified(false) , SchemaVersion("0.7.0") { diff --git a/Libs/DICOM/Core/ctkDICOMDatabase.h b/Libs/DICOM/Core/ctkDICOMDatabase.h index 98ce3aa369..491f6fe316 100644 --- a/Libs/DICOM/Core/ctkDICOMDatabase.h +++ b/Libs/DICOM/Core/ctkDICOMDatabase.h @@ -136,7 +136,7 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMDatabase : public QObject /// \return true if schema was updated Q_INVOKABLE bool updateSchema( const char* schemaFile = ctkDICOMDatabase::defaultSchemaFile(), - const char* newDatabaseDir = nullptr); + const char* newDatabaseDir = CTK_NULLPTR); /// Update the database schema only if the versions don't match /// \param schemaFile SQL file containing schema definition @@ -147,7 +147,7 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMDatabase : public QObject /// \return true if schema was updated Q_INVOKABLE bool updateSchemaIfNeeded( const char* schemaFile = ctkDICOMDatabase::defaultSchemaFile(), - const char* newDatabaseDir = nullptr); + const char* newDatabaseDir = CTK_NULLPTR); /// Return the schema version needed by the current version of this code Q_INVOKABLE QString schemaVersion(); diff --git a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGenerator.cpp b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGenerator.cpp index f86fd05e3e..143e5e595f 100644 --- a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGenerator.cpp +++ b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGenerator.cpp @@ -40,7 +40,7 @@ static ctkLogger logger("org.commontk.dicom.DICOMDisplayedFieldGenerator" ); //------------------------------------------------------------------------------ ctkDICOMDisplayedFieldGeneratorPrivate::ctkDICOMDisplayedFieldGeneratorPrivate(ctkDICOMDisplayedFieldGenerator& o) : q_ptr(&o) - , Database(nullptr) + , Database(CTK_NULLPTR) { } diff --git a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.cpp b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.cpp index e1513c7d0b..dafe33f99c 100644 --- a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.cpp +++ b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.cpp @@ -34,7 +34,7 @@ #include //---------------------------------------------------------------------------- -ctkDICOMDisplayedFieldGeneratorRuleFactory *ctkDICOMDisplayedFieldGeneratorRuleFactory::Instance = nullptr; +ctkDICOMDisplayedFieldGeneratorRuleFactory *ctkDICOMDisplayedFieldGeneratorRuleFactory::Instance = CTK_NULLPTR; //---------------------------------------------------------------------------- class ctkDICOMDisplayedFieldGeneratorRuleFactoryCleanup @@ -88,7 +88,7 @@ void ctkDICOMDisplayedFieldGeneratorRuleFactory::cleanup() if (ctkDICOMDisplayedFieldGeneratorRuleFactory::Instance) { delete ctkDICOMDisplayedFieldGeneratorRuleFactory::Instance; - ctkDICOMDisplayedFieldGeneratorRuleFactory::Instance = nullptr; + ctkDICOMDisplayedFieldGeneratorRuleFactory::Instance = CTK_NULLPTR; } } diff --git a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.h b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.h index e20f6ecdf8..3472fe71d4 100644 --- a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.h +++ b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.h @@ -69,7 +69,7 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMDisplayedFieldGeneratorRuleFactory : public static void cleanup(); private: - ctkDICOMDisplayedFieldGeneratorRuleFactory(QObject* parent=nullptr); + ctkDICOMDisplayedFieldGeneratorRuleFactory(QObject* parent=CTK_NULLPTR); ~ctkDICOMDisplayedFieldGeneratorRuleFactory() CTK_OVERRIDE; Q_DISABLE_COPY(ctkDICOMDisplayedFieldGeneratorRuleFactory); diff --git a/Libs/DICOM/Core/ctkDICOMIndexer.cpp b/Libs/DICOM/Core/ctkDICOMIndexer.cpp index 7304150b32..c4aef5f0d0 100644 --- a/Libs/DICOM/Core/ctkDICOMIndexer.cpp +++ b/Libs/DICOM/Core/ctkDICOMIndexer.cpp @@ -290,7 +290,7 @@ void ctkDICOMIndexerPrivateWorker::writeIndexingResultsToDatabase(ctkDICOMDataba //------------------------------------------------------------------------------ ctkDICOMIndexerPrivate::ctkDICOMIndexerPrivate(ctkDICOMIndexer& o) : q_ptr(&o) - , Database(nullptr) + , Database(CTK_NULLPTR) , BackgroundImportEnabled(false) , FollowSymlinks(true) { @@ -317,7 +317,7 @@ ctkDICOMIndexerPrivate::~ctkDICOMIndexerPrivate() this->RequestQueue.setStopRequested(true); this->WorkerThread.quit(); this->WorkerThread.wait(); - q->setDatabase(nullptr); + q->setDatabase(CTK_NULLPTR); } //------------------------------------------------------------------------------ diff --git a/Libs/DICOM/Widgets/ctkDICOMTableView.cpp b/Libs/DICOM/Widgets/ctkDICOMTableView.cpp index e571237427..b2df3f33f0 100644 --- a/Libs/DICOM/Widgets/ctkDICOMTableView.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMTableView.cpp @@ -638,7 +638,7 @@ bool ctkDICOMTableView::eventFilter(QObject *obj, QEvent *event) { QKeyEvent* keyEvent = static_cast(event); QAbstractItemModel* itemModel = d->tblDicomDatabaseView->model(); - if (keyEvent != nullptr && itemModel->rowCount() > 0) + if (keyEvent != CTK_NULLPTR && itemModel->rowCount() > 0) { if (keyEvent->key() == Qt::Key_Home) { From 388a013b890468b2be1b82c5af17f9c15db68dd3 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 3 Nov 2021 22:44:40 -0400 Subject: [PATCH 052/115] COMP: Fix Qt4/C++98 ctkDICOMBrowser build error using ctk::isDirEmpty The function "QDir::isEmpty" was introduced in Qt 5.9. --- Libs/DICOM/Widgets/ctkDICOMBrowser.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp b/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp index 07ce251447..e5e54a1dc1 100644 --- a/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp @@ -49,6 +49,7 @@ #include "ctkDirectoryButton.h" #include "ctkFileDialog.h" #include "ctkMessageBox.h" +#include "ctkUtils.h" // For ctk::isDirEmpty // ctkDICOMCore includes #include "ctkDICOMDatabase.h" @@ -521,7 +522,7 @@ void ctkDICOMBrowser::createNewDatabaseDirectory() { // only use existing folder name as a basis if it is empty or // a valid database - if (!QDir(baseFolder).isEmpty()) + if (!ctk::isDirEmpty(QDir(baseFolder))) { QString databaseFileName = QDir(baseFolder).filePath("ctkDICOM.sql"); if (!QFile(databaseFileName).exists()) @@ -568,7 +569,7 @@ void ctkDICOMBrowser::createNewDatabaseDirectory() continue; } } - if (!QDir(newFolder).isEmpty()) + if (!ctk::isDirEmpty(QDir(newFolder))) { continue; } @@ -631,7 +632,7 @@ void ctkDICOMBrowser::setDatabaseDirectory(const QString& directory) bool success = true; if (!QDir(absDirectory).exists() - || (!QDir(absDirectory).isEmpty() && !QFile(databaseFileName).exists())) + || (!ctk::isDirEmpty(QDir(absDirectory)) && !QFile(databaseFileName).exists())) { std::cerr << "Database folder does not contain ctkDICOM.sql file: " << qPrintable(absDirectory) << "\n"; d->DatabaseDirectoryProblemFrame->show(); From aec1edb456a701d21aa096ad0f5d109298dd7a98 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 3 Nov 2021 22:46:58 -0400 Subject: [PATCH 053/115] COMP: Fix Qt4/C++98 build using explicit trivial destructor implementation --- Libs/DICOM/Core/ctkDICOMDisplayedFieldGenerator.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGenerator.cpp b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGenerator.cpp index 143e5e595f..ff1b6710a0 100644 --- a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGenerator.cpp +++ b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGenerator.cpp @@ -45,7 +45,9 @@ ctkDICOMDisplayedFieldGeneratorPrivate::ctkDICOMDisplayedFieldGeneratorPrivate(c } //------------------------------------------------------------------------------ -ctkDICOMDisplayedFieldGeneratorPrivate::~ctkDICOMDisplayedFieldGeneratorPrivate() = default; +ctkDICOMDisplayedFieldGeneratorPrivate::~ctkDICOMDisplayedFieldGeneratorPrivate() +{ +} //------------------------------------------------------------------------------ void ctkDICOMDisplayedFieldGeneratorPrivate::setupEnabledDisplayedFieldGeneratorRules() From 69962755f919f08e67a5a15ee105c6a9dd05e476 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 3 Nov 2021 22:51:16 -0400 Subject: [PATCH 054/115] COMP: Fix Qt4 ctkDICOMQuery build error simplifying setting of Q_PROPERTY See https://stackoverflow.com/questions/12689162/qt-q-property-with-template-accessors --- Libs/DICOM/Core/ctkDICOMQuery.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Libs/DICOM/Core/ctkDICOMQuery.h b/Libs/DICOM/Core/ctkDICOMQuery.h index 613ac55629..ad8ab12ab2 100644 --- a/Libs/DICOM/Core/ctkDICOMQuery.h +++ b/Libs/DICOM/Core/ctkDICOMQuery.h @@ -44,8 +44,13 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMQuery : public QObject Q_PROPERTY(QString host READ host WRITE setHost); Q_PROPERTY(int port READ port WRITE setPort); Q_PROPERTY(bool preferCGET READ preferCGET WRITE setPreferCGET); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) Q_PROPERTY(QList< QPair > studyAndSeriesInstanceUIDQueried READ studyAndSeriesInstanceUIDQueried); Q_PROPERTY(QMap filters READ filters WRITE setFilters); +#else + Q_PROPERTY(QList studyAndSeriesInstanceUIDQueried READ studyAndSeriesInstanceUIDQueried); + Q_PROPERTY(QMap filters READ filters WRITE setFilters); +#endif public: explicit ctkDICOMQuery(QObject* parent = 0); From 0f3c87eaccd7c7bb3d4d7ff803f73e91907aea88 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 3 Nov 2021 22:52:20 -0400 Subject: [PATCH 055/115] COMP: Fix Qt4/C++98 build of DICOMCore using Q_FOREACH --- Libs/DICOM/Core/Testing/Cpp/ctkDICOMRetrieveTest2.cpp | 3 ++- .../DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.cpp | 4 ++-- Libs/DICOM/Core/ctkDICOMQuery.cpp | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Libs/DICOM/Core/Testing/Cpp/ctkDICOMRetrieveTest2.cpp b/Libs/DICOM/Core/Testing/Cpp/ctkDICOMRetrieveTest2.cpp index bb3ae2be24..a854324f6d 100644 --- a/Libs/DICOM/Core/Testing/Cpp/ctkDICOMRetrieveTest2.cpp +++ b/Libs/DICOM/Core/Testing/Cpp/ctkDICOMRetrieveTest2.cpp @@ -97,7 +97,8 @@ int ctkDICOMRetrieveTest2( int argc, char * argv [] ) retrieve.setDatabase(retrieveDatabase); std::cerr << "ctkDICOMRetrieveTest2: Retrieving\n"; - foreach(auto studyAndSeriesInstanceUID, query.studyAndSeriesInstanceUIDQueried()) + typedef QPair StudyAndSeriesInstanceUIDPair; + Q_FOREACH(const StudyAndSeriesInstanceUIDPair& studyAndSeriesInstanceUID, query.studyAndSeriesInstanceUIDQueried()) { std::cerr << "ctkDICOMRetrieveTest2: Retrieving " << studyAndSeriesInstanceUID.first.toStdString() << "\n"; bool res = retrieve.moveStudy(studyAndSeriesInstanceUID.first); diff --git a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.cpp b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.cpp index dafe33f99c..490a311e0f 100644 --- a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.cpp +++ b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.cpp @@ -102,7 +102,7 @@ ctkDICOMDisplayedFieldGeneratorRuleFactory::ctkDICOMDisplayedFieldGeneratorRuleF //----------------------------------------------------------------------------- ctkDICOMDisplayedFieldGeneratorRuleFactory::~ctkDICOMDisplayedFieldGeneratorRuleFactory() { - foreach(auto rule, this->DisplayedFieldGeneratorRules) + Q_FOREACH(ctkDICOMDisplayedFieldGeneratorAbstractRule* rule, this->DisplayedFieldGeneratorRules) { delete rule; } @@ -126,7 +126,7 @@ bool ctkDICOMDisplayedFieldGeneratorRuleFactory::registerDisplayedFieldGenerator } // Check for already registered rule - foreach(auto ®isteredRule, this->DisplayedFieldGeneratorRules) + Q_FOREACH(ctkDICOMDisplayedFieldGeneratorAbstractRule* registeredRule, this->DisplayedFieldGeneratorRules) { if (registeredRule->name() == rule->name()) { diff --git a/Libs/DICOM/Core/ctkDICOMQuery.cpp b/Libs/DICOM/Core/ctkDICOMQuery.cpp index 73e5da41b3..c8b0f6c914 100644 --- a/Libs/DICOM/Core/ctkDICOMQuery.cpp +++ b/Libs/DICOM/Core/ctkDICOMQuery.cpp @@ -464,7 +464,7 @@ bool ctkDICOMQuery::query(ctkDICOMDatabase& database ) int i = 0; QListIterator datasetIterator(d->StudyDatasetList); - for (const auto & StudyInstanceUID : d->StudyInstanceUIDList ) + Q_FOREACH(const QString & StudyInstanceUID, d->StudyInstanceUIDList ) { DcmDataset *studyDataset = datasetIterator.next(); DcmElement *patientName, *patientID; From 7bb0d9fdbf0d6ddd9e470344fc899f8a1e7651a8 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 3 Nov 2021 22:53:00 -0400 Subject: [PATCH 056/115] COMP: Fix Qt4/C++98 ctkDICOMIndexerPrivate build using literal signal/slot --- Libs/DICOM/Core/ctkDICOMIndexer.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Libs/DICOM/Core/ctkDICOMIndexer.cpp b/Libs/DICOM/Core/ctkDICOMIndexer.cpp index c4aef5f0d0..9d255c0273 100644 --- a/Libs/DICOM/Core/ctkDICOMIndexer.cpp +++ b/Libs/DICOM/Core/ctkDICOMIndexer.cpp @@ -297,15 +297,15 @@ ctkDICOMIndexerPrivate::ctkDICOMIndexerPrivate(ctkDICOMIndexer& o) ctkDICOMIndexerPrivateWorker* worker = new ctkDICOMIndexerPrivateWorker(&this->RequestQueue); worker->moveToThread(&this->WorkerThread); - connect(&this->WorkerThread, &QThread::finished, worker, &QObject::deleteLater); - connect(this, &ctkDICOMIndexerPrivate::startWorker, worker, &ctkDICOMIndexerPrivateWorker::start); + connect(&this->WorkerThread, SIGNAL("finished()"), worker, SLOT("deleteLater()")); + connect(this, SIGNAL("startWorker()"), worker, SLOT("start()")); // Progress report - connect(worker, &ctkDICOMIndexerPrivateWorker::progress, q_ptr, &ctkDICOMIndexer::progress); - connect(worker, &ctkDICOMIndexerPrivateWorker::progressDetail, q_ptr, &ctkDICOMIndexer::progressDetail); - connect(worker, &ctkDICOMIndexerPrivateWorker::progressStep, q_ptr, &ctkDICOMIndexer::progressStep); - connect(worker, &ctkDICOMIndexerPrivateWorker::updatingDatabase, q_ptr, &ctkDICOMIndexer::updatingDatabase); - connect(worker, &ctkDICOMIndexerPrivateWorker::indexingComplete, q_ptr, &ctkDICOMIndexer::indexingComplete); + connect(worker, SIGNAL("progress(int)"), q_ptr, SLOT("progress(int)")); + connect(worker, SIGNAL("progressDetail(QString)"), q_ptr, SLOT("progressDetail(QString)")); + connect(worker, SIGNAL("progressStep(QString)"), q_ptr, SLOT("progressStep(QString)")); + connect(worker, SIGNAL("updatingDatabase(bool)"), q_ptr, SLOT("updatingDatabase(bool)")); + connect(worker, SIGNAL("indexingComplete(int,int,int,int)"), q_ptr, SLOT("indexingComplete(int,int,int,int)")); this->WorkerThread.start(); } @@ -653,10 +653,10 @@ void ctkDICOMIndexer::waitForImportFinished(int msecTimeout /*=-1*/) QTimer timer; timer.setSingleShot(true); QEventLoop loop; - connect(this, &ctkDICOMIndexer::indexingComplete, &loop, &QEventLoop::quit); + connect(this, SIGNAL("indexingComplete(int,int,int,int)"), &loop, SLOT("quit()")); if (msecTimeout >= 0) { - connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit); + connect(&timer, SIGNAL("timeout()"), &loop, SLOT("quit()")); timer.start(msecTimeout); } if (!this->isImporting()) From a4c75f323723ef63b78dc9a9f4c690ff70ef707f Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 3 Nov 2021 23:40:41 -0400 Subject: [PATCH 057/115] COMP: Fix Qt4/C++98 ctkDICOMTableView build error due to missing QJsonObject This commit exclude the parsing of "formatForField" and instead reported the warning indicating that the specified format string failed to be decoded from json. --- Libs/DICOM/Widgets/ctkDICOMTableView.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Libs/DICOM/Widgets/ctkDICOMTableView.cpp b/Libs/DICOM/Widgets/ctkDICOMTableView.cpp index b2df3f33f0..fa3ef45271 100644 --- a/Libs/DICOM/Widgets/ctkDICOMTableView.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMTableView.cpp @@ -23,7 +23,9 @@ #include "ui_ctkDICOMTableView.h" // Qt includes +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) #include +#endif #include #include #include @@ -258,6 +260,7 @@ void ctkDICOMTableViewPrivate::applyColumnProperties() QHeaderView::ResizeMode columnResizeMode = QHeaderView::Interactive; if (!fieldFormat.isEmpty()) { +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) QJsonDocument fieldFormatDoc = QJsonDocument::fromJson(fieldFormat.toUtf8()); QJsonObject fieldFormatObj; if (!fieldFormatDoc.isNull()) @@ -311,6 +314,7 @@ void ctkDICOMTableViewPrivate::applyColumnProperties() } else +#endif { // format string is specified but failed to be decoded from json qWarning() << "Invalid ColumnDisplayProperties Format string for column " << columnName << ": " << fieldFormat; From 37de39f33b80ac797e5b4a6a6e173861c63a5cac Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 3 Nov 2021 23:41:08 -0400 Subject: [PATCH 058/115] COMP: Fix Qt4 ctkDICOMTableView build error using setResizeMode --- Libs/DICOM/Widgets/ctkDICOMTableView.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Libs/DICOM/Widgets/ctkDICOMTableView.cpp b/Libs/DICOM/Widgets/ctkDICOMTableView.cpp index fa3ef45271..069d3f2199 100644 --- a/Libs/DICOM/Widgets/ctkDICOMTableView.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMTableView.cpp @@ -320,7 +320,12 @@ void ctkDICOMTableViewPrivate::applyColumnProperties() qWarning() << "Invalid ColumnDisplayProperties Format string for column " << columnName << ": " << fieldFormat; } } +#if QT_VERSION < QT_VERSION_CHECK(5,0,0) + this->tblDicomDatabaseView->horizontalHeader()->setResizeMode(col, columnResizeMode); +#else this->tblDicomDatabaseView->horizontalHeader()->setSectionResizeMode(col, columnResizeMode); +#endif + if (columnResizeMode == QHeaderView::Stretch && visibility) { stretchedColumnFound = true; From 4ddf1ab12b930dfaf3e124a7d4f5e902c0ce7eae Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 3 Nov 2021 23:41:41 -0400 Subject: [PATCH 059/115] COMP: Fix Qt4 ctkDICOMBrowser build error using QStringLiteral --- Libs/DICOM/Widgets/ctkDICOMBrowser.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp b/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp index e5e54a1dc1..7619faba76 100644 --- a/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp @@ -1450,7 +1450,11 @@ void ctkDICOMBrowser::exportSeries(QString dirPath, QStringList uids) foreach (const QString& filePath, filesForSeries) { // File name example: my/destination/folder/000001.dcm +#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) QString destinationFileName = QStringLiteral("%1%2.dcm").arg(destinationDir).arg(fileNumber, 6, 10, QLatin1Char('0')); +#else + QString destinationFileName = QString("%1%2.dcm").arg(destinationDir).arg(fileNumber, 6, 10, QLatin1Char('0')); +#endif if (!QFile::exists(filePath)) { From 89b57628da4daf067a414d444fe7b066bdc13a8f Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 4 Nov 2021 12:21:36 -0400 Subject: [PATCH 060/115] COMP: Fix Qt4/C++98 ctkDICOMBrowser and ctkDICOMTableView This commit updates the implementation to account for changes introduced in PR #1002 (ENH: Add API to select items in the DICOM browser) --- Libs/DICOM/Widgets/ctkDICOMBrowser.cpp | 4 ++-- Libs/DICOM/Widgets/ctkDICOMTableView.cpp | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp b/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp index 7619faba76..ba809881e4 100644 --- a/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp @@ -1820,7 +1820,7 @@ void ctkDICOMBrowser::setSelectedItems(ctkDICOMModel::IndexType level, QStringLi // Select parent patient to make sure the requested studies // are listed in the study table QStringList patientUids; - for (const QString& uid : uids) + Q_FOREACH (const QString& uid, uids) { QString patientUid = d->DICOMDatabase->patientForStudy(uid); if (!patientUids.contains(patientUid)) @@ -1837,7 +1837,7 @@ void ctkDICOMBrowser::setSelectedItems(ctkDICOMModel::IndexType level, QStringLi // Select parent patients and studies to make sure the requested series // are listed in the series table QStringList studyUids; - for (const QString& uid : uids) + Q_FOREACH (const QString& uid, uids) { QString studyUid = d->DICOMDatabase->studyForSeries(uid); if (!studyUids.contains(studyUid)) diff --git a/Libs/DICOM/Widgets/ctkDICOMTableView.cpp b/Libs/DICOM/Widgets/ctkDICOMTableView.cpp index 069d3f2199..240aa3d8a4 100644 --- a/Libs/DICOM/Widgets/ctkDICOMTableView.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMTableView.cpp @@ -908,8 +908,13 @@ void ctkDICOMTableView::setCurrentSelection(const QStringList& uids) continue; } QItemSelectionModel::QItemSelectionModel::SelectionFlags flags = QFlags(); +#if QT_VERSION >= QT_VERSION_CHECK(5,7,0) flags.setFlag(needToSelect ? QItemSelectionModel::Select : QItemSelectionModel::Deselect); flags.setFlag(QItemSelectionModel::Rows); +#else + flags = flags | (needToSelect ? QItemSelectionModel::Select : QItemSelectionModel::Deselect); + flags = flags | QItemSelectionModel::Rows; +#endif d->tblDicomDatabaseView->selectionModel()->select(index, flags); } } From 25d72a2487b44086dae875bb4f0b76ec58055950 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 3 Nov 2022 00:04:12 -0400 Subject: [PATCH 061/115] COMP: Update ITK to support building against C++98 Conditionally select ITK version based on selected CMAKE_CXX_STANDARD. If CMAKE_CXX_STANDARD is C++98, set revision tag to v4.13.3 as it is the latest version supporting it. --- CMakeExternals/ITK.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeExternals/ITK.cmake b/CMakeExternals/ITK.cmake index 8e163b6db2..b40d1deb86 100644 --- a/CMakeExternals/ITK.cmake +++ b/CMakeExternals/ITK.cmake @@ -29,10 +29,15 @@ endif() if(NOT DEFINED ITK_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}) - set(revision_tag "v5.1.2") + if("${CMAKE_CXX_STANDARD}" STREQUAL "98") + set(revision_tag "v4.13.3") + else() + set(revision_tag "v5.1.2") + endif() if(${proj}_REVISION_TAG) set(revision_tag ${${proj}_REVISION_TAG}) endif() + ExternalProject_Message(${proj} "${proj}[revision_tag:${revision_tag}]") set(location_args ) if(${proj}_URL) From 97ac8f9b6379382efaa8fbc4a122eec416cafdde Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 3 Nov 2022 01:42:57 -0400 Subject: [PATCH 062/115] COMP: Update ctkVTKMagnifyViewTest1 to support building against VTK >= 8.90 Adapted from CTK@48e4a3f38 (COMP: Add support for building against VTK >= 8.90) --- .../VTK/Widgets/Testing/Cpp/ctkVTKMagnifyViewTest1.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKMagnifyViewTest1.cpp b/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKMagnifyViewTest1.cpp index c0447619cc..f0d11dfb3e 100644 --- a/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKMagnifyViewTest1.cpp +++ b/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKMagnifyViewTest1.cpp @@ -36,6 +36,7 @@ #include #include #include +#include // STD includes #include @@ -119,11 +120,19 @@ int ctkVTKMagnifyViewTest1(int argc, char * argv [] ) #if CTK_USE_QVTKOPENGLWIDGET vtkSmartPointer renderWindow = vtkSmartPointer::New(); +# if VTK_MAJOR_VERSION >= 9 || (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 90) widget->setRenderWindow(renderWindow); +# else + widget->SetRenderWindow(renderWindow); +# endif #endif vtkNew renderer; +#if VTK_MAJOR_VERSION >= 9 || (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 90) widget->renderWindow()->AddRenderer(renderer.GetPointer()); +#else + widget->GetRenderWindow()->AddRenderer(renderer.GetPointer()); +#endif double gray = static_cast(i) / (numVTKWidgets-1); renderer->SetBackground( gray, gray, gray); renderer->SetBackground2( 0., 0., 1.); From a15885bb737f43174f45afddbccbce8bdaac8005 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 3 Nov 2022 01:51:31 -0400 Subject: [PATCH 063/115] COMP: Update ctkVTKOpenGLNativeWidget to fix build against VTK 8 This commit re-introduces the QVTKWidget implementation inadvertently removed in 48e4a3f38 (COMP: Add support for building against VTK >= 8.90). --- .../VTK/Widgets/ctkVTKOpenGLNativeWidget.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKOpenGLNativeWidget.h b/Libs/Visualization/VTK/Widgets/ctkVTKOpenGLNativeWidget.h index 2950924666..0629c953f9 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKOpenGLNativeWidget.h +++ b/Libs/Visualization/VTK/Widgets/ctkVTKOpenGLNativeWidget.h @@ -58,6 +58,17 @@ class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKOpenGLNativeWidget : public QVT Q_DISABLE_COPY(ctkVTKOpenGLNativeWidget); }; # endif +#else +class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKOpenGLNativeWidget : public QVTKWidget +{ + Q_OBJECT +public: + typedef QVTKWidget Superclass; + explicit ctkVTKOpenGLNativeWidget(QWidget* parent = 0) : Superclass(parent){} + virtual ~ctkVTKOpenGLNativeWidget(){} +private: + Q_DISABLE_COPY(ctkVTKOpenGLNativeWidget); +}; #endif #endif From dcb37e8ada29768ca54a0f601ba5e8f7bb418b79 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 3 Nov 2022 02:26:43 -0400 Subject: [PATCH 064/115] COMP: Update ctkVTKChartView to fix build against VTK 8 This commit fixes a regression introduced in 58f403881 (ENH: Add access to render window in ctkVTKChartView) --- Libs/Visualization/VTK/Widgets/ctkVTKChartView.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKChartView.cpp b/Libs/Visualization/VTK/Widgets/ctkVTKChartView.cpp index b79f905515..0038ec0ed8 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKChartView.cpp +++ b/Libs/Visualization/VTK/Widgets/ctkVTKChartView.cpp @@ -189,7 +189,16 @@ void ctkVTKChartViewPrivate::chartBounds(double* bounds)const // ---------------------------------------------------------------------------- // ctkVTKChartView methods -CTK_GET_CPP(ctkVTKChartView, vtkRenderWindow*, renderWindow, RenderWindow); +// ---------------------------------------------------------------------------- +vtkRenderWindow* ctkVTKChartView::renderWindow()const +{ +#ifdef CTK_USE_QVTKOPENGLWIDGET + Q_D(const ctkVTKChartView); + return d->RenderWindow; +#else + return const_cast(this)->GetRenderWindow(); +#endif +} // ---------------------------------------------------------------------------- ctkVTKChartView::ctkVTKChartView(QWidget* parentWidget) From bdb4df0a12a9320ddb579c8f507597eb2dc1b942 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 3 Nov 2022 00:01:32 -0400 Subject: [PATCH 065/115] COMP: Update external projects to consistently display revision_tag --- CMakeExternals/QtTesting.cmake | 1 + CMakeExternals/VTK.cmake | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeExternals/QtTesting.cmake b/CMakeExternals/QtTesting.cmake index a0e3f3ae56..cd9c97c127 100644 --- a/CMakeExternals/QtTesting.cmake +++ b/CMakeExternals/QtTesting.cmake @@ -32,6 +32,7 @@ if(NOT DEFINED QtTesting_DIR) if(${proj}_REVISION_TAG) set(revision_tag ${${proj}_REVISION_TAG}) endif() + ExternalProject_Message(${proj} "${proj}[revision_tag:${revision_tag}]") set(location_args ) if(${proj}_URL) diff --git a/CMakeExternals/VTK.cmake b/CMakeExternals/VTK.cmake index 5f344a718f..5ac851910e 100644 --- a/CMakeExternals/VTK.cmake +++ b/CMakeExternals/VTK.cmake @@ -49,7 +49,7 @@ if(NOT DEFINED VTK_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}) if(${proj}_REVISION_TAG) set(revision_tag ${${proj}_REVISION_TAG}) endif() - ExternalProject_Message(${proj} "VTK[revision_tag:${revision_tag}]") + ExternalProject_Message(${proj} "${proj}[revision_tag:${revision_tag}]") set(location_args ) if(${proj}_URL) From 23a0f881642f4e02d38da490f64b88dfca6ac51b Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 12 Apr 2023 22:43:15 -0400 Subject: [PATCH 066/115] COMP: Update (qImageToVTK|qImageTo)VTKImageData to fix build against VTK8/Qt4 This commit fixes a regression introduced in 0a1f9c13c (ENH: Add qImageToVTKImageData to ctkVTKWidgetsUtils) by reporting a warning if a 4-component image is being converted. --- .../Cpp/ctkVTKWidgetsUtilsTestImageConversion.cpp | 15 ++++++++------- .../VTK/Widgets/ctkVTKWidgetsUtils.cpp | 7 +++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKWidgetsUtilsTestImageConversion.cpp b/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKWidgetsUtilsTestImageConversion.cpp index 47cad13051..6193b4c828 100644 --- a/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKWidgetsUtilsTestImageConversion.cpp +++ b/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKWidgetsUtilsTestImageConversion.cpp @@ -38,6 +38,7 @@ // VTK includes #include "vtkImageData.h" +#include "vtkNew.h" // STD includes #include @@ -72,7 +73,7 @@ int ctkVTKWidgetsUtilsTestImageConversion(int argc, char * argv [] ) ////////////////////////////////////// // force alpha channel (default) - RGBA input - ctk::qImageToVTKImageData(someQImage, someVtkImage); + ctk::qImageToVTKImageData(someQImage, someVtkImage.GetPointer()); if (someVtkImage->GetDimensions()[0] != someQImage.size().width() || someVtkImage->GetDimensions()[1] != someQImage.size().height()) { @@ -102,7 +103,7 @@ int ctkVTKWidgetsUtilsTestImageConversion(int argc, char * argv [] ) } // do not force alpha channel - RGBA input - ctk::qImageToVTKImageData(someQImage, someVtkImage, false); + ctk::qImageToVTKImageData(someQImage, someVtkImage.GetPointer(), false); if (someVtkImage->GetNumberOfScalarComponents() != 4) { std::cout << "qImageToVTKImageData expected 4 scalar components for RGBA input + alpha not forced, got: " @@ -111,7 +112,7 @@ int ctkVTKWidgetsUtilsTestImageConversion(int argc, char * argv [] ) } // do not force alpha channel - RGB input - ctk::qImageToVTKImageData(someQImage.convertToFormat(QImage::Format_RGB888), someVtkImage, false); + ctk::qImageToVTKImageData(someQImage.convertToFormat(QImage::Format_RGB888), someVtkImage.GetPointer(), false); if (someVtkImage->GetNumberOfScalarComponents() != 3) { std::cout << "qImageToVTKImageData expected 3 scalar components for RGBA input + alpha not forced, got: " @@ -120,7 +121,7 @@ int ctkVTKWidgetsUtilsTestImageConversion(int argc, char * argv [] ) } // force alpha channel - RGB input - ctk::qImageToVTKImageData(someQImage.convertToFormat(QImage::Format_RGB888), someVtkImage, true); + ctk::qImageToVTKImageData(someQImage.convertToFormat(QImage::Format_RGB888), someVtkImage.GetPointer(), true); if (someVtkImage->GetNumberOfScalarComponents() != 4) { std::cout << "qImageToVTKImageData expected 4 scalar components for RGBA input + alpha forced, got: " @@ -132,7 +133,7 @@ int ctkVTKWidgetsUtilsTestImageConversion(int argc, char * argv [] ) ////////////////////////////////////// // RGBA input - QImage convertedQImage = ctk::vtkImageDataToQImage(someVtkImage); + QImage convertedQImage = ctk::vtkImageDataToQImage(someVtkImage.GetPointer()); if (someVtkImage->GetDimensions()[0] != convertedQImage.size().width() || someVtkImage->GetDimensions()[1] != convertedQImage.size().height()) { @@ -157,8 +158,8 @@ int ctkVTKWidgetsUtilsTestImageConversion(int argc, char * argv [] ) } // RGB input - ctk::qImageToVTKImageData(someQImage.convertToFormat(QImage::Format_RGB888), someVtkImage, false); - convertedQImage = ctk::vtkImageDataToQImage(someVtkImage); + ctk::qImageToVTKImageData(someQImage.convertToFormat(QImage::Format_RGB888), someVtkImage.GetPointer(), false); + convertedQImage = ctk::vtkImageDataToQImage(someVtkImage.GetPointer()); if (convertedQImage.hasAlphaChannel()) { std::cout << "vtkImageDataToQImage expected no alpha channel" << std::endl; diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKWidgetsUtils.cpp b/Libs/Visualization/VTK/Widgets/ctkVTKWidgetsUtils.cpp index 1829d1cb5d..0782e4a48d 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKWidgetsUtils.cpp +++ b/Libs/Visualization/VTK/Widgets/ctkVTKWidgetsUtils.cpp @@ -105,10 +105,12 @@ QImage ctk::vtkImageDataToQImage(vtkImageData* imageData) { pixelFormat = QImage::Format_RGB888; } +#if QT_VERSION >= QT_VERSION_CHECK(5,2,0) else if (numberOfScalarComponents == 4) { pixelFormat = QImage::Format_RGBA8888; } +#endif #if QT_VERSION >= QT_VERSION_CHECK(5,5,0) else if (numberOfScalarComponents == 1) { @@ -155,8 +157,13 @@ bool ctk::qImageToVTKImageData(const QImage& inputQImage, vtkImageData* outputVT vtkIdType numberOfScalarComponents = 0; if (inputQImage.hasAlphaChannel() || forceAlphaChannel) { +#if QT_VERSION >= QT_VERSION_CHECK(5,2,0) normalizedQtImage = inputQImage.convertToFormat(QImage::Format_RGBA8888).mirrored(); numberOfScalarComponents = 4; +#else + qWarning() << Q_FUNC_INFO << " failed: conversion of 4-component image is not available with Qt < 5.2"; + return false; +#endif } else { From 60d9410427dae31c62defee3c7e6d67cff0ed645 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 12 Apr 2023 22:51:49 -0400 Subject: [PATCH 067/115] COMP: Update ctkVTKSurfaceMaterialPropertyWidget to fix build against VTK8/Qt4 This commit fixes a regression introduced in 7b48c481a (ENH: Add support for PBR material properties in material property widgets) by reporting a warning if Metallic or Roughness properties are set. --- .../ctkVTKSurfaceMaterialPropertyWidget.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKSurfaceMaterialPropertyWidget.cpp b/Libs/Visualization/VTK/Widgets/ctkVTKSurfaceMaterialPropertyWidget.cpp index 2102745a3e..dba03a6189 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKSurfaceMaterialPropertyWidget.cpp +++ b/Libs/Visualization/VTK/Widgets/ctkVTKSurfaceMaterialPropertyWidget.cpp @@ -27,6 +27,7 @@ // VTK includes #include #include +#include //----------------------------------------------------------------------------- class ctkVTKSurfaceMaterialPropertyWidgetPrivate @@ -118,7 +119,9 @@ void ctkVTKSurfaceMaterialPropertyWidget::updateFromProperty() case VTK_FLAT: this->setInterpolationMode(InterpolationFlat); break; case VTK_GOURAUD: this->setInterpolationMode(InterpolationGouraud); break; case VTK_PHONG: this->setInterpolationMode(InterpolationPhong); break; +#if VTK_MAJOR_VERSION >= 9 case VTK_PBR: this->setInterpolationMode(InterpolationPBR); break; +#endif } this->setAmbient(d->Property->GetAmbient()); @@ -126,8 +129,10 @@ void ctkVTKSurfaceMaterialPropertyWidget::updateFromProperty() this->setSpecular(d->Property->GetSpecular()); this->setSpecularPower(d->Property->GetSpecularPower()); +#if VTK_MAJOR_VERSION >= 9 this->setMetallic(d->Property->GetMetallic()); this->setRoughness(d->Property->GetRoughness()); +#endif d->IsUpdatingGUI = false; } @@ -183,7 +188,11 @@ void ctkVTKSurfaceMaterialPropertyWidget::onInterpolationModeChanged( case InterpolationFlat: d->Property->SetInterpolationToFlat(); break; case InterpolationGouraud: d->Property->SetInterpolationToGouraud(); break; case InterpolationPhong: d->Property->SetInterpolationToPhong(); break; +#if VTK_MAJOR_VERSION >= 9 case InterpolationPBR: d->Property->SetInterpolationToPBR(); break; +#else + case InterpolationPBR: break; +#endif } } } @@ -243,6 +252,7 @@ void ctkVTKSurfaceMaterialPropertyWidget::onSpecularPowerChanged(double newSpecu // -------------------------------------------------------------------------- void ctkVTKSurfaceMaterialPropertyWidget::onMetallicChanged(double newMetallic) { +#if VTK_MAJOR_VERSION >= 9 Q_D(ctkVTKSurfaceMaterialPropertyWidget); this->Superclass::onMetallicChanged(newMetallic); if (d->Property.GetPointer() != 0) @@ -251,11 +261,16 @@ void ctkVTKSurfaceMaterialPropertyWidget::onMetallicChanged(double newMetallic) // up-to-date value then. d->Property->SetMetallic(this->metallic()); } +#else + Q_UNUSED(newMetallic); + qWarning() << Q_FUNC_INFO << " failed: metallic property is not supported with VTK < 9"; +#endif } // -------------------------------------------------------------------------- void ctkVTKSurfaceMaterialPropertyWidget::onRoughnessChanged(double newRoughness) { +#if VTK_MAJOR_VERSION >= 9 Q_D(ctkVTKSurfaceMaterialPropertyWidget); this->Superclass::onRoughnessChanged(newRoughness); if (d->Property.GetPointer() != 0) @@ -264,6 +279,10 @@ void ctkVTKSurfaceMaterialPropertyWidget::onRoughnessChanged(double newRoughness // up-to-date value then. d->Property->SetRoughness(this->roughness()); } +#else + Q_UNUSED(newRoughness); + qWarning() << Q_FUNC_INFO << " failed: roughness property is not supported with VTK < 9"; +#endif } // -------------------------------------------------------------------------- From 518c8b96cf907fbd2dc996435d4850f05b410355 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 13 Apr 2023 00:20:41 -0400 Subject: [PATCH 068/115] COMP: Display name and value of CTK library options during configuration For example: [...] -- CTK_LIB_Core_WITH_BFD_SHARED is OFF -- CTK_LIB_Core_WITH_BFD_STATIC is OFF -- CTK_LIB_Visualization/VTK/Widgets_USE_TRANSFER_FUNCTION_CHARTS is ON [...] --- CMake/ctkMacroAddCtkLibraryOptions.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/CMake/ctkMacroAddCtkLibraryOptions.cmake b/CMake/ctkMacroAddCtkLibraryOptions.cmake index 5456e6d88c..24bbd7b83e 100644 --- a/CMake/ctkMacroAddCtkLibraryOptions.cmake +++ b/CMake/ctkMacroAddCtkLibraryOptions.cmake @@ -34,6 +34,7 @@ macro(ctkMacroAddCtkLibraryOptions lib) foreach(option ${ctk_library_options}) ctkFunctionExtractOptionNameAndValue(${option} option_name option_value) option(CTK_LIB_${lib}_${option_name} "Enable ${lib} Library ${option_name} option." ${option_value}) + message(STATUS "CTK_LIB_${lib}_${option_name} is ${CTK_LIB_${lib}_${option_name}}") mark_as_advanced(CTK_LIB_${lib}_${option_name}) mark_as_superbuild(CTK_LIB_${lib}_${option_name}) endforeach() From 299825292c33158e0f445d51897e1c20fbf3e875 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 13 Apr 2023 00:31:01 -0400 Subject: [PATCH 069/115] COMP: Update ctkDICOMQueryRetrieveWidget to fix build against Qt4/C++98 Since C++98 doesn't support the auto keyword or lambdas, the following workarounds are implemented: 1. The type of the currentStudyAndSeriesUIDPair variable is explicitly specified as StudyAndSeriesInstanceUIDPairList::iterator. 2. The macro Q_FOREACH macro is used instead of the "for-each loop". 3. A struct called FindBySeriesUID is introduced to be used a functor representing the predicate used in std::find_if. 4. Ensure compatibility with across C++ standard using QList, QPair and qMakePair --- .../Widgets/ctkDICOMQueryRetrieveWidget.cpp | 33 ++++++++++++++++--- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/Libs/DICOM/Widgets/ctkDICOMQueryRetrieveWidget.cpp b/Libs/DICOM/Widgets/ctkDICOMQueryRetrieveWidget.cpp index a2d1f386bb..7cdcd586e4 100644 --- a/Libs/DICOM/Widgets/ctkDICOMQueryRetrieveWidget.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMQueryRetrieveWidget.cpp @@ -62,7 +62,7 @@ class ctkDICOMQueryRetrieveWidgetPrivate: public Ui_ctkDICOMQueryRetrieveWidget QMap QueriesByServer; QMap QueriesByStudyUID; - std::list< std::pair > StudyAndSeriesInstanceUIDPairList; + QList< QPair > StudyAndSeriesInstanceUIDPairList; QMap RetrievalsByStudyUID; ctkDICOMDatabase QueryResultDatabase; QSharedPointer RetrieveDatabase; @@ -266,10 +266,15 @@ void ctkDICOMQueryRetrieveWidget::query() d->QueriesByServer[d->CurrentServer] = query; +#ifdef HAVE_QT5 for (const auto & StudyAndSeriesInstanceUIDPair : query->studyAndSeriesInstanceUIDQueried() ) +#else + typedef QPair StudyAndSeriesInstanceUIDPairType; + Q_FOREACH(const StudyAndSeriesInstanceUIDPairType & StudyAndSeriesInstanceUIDPair, query->studyAndSeriesInstanceUIDQueried()) +#endif { d->QueriesByStudyUID[StudyAndSeriesInstanceUIDPair.first] = query; - d->StudyAndSeriesInstanceUIDPairList.push_back(std::make_pair( StudyAndSeriesInstanceUIDPair.first, StudyAndSeriesInstanceUIDPair.second )); + d->StudyAndSeriesInstanceUIDPairList.push_back(qMakePair( StudyAndSeriesInstanceUIDPair.first, StudyAndSeriesInstanceUIDPair.second )); } } @@ -292,6 +297,19 @@ void ctkDICOMQueryRetrieveWidget::query() d->CurrentQuery = 0; } +//---------------------------------------------------------------------------- +#ifndef HAVE_QT5 +namespace { + struct FindBySeriesUID { + QString seriesUID; + FindBySeriesUID(const QString& uid) : seriesUID(uid) {} + bool operator () (const QPair& element) const { + return element.second == seriesUID; + } + }; +} +#endif + //---------------------------------------------------------------------------- void ctkDICOMQueryRetrieveWidget::retrieve() { @@ -345,14 +363,19 @@ void ctkDICOMQueryRetrieveWidget::retrieve() } // Get the study UID of the current series to be retrieved +#ifdef HAVE_QT5 auto currentStudyAndSeriesUIDPair = std::find_if( d->StudyAndSeriesInstanceUIDPairList.begin(), d->StudyAndSeriesInstanceUIDPairList.end(), - [&seriesUID]( const std::pair& element ) { return element.second == seriesUID; } ); - + [&seriesUID]( const QPair& element ) { return element.second == seriesUID; } ); +#else + typedef QList< QPair > StudyAndSeriesInstanceUIDPairList; + StudyAndSeriesInstanceUIDPairList::iterator currentStudyAndSeriesUIDPair = + std::find_if(d->StudyAndSeriesInstanceUIDPairList.begin(), d->StudyAndSeriesInstanceUIDPairList.end(), FindBySeriesUID(seriesUID)); +#endif QString studyUID = currentStudyAndSeriesUIDPair->first; // Get information which server we want to get the study from and prepare request accordingly QMap::iterator queryIt = d->QueriesByStudyUID.find(studyUID); - ctkDICOMQuery* query = (queryIt == d->QueriesByStudyUID.end() ? nullptr : *queryIt); + ctkDICOMQuery* query = (queryIt == d->QueriesByStudyUID.end() ? CTK_NULLPTR : *queryIt); if (!query) { logger.warn("Retrieve of series " + seriesUID + " failed. No query found for study " + studyUID + "."); From 3bba1dbad2108c8243636ceabcc5ed045a15c5d4 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 13 Apr 2023 03:16:32 -0400 Subject: [PATCH 070/115] COMP: Fix Qt4/C++98 ctkDICOMBrowser build error due to protected signal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the following error: /path/to/CTK/Libs/DICOM/Core/ctkDICOMDatabase.h: In member function ‘void ctkDICOMBrowser::onRepairAction()’: /path/to/CTK/Libs/DICOM/Core/ctkDICOMDatabase.h:425:8: error: ‘void ctkDICOMDatabase::databaseChanged()’ is protected void databaseChanged(); ^ /path/to/CTK/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp:928:37: error: within this context d->DICOMDatabase->databaseChanged(); ^ --- Libs/DICOM/Core/ctkDICOMDatabase.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Libs/DICOM/Core/ctkDICOMDatabase.h b/Libs/DICOM/Core/ctkDICOMDatabase.h index 491f6fe316..3fb6ad80ac 100644 --- a/Libs/DICOM/Core/ctkDICOMDatabase.h +++ b/Libs/DICOM/Core/ctkDICOMDatabase.h @@ -33,6 +33,7 @@ class QDateTime; class ctkDICOMDatabasePrivate; class DcmDataset; class ctkDICOMAbstractThumbnailGenerator; +class ctkDICOMBrowser; class ctkDICOMDisplayedFieldGenerator; /// \ingroup DICOM_Core @@ -450,6 +451,7 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMDatabase : public QObject private: Q_DECLARE_PRIVATE(ctkDICOMDatabase); Q_DISABLE_COPY(ctkDICOMDatabase); + friend class ctkDICOMBrowser; // For access to databaseChanged() if building against Qt4 }; #endif From 855146d082725694ab556065b60eecdb10baad8d Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 13 Apr 2023 03:17:47 -0400 Subject: [PATCH 071/115] COMP: Fix Qt4/C++98 build for ctkDICOM(ThumbnailGenerator|ObjectListWidget) --- Libs/DICOM/Widgets/ctkDICOMObjectListWidget.cpp | 10 +++++++++- Libs/DICOM/Widgets/ctkDICOMThumbnailGenerator.h | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Libs/DICOM/Widgets/ctkDICOMObjectListWidget.cpp b/Libs/DICOM/Widgets/ctkDICOMObjectListWidget.cpp index 1648031e4a..c28dc4a6b0 100644 --- a/Libs/DICOM/Widgets/ctkDICOMObjectListWidget.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMObjectListWidget.cpp @@ -103,7 +103,7 @@ class ctkDICOMObjectListWidgetPrivate: public Ui_ctkDICOMObjectListWidget ctkDICOMObjectModel* dicomObjectModel; qRecursiveTreeProxyFilter* filterModel; QString filterExpression; - bool thumbnailVisible{true}; + bool thumbnailVisible; }; //---------------------------------------------------------------------------- @@ -111,6 +111,7 @@ class ctkDICOMObjectListWidgetPrivate: public Ui_ctkDICOMObjectListWidget //---------------------------------------------------------------------------- ctkDICOMObjectListWidgetPrivate::ctkDICOMObjectListWidgetPrivate() + : thumbnailVisible(true) { #ifdef WIN32 this->endOfLine = "\r\n"; @@ -437,7 +438,11 @@ void ctkDICOMObjectListWidget::setThumbnailVisible(bool visible) } d->thumbnailVisible = visible; +#if QT_VERSION >= QT_VERSION_CHECK(5,3,0) QSignalBlocker blocker(d->showThumbnailButton); +#else + bool wasBlocked = d->showThumbnailButton->blockSignals(true); +#endif d->showThumbnailButton->setChecked(visible); d->thumbnailLabel->setVisible(visible); @@ -446,6 +451,9 @@ void ctkDICOMObjectListWidget::setThumbnailVisible(bool visible) // Previously the thumbnail was not visible, so it was not updated. Update it now. this->updateWidget(); } +#if QT_VERSION < QT_VERSION_CHECK(5,3,0) + d->showThumbnailButton->blockSignals(wasBlocked); +#endif } //------------------------------------------------------------------------------ diff --git a/Libs/DICOM/Widgets/ctkDICOMThumbnailGenerator.h b/Libs/DICOM/Widgets/ctkDICOMThumbnailGenerator.h index 61c1aa3aaf..292cdfddd1 100644 --- a/Libs/DICOM/Widgets/ctkDICOMThumbnailGenerator.h +++ b/Libs/DICOM/Widgets/ctkDICOMThumbnailGenerator.h @@ -22,6 +22,9 @@ #ifndef __ctkDICOMThumbnailGenerator_h #define __ctkDICOMThumbnailGenerator_h +// Qt includes +class QImage; + // CTK includes #include "ctkDICOMWidgetsExport.h" #include "ctkDICOMAbstractThumbnailGenerator.h" From 28ce899e6f384a62de85f323e31395bb7497da35 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 13 Apr 2023 03:19:59 -0400 Subject: [PATCH 072/115] COMP: Update ctkVTKAbstractViewTest1 to fix build against VTK 8 --- .../VTK/Widgets/Testing/Cpp/ctkVTKAbstractViewTest1.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKAbstractViewTest1.cpp b/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKAbstractViewTest1.cpp index d005acbb04..e56acdd951 100644 --- a/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKAbstractViewTest1.cpp +++ b/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKAbstractViewTest1.cpp @@ -31,6 +31,7 @@ #include "ctkVTKWidgetsUtils.h" // VTK includes +#include #include #include @@ -112,7 +113,7 @@ int ctkVTKAbstractViewTest1(int argc, char * argv [] ) vtkNew renderEventCallback; renderEventCallback->SetCallback(onRenderEvent); - sliceView.renderWindow()->AddObserver(vtkCommand::RenderEvent, renderEventCallback); + sliceView.renderWindow()->AddObserver(vtkCommand::RenderEvent, renderEventCallback.GetPointer()); sliceView.setMaximumUpdateRate(VTK_DOUBLE_MAX); sliceView.show(); From a7865e0bc39bdcdc36210f12af3a271cb89bfad5 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 13 Apr 2023 12:24:58 -0400 Subject: [PATCH 073/115] COMP: Fix Qt4/C++98 ctkPythonConsole build by explicitly comparing with QChar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes errors like the following introduced in 08461b356 (ENH: Improve Python autocomplete list ordering) Error: /path/to/CTK/Libs/Scripting/Python/Widgets/ctkPythonConsole.cpp:379:18: error: conversion from ‘const char [2]’ to ‘QChar’ is ambiguous if (s1[0] != "_" && s2[0] == "_") ^ --- Libs/Scripting/Python/Widgets/ctkPythonConsole.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libs/Scripting/Python/Widgets/ctkPythonConsole.cpp b/Libs/Scripting/Python/Widgets/ctkPythonConsole.cpp index 86b6342d43..38150e4b34 100644 --- a/Libs/Scripting/Python/Widgets/ctkPythonConsole.cpp +++ b/Libs/Scripting/Python/Widgets/ctkPythonConsole.cpp @@ -372,11 +372,11 @@ bool ctkPythonConsoleCompleterPrivate::PythonAttributeLessThan(const QString& s1 if (!s1.isEmpty() || !s2.isEmpty()) { // Move Python private attributes to the back (start with underscore) - if (s1[0] == "_" && s2[0] != "_") + if (s1[0] == QChar('_') && s2[0] != QChar('_')) { return false; } - if (s1[0] != "_" && s2[0] == "_") + if (s1[0] != QChar('_') && s2[0] == QChar('_')) { return true; } From 72d830f1a25d826b696023e51da4276f4203b7e8 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 13 Apr 2023 12:28:15 -0400 Subject: [PATCH 074/115] COMP: Fix Qt4/C++98 build updating ctkPythonConsole to use CTK_OVERRIDE --- Libs/Scripting/Python/Widgets/ctkPythonConsole.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libs/Scripting/Python/Widgets/ctkPythonConsole.h b/Libs/Scripting/Python/Widgets/ctkPythonConsole.h index c04b61664a..569de5b69a 100644 --- a/Libs/Scripting/Python/Widgets/ctkPythonConsole.h +++ b/Libs/Scripting/Python/Widgets/ctkPythonConsole.h @@ -128,8 +128,8 @@ class CTK_SCRIPTING_PYTHON_WIDGETS_EXPORT ctkPythonConsoleCompleter : public ctk ctkPythonConsoleCompleter(ctkAbstractPythonManager& pythonManager); virtual ~ctkPythonConsoleCompleter(); - int cursorOffset(const QString& completion) override; - void updateCompletionModel(const QString& completion) override; + int cursorOffset(const QString& completion) CTK_OVERRIDE; + void updateCompletionModel(const QString& completion) CTK_OVERRIDE; protected: QScopedPointer d_ptr; From 60a0740f228633f118698b4526256a4c2110ce81 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 13 Jul 2023 16:45:38 -0400 Subject: [PATCH 075/115] DOC: Update README adding sections like Overview, Getting Started and Topics This commit adds the following sections: * Overview * Getting Started * Topics * Supported Qt versions * Supported Python versions * Dependency Management * License --- README.md | 122 +++++++++++++++++++++++++++++++++++++++++++++++++++++ README.rst | 23 ---------- 2 files changed, 122 insertions(+), 23 deletions(-) create mode 100644 README.md delete mode 100644 README.rst diff --git a/README.md b/README.md new file mode 100644 index 0000000000..23bd9654a4 --- /dev/null +++ b/README.md @@ -0,0 +1,122 @@ +# Common Toolkit + +[![CircleCI Status][circleci-badge]][circleci-link] +[![License][license-badge]][license-link] + +[circleci-badge]: https://dl.circleci.com/status-badge/img/gh/commontk/CTK/tree/master.svg?style=shield +[circleci-link]: https://dl.circleci.com/status-badge/redirect/gh/commontk/CTK/tree/master + +[license-badge]: https://img.shields.io/github/license/commontk/CTK?color=blue +[license-link]: https://github.com/commontk/CTK/blob/master/LICENSE + +The Common Toolkit (CTK) is a community-driven effort, focused on providing support code for +medical image analysis, surgical navigation, and related projects. + +## Overview + +CTK covers topics not addressed by existing toolkits, catering to the mutual interests and needs of the CTK community. The current scope of CTK efforts includes the following topics: _DICOM_, _DICOM Application Hosting_, _Widgets_, _Plugin Framework_ and _Command Line Interfaces_. + +## Getting Started + +To work with CTK, you need to have a C++ compiler, Qt libraries, and CMake installed. + +### Configure + +Configure the project using CMake by setting the following options: + * `CTK_QT_VERSION`: 5 + * `Qt5_DIR`: `C:\Qt\5.15.2\msvc2019_64\lib\cmake\Qt5` (or a similar path, depending on your operating system) + +### Notes + +* To install the required development environment easily, refer to the "Prerequisites" section of the + 3D Slicer [build instructions](https://slicer.readthedocs.io/en/latest/developer_guide/build_instructions/index.html). + +* If you set `CTK_LIB_Visualization/VTK/Widgets` to `ON`, make sure to configure VTK by enabling the following modules: + * `VTK_MODULE_ENABLE_VTK_ChartsCore`: YES (to enable VTK charts) + * `VTK_MODULE_ENABLE_VTK_GUISupportQt`: YES (to enable VTK widgets) + * `VTK_MODULE_ENABLE_VTK_ViewsQt`: YES (to enable VTK view widgets) + * For more information, see the [VTK Build Instructions](https://docs.vtk.org/en/latest/build_instructions/index.html) and [VTK Modules](https://docs.vtk.org/en/latest/modules/index.html) documentation. + +* Make sure your built toolchain version is compatible with the chosen Qt version. + For example if trying to build with Qt-5.12 and Microsoft Visual Studio 2019, then build will fail with the error `error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl QLinkedListData::QLinkedListData(void)"` while trying to build with Qt 5.12 and Microsoft Visual Studio 2019, the solution is to either change the toolset version to an earlier one (e.g., Visual Studio 2017) or upgrade Qt (e.g., use Qt 5.15 with Visual Studio 2019). + +## Topics + +### DICOM + +CTK provides high-level classes that support query and retrieve operations from PACS and local databases. It includes Qt widgets for easily setting up a server connection, sending queries, and viewing the results. The underlying toolkit used is [DCMTK](https://dicom.offis.de/en/dcmtk/). + +To learn more, refer to the [Overview of DICOM functionality in CTK](https://commontk.org/index.php/Documentation/Dicom_Overview). + +### DICOM Application Hosting + +CTK aims to create a C++ reference implementation of the [DICOM Part 19 Application Hosting specifications](https://commontk.org/images/8/8e/DicomAppHostingSpecs.pdf). It provides an infrastructure to create both hosts and hosted applications. Although the project is still in alpha status, it can be useful for conformance testing and initial experimentation. + +To learn more, see the [DICOM Application Hosting](https://commontk.org/index.php/Documentation/DicomApplicationHosting) documentation. + +### Widgets + +CTK offers a collection of Qt Widgets for use in biomedical imaging applications. + +To explore the available widgets, visit the [Gallery](https://commontk.org/index.php/Documentation/ImageGallery) and the associated [Widgets](https://commontk.org/index.php/Documentation/Widgets) wiki page. + +### Plugin Framework + +CTK provides a dynamic component system for C++, modeled after the [OSGi](http://www.osgi.org) specifications. It enables a development model where applications are dynamically composed of many different reusable components, following a service-oriented approach. + +To get started with the Plugin Framework, refer to the [Plugin Framework](https://commontk.org/index.php/Documentation/Plugin_Framework) documentation. + +### Command Line Interfaces + +CTK supports the usage of algorithms written as self-contained executables in multiple programming languages. It includes a command line interface (CLI) module that simplifies the integration of command line tools into CTK-based applications. The CLI module provides a flexible and extensible framework for defining, executing, and configuring command line interfaces for algorithms. + +To learn more about the CLI module, see the [Command Line Interfaces](https://commontk.org/index.php/Documentation/Command_Line_Interfaces) documentation. + +## Supported Qt versions + +CTK supports the following versions of Qt: + +* Qt 5 + * CMake options: + * `CTK_QT_VERSION` set to `5` + * `Qt5_DIR` set to `C:\Qt\5.15.2\msvc2019_64\lib\cmake\Qt5` (or a similar path, depending on your operating system) + * Requirements + * C++11 + * VTK 9 or newer + * PythonQt [patched-9](https://github.com/commontk/PythonQt/tree/patched-9) branch + +* Qt 4 + * CMake options: + * `CTK_QT_VERSION` set to `4` + * `QT_QMAKE_EXECUTABLE` set to `C:\path\to\qt-everywhere-opensource-build-4.8.6\bin\qmake.exe` (or a similar path, depending on your operating system) + * Requirements + * C++98 + * VTK 8 + * ITK v4.13.3 or older + * PythonQt [patched-5](https://github.com/commontk/PythonQt/tree/patched-5) branch + * QtTesting <= [c44b32fde](https://github.com/commontk/QtTesting/commit/c44b32fdea827be737e8c2f5608ffbc2e3bd08b2) from June 2017. + + +## Supported Python versions + +CTK supports the following versions of Python: + +* Python 3 + +* Python 2.7 + * Removed in VTK >= 9.3 + +## Dependency Management + +CTK simplifies the process of managing dependencies by automatically handling the download, configuration, and building of required dependencies (except Qt) as part of the build process. This ensures that the necessary dependencies are readily available for building CTK-based applications without manual intervention. + +To further support customization of CTK dependencies, you have the option to configure CTK by specifying options for each dependency. These options can include `_DIR` or `CTK_USE_SYSTEM_`, where `` represents the name of the respective dependency. For more details on the available options for each dependency, you can refer to the corresponding `CTK/CMakeExternals/.cmake` file. + +In achieving this automatic dependency management, CTK internally integrates the [Artichoke](https://cmake-artichoke.readthedocs.io) CMake module, which enhances the built-in [ExternalProject](https://cmake.org/cmake/help/latest/module/ExternalProject.html) CMake module. + +By utilizing this integrated approach, CTK facilitates the management and customization of dependencies, providing flexibility and ease of use for developers working with CTK-based applications. + +## License + +CTK code is licensed under Apache 2.0. This means that users of CTK are allowed to use the code for academic, commercial, or other purposes without paying license fees or being restricted in their ability to redistribute their code or keep it private. + diff --git a/README.rst b/README.rst deleted file mode 100644 index 9508301275..0000000000 --- a/README.rst +++ /dev/null @@ -1,23 +0,0 @@ -Common Toolkit -============== - -.. image:: https://circleci.com/gh/commontk/CTK.png?style=shield - :target: https://circleci.com/gh/commontk/CTK - -The Common Toolkit is a community effort to provide support code for medical image analysis, -surgical navigation, and related projects. - -See http://commontk.org - -Build Instructions -================== - -Configure the project using CMake. - -For Qt5, specify the following: - - ``CTK_QT_VERSION``: 5 - - ``QT5_DIR``: C:\Qt\5.15.0\msvc2019_64\lib\cmake\Qt5 (or something similar, depending on operating system) - - ``VTK_MODULE_ENABLE_VTK_GUISupportQt``: YES (for enabling VTK widgets) - - ``VTK_MODULE_ENABLE_VTK_ViewsQt``: YES (for enabling VTK view widgets) - -Note: make sure your built toolchain version is compatible with the chosen Qt version. For example if trying to build with Qt-5.12 and Microsoft Visual Studio 2019, then build will fail with the error `error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl QLinkedListData::QLinkedListData(void)"`. The solution is to either change the toolset version to an earlier one (e.g., Visual Studio 2017) or upgrade Qt (e.g., use Qt-5.15 with Visual Studio 2019). From 777b5eac5bf769d4f266ddc05952a5941bd1e1d9 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Tue, 18 Jul 2023 05:37:03 -0400 Subject: [PATCH 076/115] DOC: Mention Qt 4/C++98/Python 2.7/VTK 8/ITK v4.13.3 are unsupported --- README.md | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 23bd9654a4..55ac1c2f36 100644 --- a/README.md +++ b/README.md @@ -85,16 +85,9 @@ CTK supports the following versions of Qt: * VTK 9 or newer * PythonQt [patched-9](https://github.com/commontk/PythonQt/tree/patched-9) branch -* Qt 4 - * CMake options: - * `CTK_QT_VERSION` set to `4` - * `QT_QMAKE_EXECUTABLE` set to `C:\path\to\qt-everywhere-opensource-build-4.8.6\bin\qmake.exe` (or a similar path, depending on your operating system) - * Requirements - * C++98 - * VTK 8 - * ITK v4.13.3 or older - * PythonQt [patched-5](https://github.com/commontk/PythonQt/tree/patched-5) branch - * QtTesting <= [c44b32fde](https://github.com/commontk/QtTesting/commit/c44b32fdea827be737e8c2f5608ffbc2e3bd08b2) from June 2017. +Unsupported: + +* Qt 4: The last CTK version to support Qt 4, C++98, VTK 8 and ITK v4.13.3 is [CTK 2023.07.13](https://github.com/commontk/CTK/releases/tag/2023.07.13). ## Supported Python versions @@ -103,8 +96,9 @@ CTK supports the following versions of Python: * Python 3 -* Python 2.7 - * Removed in VTK >= 9.3 +Unsupported: + +* Python 2.7: The last CTK version to support Python 2.7 is [CTK 2023.07.13](https://github.com/commontk/CTK/releases/tag/2023.07.13). ## Dependency Management From 031b17da566914be4627dfb4f6dd16f827d3c5a8 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Tue, 18 Jul 2023 05:48:00 -0400 Subject: [PATCH 077/115] ENH: Update CircleCI removing support for building Qt4 --- .circleci/config.yml | 58 -------------------------------------------- 1 file changed, 58 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 56ac85567c..25300f39d6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,59 +1,5 @@ version: 2 jobs: - build-qt4: - working_directory: /usr/src/CTK - docker: - - image: slicer/buildenv-qt4-centos5:latest - steps: - - checkout - - run: - name: Configure and build - command: | - mkdir /usr/src/CTK-build - cd /usr/src/CTK-build - cmake \ - -DCTK_QT_VERSION:STRING=4 \ - -DCTK_ENABLE_Widgets:BOOL=ON \ - ../CTK - make -j4 - - save_cache: - key: ctk-src-{{ .Revision }} - paths: /usr/src/CTK - - save_cache: - key: ctk-build-qt4-{{ .Revision }} - paths: /usr/src/CTK-build - - save_cache: - key: ctk-qt4-libraries-{{ .Revision }} - paths: /usr/src/qt-install - -# test-qt4: -# docker: -# - image: thewtex/opengl:debian -# steps: -# - restore_cache: -# keys: -# - ctk-src-{{ .Revision }} -# - restore_cache: -# keys: -# - ctk-build-qt4-{{ .Revision }} -# - restore_cache: -# keys: -# - ctk-qt4-libraries-{{ .Revision }} -# - run: -# name: Workaround the difference between cmake install path in 'slicer/buildenv-*' and 'thewtex/opengl:debian' images -# command: | -# mkdir -p /usr/src/cmake-3.11.0/bin -# ln -s $(which cmake) /usr/src/cmake-3.11.0/bin/cmake -# ln -s $(which cpack) /usr/src/cmake-3.11.0/bin/cpack -# ln -s $(which ctest) /usr/src/cmake-3.11.0/bin/ctest -# - run: -# command: | -# export APP="sudo chown -R user.user /usr/src/CTK-build && cd /usr/src/CTK-build/CTK-build && ctest -VV" -# /usr/bin/supervisord -c /etc/supervisor/supervisord.conf -# [ "$(cat /tmp/graphical-app.return_code)" = 0 ] -# environment: -# QT_X11_NO_MITSHM: "1" -# XDG_RUNTIME_DIR: "/tmp/runtime-user" build-qt5: working_directory: /usr/src/CTK @@ -114,10 +60,6 @@ workflows: version: 2 build-test: jobs: - - build-qt4 -# - test-qt4: -# requires: -# - build-qt4 - build-qt5 # - test-qt5: # requires: From 3f2f4735683aede33bfcf549458989cc1eb868ed Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 19 Jul 2023 00:00:37 -0400 Subject: [PATCH 078/115] COMP: Require CMake >= 3.0 for project building against CTK --- CMake/CTKConfig.cmake.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMake/CTKConfig.cmake.in b/CMake/CTKConfig.cmake.in index dc1eca3c10..1049e22149 100644 --- a/CMake/CTKConfig.cmake.in +++ b/CMake/CTKConfig.cmake.in @@ -5,6 +5,9 @@ # This file is configured by CTK and used by the UseCTK.cmake module # to load CTK's settings for an external project. +if(CMAKE_VERSION VERSION_LESS 3.0.0) + message(FATAL_ERROR "CTK requires at least CMake version 3.0.0") +endif() @PACKAGE_INIT@ From 86167a09fb5b21bdc1ae4c9027a94d809700805e Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 19 Jul 2023 00:25:38 -0400 Subject: [PATCH 079/115] COMP: Remove obsolete CMake code related to CMake < 3.0 This is a follow-up of these commits: * 3eb055e1d (COMP: Update CMake required version from 2.8.9 to 3.0 to match its use) * 884027670 (COMP: Require CMake >= 3.0 for project building against CTK) Summary: * Update CTK CMake modules removing support for CMake < 3.0. * Remove CTK own implementation of CMakeFindDependencyMacro already provided in CMake >= 3.0. * Remove unneeded policy settings already set to NEW by virtue of calling cmake_minimum_required(VERSION 3.0). Since CMake 3.0 implies all polices <= CMP0050 are set to NEW, this commit removes the corresponding code. --- CMake/CMakeFindDependencyMacro.cmake | 110 ------------------ CMake/CTKConfig.cmake.in | 4 - .../CTKGenerateCTKConfig.cmake | 4 - CMake/ctkMacroBuildPlugin.cmake | 18 --- CMakeLists.txt | 2 - Libs/DICOM/Core/CMakeLists.txt | 2 - Utilities/DGraph/CMakeLists.txt | 6 - 7 files changed, 146 deletions(-) delete mode 100644 CMake/CMakeFindDependencyMacro.cmake diff --git a/CMake/CMakeFindDependencyMacro.cmake b/CMake/CMakeFindDependencyMacro.cmake deleted file mode 100644 index 2da2cf0231..0000000000 --- a/CMake/CMakeFindDependencyMacro.cmake +++ /dev/null @@ -1,110 +0,0 @@ -#.rst: -# CMakeFindDependencyMacro -# ------------------------- -# -# :: -# -# find_dependency( [ [EXACT]]) -# -# -# ``find_dependency()`` wraps a :command:`find_package` call for a package -# dependency. It is designed to be used in a Config.cmake file, and it -# forwards the correct parameters for EXACT, QUIET and REQUIRED which were -# passed to the original :command:`find_package` call. It also sets an -# informative diagnostic message if the dependency could not be found. -# - -#============================================================================= -# Copyright 2013 Stephen Kelly -# -# CMake - Cross Platform Makefile Generator -# Copyright 2000-2014 Kitware, Inc. -# Copyright 2000-2011 Insight Software Consortium -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# * Neither the names of Kitware, Inc., the Insight Software Consortium, -# nor the names of their contributors may be used to endorse or promote -# products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -#============================================================================= - -macro(find_dependency dep) - if (NOT ${dep}_FOUND) - set(cmake_fd_version) - if (${ARGC} GREATER 1) - if ("${ARGV1}" STREQUAL "") - message(FATAL_ERROR "Invalid arguments to find_dependency. VERSION is empty") - endif() - if ("${ARGV1}" STREQUAL EXACT) - message(FATAL_ERROR "Invalid arguments to find_dependency. EXACT may only be specified if a VERSION is specified") - endif() - set(cmake_fd_version ${ARGV1}) - endif() - set(cmake_fd_exact_arg) - if(${ARGC} GREATER 2) - if (NOT "${ARGV2}" STREQUAL EXACT) - message(FATAL_ERROR "Invalid arguments to find_dependency") - endif() - set(cmake_fd_exact_arg EXACT) - endif() - if(${ARGC} GREATER 3) - message(FATAL_ERROR "Invalid arguments to find_dependency") - endif() - set(cmake_fd_quiet_arg) - if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) - set(cmake_fd_quiet_arg QUIET) - endif() - set(cmake_fd_required_arg) - if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) - set(cmake_fd_required_arg REQUIRED) - endif() - - get_property(cmake_fd_alreadyTransitive GLOBAL PROPERTY - _CMAKE_${dep}_TRANSITIVE_DEPENDENCY - ) - - find_package(${dep} ${cmake_fd_version} - ${cmake_fd_exact_arg} - ${cmake_fd_quiet_arg} - ${cmake_fd_required_arg} - ) - - if(NOT DEFINED cmake_fd_alreadyTransitive OR cmake_fd_alreadyTransitive) - set_property(GLOBAL PROPERTY _CMAKE_${dep}_TRANSITIVE_DEPENDENCY TRUE) - endif() - - if (NOT ${dep}_FOUND) - set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency ${dep} could not be found.") - set(${CMAKE_FIND_PACKAGE_NAME}_FOUND False) - return() - endif() - set(cmake_fd_version) - set(cmake_fd_required_arg) - set(cmake_fd_quiet_arg) - set(cmake_fd_exact_arg) - endif() -endmacro() diff --git a/CMake/CTKConfig.cmake.in b/CMake/CTKConfig.cmake.in index 1049e22149..1626fee58c 100644 --- a/CMake/CTKConfig.cmake.in +++ b/CMake/CTKConfig.cmake.in @@ -75,11 +75,7 @@ include("${CTK_CMAKE_DIR}/ctkFunctionGetPluginDependencies.cmake") include("${CTK_CMAKE_DIR}/ctkMacroSetupPlugins.cmake") include("${CTK_CMAKE_DIR}/ctkMacroGenerateMocs.cmake") -if(CMAKE_VERSION VERSION_LESS 3) - include("${CTK_CMAKE_DIR}/CMakeFindDependencyMacro.cmake") -else() include(CMakeFindDependencyMacro) -endif() # List all libraries SET(CTK_LIBRARIES @CTK_LIBRARIES@) diff --git a/CMake/LastConfigureStep/CTKGenerateCTKConfig.cmake b/CMake/LastConfigureStep/CTKGenerateCTKConfig.cmake index a382274626..e3f931751d 100644 --- a/CMake/LastConfigureStep/CTKGenerateCTKConfig.cmake +++ b/CMake/LastConfigureStep/CTKGenerateCTKConfig.cmake @@ -174,9 +174,7 @@ set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}# External project libraries\n") set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}set(CTK_EXTERNAL_LIBRARIES \"${CTK_EXTERNAL_LIBRARIES}\")\n") if(DEFINED DCMTK_HAVE_CONFIG_H_OPTIONAL AND NOT DCMTK_HAVE_CONFIG_H_OPTIONAL AND TARGET CTKDICOMCore) set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}# Definition required to build DCMTK dependent libraries\n") - set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}if(\"\${CMAKE_VERSION}\" VERSION_GREATER 2.8.10)\n") set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE} set_target_properties(CTKDICOMCore PROPERTIES INTERFACE_COMPILE_DEFINITIONS ${DCMTK_DEFINITIONS})\n") - set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}endif()\n") endif() set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}##################################################") @@ -230,9 +228,7 @@ foreach(lib ${CTK_LIBRARIES}) endforeach() if(DEFINED DCMTK_HAVE_CONFIG_H_OPTIONAL AND NOT DCMTK_HAVE_CONFIG_H_OPTIONAL AND TARGET CTKDICOMCore) set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}# Definition required to build DCMTK dependent libraries\n") - set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}if(\"\${CMAKE_VERSION}\" VERSION_GREATER 2.8.10)\n") set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE} set_target_properties(CTKDICOMCore PROPERTIES INTERFACE_COMPILE_DEFINITIONS ${DCMTK_DEFINITIONS})\n") - set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}endif()\n") endif() set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}##################################################") diff --git a/CMake/ctkMacroBuildPlugin.cmake b/CMake/ctkMacroBuildPlugin.cmake index e41ad9b599..947f258729 100644 --- a/CMake/ctkMacroBuildPlugin.cmake +++ b/CMake/ctkMacroBuildPlugin.cmake @@ -140,12 +140,6 @@ macro(ctkMacroBuildPlugin) # and external dependencies ctkFunctionGetIncludeDirs(my_includes ${lib_name}) - if(CMAKE_VERSION VERSION_LESS 2.8.12) - include_directories( - ${my_includes} - ) - endif() - if(CTK_QT_VERSION VERSION_LESS "5") # Add Qt include dirs and defines include(${QT_USE_FILE}) @@ -296,7 +290,6 @@ macro(ctkMacroBuildPlugin) ${_plugin_qm_files} ) - if(NOT CMAKE_VERSION VERSION_LESS 2.8.12) target_include_directories(${lib_name} PUBLIC "$" "$" @@ -315,17 +308,10 @@ macro(ctkMacroBuildPlugin) endif () endforeach() endif() - else() - find_package(Qt5LinguistTools REQUIRED) - endif() if(MY_TEST_PLUGIN AND CTK_QT_VERSION VERSION_GREATER "4") find_package(Qt5Test REQUIRED) - if(CMAKE_VERSION VERSION_LESS 2.8.12) - target_link_libraries(${lib_name} Qt5::Test) - else() target_link_libraries(${lib_name} PRIVATE Qt5::Test) - endif() endif() # Set the output directory for the plugin @@ -387,11 +373,7 @@ macro(ctkMacroBuildPlugin) list(APPEND my_libs ssp) # add stack smash protection lib endif() - if(CMAKE_VERSION VERSION_LESS 2.8.12) - target_link_libraries(${lib_name} ${my_libs}) - else() target_link_libraries(${lib_name} PUBLIC ${my_libs}) - endif() if(NOT MY_TEST_PLUGIN) set(${CMAKE_PROJECT_NAME}_PLUGIN_LIBRARIES ${${CMAKE_PROJECT_NAME}_PLUGIN_LIBRARIES} ${lib_name} CACHE INTERNAL "CTK plugins" FORCE) diff --git a/CMakeLists.txt b/CMakeLists.txt index ba6dba5e48..07370da301 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,6 @@ cmake_minimum_required(VERSION 3.0) foreach(p CMP0054 # CMake 3.1 - CMP0020 # CMake 2.8.11 ) if(POLICY ${p}) cmake_policy(SET ${p} NEW) @@ -256,7 +255,6 @@ foreach(file Libs/ctkExport.h.in CMake/ctkLinkerAsNeededFlagCheck.cmake CMake/ctk_compile_python_scripts.cmake.in - CMake/CMakeFindDependencyMacro.cmake ) install(FILES ${file} DESTINATION ${CTK_INSTALL_CMAKE_DIR} COMPONENT Development) endforeach() diff --git a/Libs/DICOM/Core/CMakeLists.txt b/Libs/DICOM/Core/CMakeLists.txt index d2b7d8c60f..c070a010ea 100644 --- a/Libs/DICOM/Core/CMakeLists.txt +++ b/Libs/DICOM/Core/CMakeLists.txt @@ -111,9 +111,7 @@ ctkMacroBuildLib( if(DEFINED DCMTK_HAVE_CONFIG_H_OPTIONAL AND NOT DCMTK_HAVE_CONFIG_H_OPTIONAL) # Workaround Debian packaging issue - See FindDCMTK.cmake for more details set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_DEFINITIONS ${DCMTK_DEFINITIONS}) - if("${CMAKE_VERSION}" VERSION_GREATER 2.8.10) set_target_properties(${PROJECT_NAME} PROPERTIES INTERFACE_COMPILE_DEFINITIONS ${DCMTK_DEFINITIONS}) - endif() endif() diff --git a/Utilities/DGraph/CMakeLists.txt b/Utilities/DGraph/CMakeLists.txt index 3c5ac09b30..29af0c5db2 100644 --- a/Utilities/DGraph/CMakeLists.txt +++ b/Utilities/DGraph/CMakeLists.txt @@ -20,12 +20,6 @@ cmake_minimum_required(VERSION 3.0) -foreach(policy CMP0003) - if(POLICY ${policy}) - cmake_policy(SET ${policy} NEW) - endif() -endforeach() - project(DGraph) set(CTK_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../) From 27df9fe6f9c223ec136ad5a83c8934f88a2daca0 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 19 Jul 2023 01:06:05 -0400 Subject: [PATCH 080/115] STYLE: Fix indent following removal of obsolete CMake code This is introduced as a separated commit so that .git-blame-ignore-revs can be updated. --- CMake/CTKConfig.cmake.in | 2 +- .../CTKGenerateCTKConfig.cmake | 4 +- CMake/ctkMacroBuildPlugin.cmake | 39 +++++++++---------- Libs/DICOM/Core/CMakeLists.txt | 2 +- 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/CMake/CTKConfig.cmake.in b/CMake/CTKConfig.cmake.in index 1626fee58c..908f241eef 100644 --- a/CMake/CTKConfig.cmake.in +++ b/CMake/CTKConfig.cmake.in @@ -75,7 +75,7 @@ include("${CTK_CMAKE_DIR}/ctkFunctionGetPluginDependencies.cmake") include("${CTK_CMAKE_DIR}/ctkMacroSetupPlugins.cmake") include("${CTK_CMAKE_DIR}/ctkMacroGenerateMocs.cmake") - include(CMakeFindDependencyMacro) +include(CMakeFindDependencyMacro) # List all libraries SET(CTK_LIBRARIES @CTK_LIBRARIES@) diff --git a/CMake/LastConfigureStep/CTKGenerateCTKConfig.cmake b/CMake/LastConfigureStep/CTKGenerateCTKConfig.cmake index e3f931751d..8a561029c5 100644 --- a/CMake/LastConfigureStep/CTKGenerateCTKConfig.cmake +++ b/CMake/LastConfigureStep/CTKGenerateCTKConfig.cmake @@ -174,7 +174,7 @@ set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}# External project libraries\n") set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}set(CTK_EXTERNAL_LIBRARIES \"${CTK_EXTERNAL_LIBRARIES}\")\n") if(DEFINED DCMTK_HAVE_CONFIG_H_OPTIONAL AND NOT DCMTK_HAVE_CONFIG_H_OPTIONAL AND TARGET CTKDICOMCore) set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}# Definition required to build DCMTK dependent libraries\n") - set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE} set_target_properties(CTKDICOMCore PROPERTIES INTERFACE_COMPILE_DEFINITIONS ${DCMTK_DEFINITIONS})\n") + set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}set_target_properties(CTKDICOMCore PROPERTIES INTERFACE_COMPILE_DEFINITIONS ${DCMTK_DEFINITIONS})\n") endif() set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}##################################################") @@ -228,7 +228,7 @@ foreach(lib ${CTK_LIBRARIES}) endforeach() if(DEFINED DCMTK_HAVE_CONFIG_H_OPTIONAL AND NOT DCMTK_HAVE_CONFIG_H_OPTIONAL AND TARGET CTKDICOMCore) set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}# Definition required to build DCMTK dependent libraries\n") - set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE} set_target_properties(CTKDICOMCore PROPERTIES INTERFACE_COMPILE_DEFINITIONS ${DCMTK_DEFINITIONS})\n") + set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}set_target_properties(CTKDICOMCore PROPERTIES INTERFACE_COMPILE_DEFINITIONS ${DCMTK_DEFINITIONS})\n") endif() set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}##################################################") diff --git a/CMake/ctkMacroBuildPlugin.cmake b/CMake/ctkMacroBuildPlugin.cmake index 947f258729..28656c2d67 100644 --- a/CMake/ctkMacroBuildPlugin.cmake +++ b/CMake/ctkMacroBuildPlugin.cmake @@ -290,28 +290,28 @@ macro(ctkMacroBuildPlugin) ${_plugin_qm_files} ) - target_include_directories(${lib_name} - PUBLIC "$" - "$" - ) - if(CTK_QT_VERSION VERSION_LESS "5") - # Add Qt include dirs to the target - target_include_directories(${lib_name} PUBLIC ${QT_INCLUDE_DIR}) - foreach(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN - QAXSERVER QAXCONTAINER QTDECLARATIVE QTSCRIPT QTSVG QTUITOOLS QTHELP - QTWEBKIT PHONON QTSCRIPTTOOLS QTMULTIMEDIA QTXMLPATTERNS QTGUI QTTEST - QTDBUS QTXML QTSQL QTNETWORK QTCORE) - if (QT_USE_${module} OR QT_USE_${module}_DEPENDS) - if (QT_${module}_FOUND) - target_include_directories(${lib_name} PUBLIC ${QT_${module}_INCLUDE_DIR}) - endif () + target_include_directories(${lib_name} + PUBLIC "$" + "$" + ) + if(CTK_QT_VERSION VERSION_LESS "5") + # Add Qt include dirs to the target + target_include_directories(${lib_name} PUBLIC ${QT_INCLUDE_DIR}) + foreach(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN + QAXSERVER QAXCONTAINER QTDECLARATIVE QTSCRIPT QTSVG QTUITOOLS QTHELP + QTWEBKIT PHONON QTSCRIPTTOOLS QTMULTIMEDIA QTXMLPATTERNS QTGUI QTTEST + QTDBUS QTXML QTSQL QTNETWORK QTCORE) + if (QT_USE_${module} OR QT_USE_${module}_DEPENDS) + if (QT_${module}_FOUND) + target_include_directories(${lib_name} PUBLIC ${QT_${module}_INCLUDE_DIR}) endif () - endforeach() - endif() + endif () + endforeach() + endif() if(MY_TEST_PLUGIN AND CTK_QT_VERSION VERSION_GREATER "4") find_package(Qt5Test REQUIRED) - target_link_libraries(${lib_name} PRIVATE Qt5::Test) + target_link_libraries(${lib_name} PRIVATE Qt5::Test) endif() # Set the output directory for the plugin @@ -373,7 +373,7 @@ macro(ctkMacroBuildPlugin) list(APPEND my_libs ssp) # add stack smash protection lib endif() - target_link_libraries(${lib_name} PUBLIC ${my_libs}) + target_link_libraries(${lib_name} PUBLIC ${my_libs}) if(NOT MY_TEST_PLUGIN) set(${CMAKE_PROJECT_NAME}_PLUGIN_LIBRARIES ${${CMAKE_PROJECT_NAME}_PLUGIN_LIBRARIES} ${lib_name} CACHE INTERNAL "CTK plugins" FORCE) @@ -390,4 +390,3 @@ macro(ctkMacroBuildPlugin) endif() endmacro() - diff --git a/Libs/DICOM/Core/CMakeLists.txt b/Libs/DICOM/Core/CMakeLists.txt index c070a010ea..634f3d16c6 100644 --- a/Libs/DICOM/Core/CMakeLists.txt +++ b/Libs/DICOM/Core/CMakeLists.txt @@ -111,7 +111,7 @@ ctkMacroBuildLib( if(DEFINED DCMTK_HAVE_CONFIG_H_OPTIONAL AND NOT DCMTK_HAVE_CONFIG_H_OPTIONAL) # Workaround Debian packaging issue - See FindDCMTK.cmake for more details set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_DEFINITIONS ${DCMTK_DEFINITIONS}) - set_target_properties(${PROJECT_NAME} PROPERTIES INTERFACE_COMPILE_DEFINITIONS ${DCMTK_DEFINITIONS}) + set_target_properties(${PROJECT_NAME} PROPERTIES INTERFACE_COMPILE_DEFINITIONS ${DCMTK_DEFINITIONS}) endif() From 4c8a68f9b9d44298636258abdd0138686b84286d Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 19 Jul 2023 01:22:23 -0400 Subject: [PATCH 081/115] COMP: Remove obsolete CTK copy of CMakePackageConfigHelpers This commit is a follow-up of bb46b8cde (Add support for install-able and relocatable package.) where a copy of CMakePackageConfigHelpers was integrated to support configuring using CMake 2.8.7. This was needed because the module CMakePackageConfigHelpers was introduced in CMake 2.8.8. Since CMake 3.0 is now required to build or use CTK, ths commit removes the obsolete logic checking if the CTK copy of CMakePackageConfigHelpers needed to be included. The change is consistent with configure output: [...] -- Including CMake built-in module CMakePackageConfigHelpers -- Including CMake built-in module CMakePackageConfigHelpers - ok [...] --- .../CTKGenerateCTKConfig.cmake | 12 +- .../CMakePackageConfigHelpers.cmake | 331 ------------------ 2 files changed, 1 insertion(+), 342 deletions(-) delete mode 100644 CMake/configure_package_config_file/CMakePackageConfigHelpers.cmake diff --git a/CMake/LastConfigureStep/CTKGenerateCTKConfig.cmake b/CMake/LastConfigureStep/CTKGenerateCTKConfig.cmake index 8a561029c5..65c2498eef 100644 --- a/CMake/LastConfigureStep/CTKGenerateCTKConfig.cmake +++ b/CMake/LastConfigureStep/CTKGenerateCTKConfig.cmake @@ -38,17 +38,7 @@ # one for installation. The file tells external projects how to use CTK. # -message(STATUS "Including CMake built-in module CMakePackageConfigHelpers") -include(CMakePackageConfigHelpers OPTIONAL) -if(COMMAND configure_package_config_file) - message(STATUS "Including CMake built-in module CMakePackageConfigHelpers - ok") -else() - message(STATUS "Including CMake built-in module CMakePackageConfigHelpers - failed") - message(STATUS "Including CTK module CMakePackageConfigHelpers") - list(APPEND CMAKE_MODULE_PATH ${CTK_CMAKE_DIR}/configure_package_config_file) - include(CMakePackageConfigHelpers) - message(STATUS "Including CTK module CMakePackageConfigHelpers - ok") -endif() +include(CMakePackageConfigHelpers) include(ctkFunctionGeneratePluginUseFile) diff --git a/CMake/configure_package_config_file/CMakePackageConfigHelpers.cmake b/CMake/configure_package_config_file/CMakePackageConfigHelpers.cmake deleted file mode 100644 index c1079735ec..0000000000 --- a/CMake/configure_package_config_file/CMakePackageConfigHelpers.cmake +++ /dev/null @@ -1,331 +0,0 @@ -#.rst: -# CMakePackageConfigHelpers -# ------------------------- -# -# CONFIGURE_PACKAGE_CONFIG_FILE(), WRITE_BASIC_PACKAGE_VERSION_FILE() -# -# -# -# :: -# -# CONFIGURE_PACKAGE_CONFIG_FILE( INSTALL_DESTINATION -# [PATH_VARS ... ] -# [NO_SET_AND_CHECK_MACRO] -# [NO_CHECK_REQUIRED_COMPONENTS_MACRO] -# [NO_FIND_DEPENDENCY_MACRO]) -# -# -# -# CONFIGURE_PACKAGE_CONFIG_FILE() should be used instead of the plain -# configure_file() command when creating the Config.cmake or -# -config.cmake file for installing a project or library. It -# helps making the resulting package relocatable by avoiding hardcoded -# paths in the installed Config.cmake file. -# -# In a FooConfig.cmake file there may be code like this to make the -# install destinations know to the using project: -# -# :: -# -# set(FOO_INCLUDE_DIR "@CMAKE_INSTALL_FULL_INCLUDEDIR@" ) -# set(FOO_DATA_DIR "@CMAKE_INSTALL_PREFIX@/@RELATIVE_DATA_INSTALL_DIR@" ) -# set(FOO_ICONS_DIR "@CMAKE_INSTALL_PREFIX@/share/icons" ) -# ...logic to determine installedPrefix from the own location... -# set(FOO_CONFIG_DIR "${installedPrefix}/@CONFIG_INSTALL_DIR@" ) -# -# All 4 options shown above are not sufficient, since the first 3 -# hardcode the absolute directory locations, and the 4th case works only -# if the logic to determine the installedPrefix is correct, and if -# CONFIG_INSTALL_DIR contains a relative path, which in general cannot -# be guaranteed. This has the effect that the resulting FooConfig.cmake -# file would work poorly under Windows and OSX, where users are used to -# choose the install location of a binary package at install time, -# independent from how CMAKE_INSTALL_PREFIX was set at build/cmake time. -# -# Using CONFIGURE_PACKAGE_CONFIG_FILE() helps. If used correctly, it -# makes the resulting FooConfig.cmake file relocatable. Usage: -# -# :: -# -# 1. write a FooConfig.cmake.in file as you are used to -# 2. insert a line containing only the string "@PACKAGE_INIT@" -# 3. instead of set(FOO_DIR "@SOME_INSTALL_DIR@"), use set(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@") -# (this must be after the @PACKAGE_INIT@ line) -# 4. instead of using the normal configure_file(), use CONFIGURE_PACKAGE_CONFIG_FILE() -# -# -# -# The and arguments are the input and output file, the -# same way as in configure_file(). -# -# The given to INSTALL_DESTINATION must be the destination where -# the FooConfig.cmake file will be installed to. This can either be a -# relative or absolute path, both work. -# -# The variables to given as PATH_VARS are the variables -# which contain install destinations. For each of them the macro will -# create a helper variable PACKAGE_. These helper variables -# must be used in the FooConfig.cmake.in file for setting the installed -# location. They are calculated by CONFIGURE_PACKAGE_CONFIG_FILE() so -# that they are always relative to the installed location of the -# package. This works both for relative and also for absolute -# locations. For absolute locations it works only if the absolute -# location is a subdirectory of CMAKE_INSTALL_PREFIX. -# -# By default configure_package_config_file() also generates two helper -# macros, set_and_check() and check_required_components() into the -# FooConfig.cmake file. -# -# set_and_check() should be used instead of the normal set() command for -# setting directories and file locations. Additionally to setting the -# variable it also checks that the referenced file or directory actually -# exists and fails with a FATAL_ERROR otherwise. This makes sure that -# the created FooConfig.cmake file does not contain wrong references. -# When using the NO_SET_AND_CHECK_MACRO, this macro is not generated -# into the FooConfig.cmake file. -# -# check_required_components() should be called at the end -# of the FooConfig.cmake file if the package supports components. This -# macro checks whether all requested, non-optional components have been -# found, and if this is not the case, sets the Foo_FOUND variable to -# FALSE, so that the package is considered to be not found. It does -# that by testing the Foo__FOUND variables for all requested -# required components. When using the NO_CHECK_REQUIRED_COMPONENTS -# option, this macro is not generated into the FooConfig.cmake file. -# -# For an example see below the documentation for -# WRITE_BASIC_PACKAGE_VERSION_FILE(). -# -# -# -# :: -# -# WRITE_BASIC_PACKAGE_VERSION_FILE( filename VERSION major.minor.patch COMPATIBILITY (AnyNewerVersion|SameMajorVersion|ExactVersion) ) -# -# -# -# Writes a file for use as ConfigVersion.cmake file to -# . See the documentation of find_package() for details on -# this. -# -# :: -# -# filename is the output filename, it should be in the build tree. -# major.minor.patch is the version number of the project to be installed -# -# The COMPATIBILITY mode AnyNewerVersion means that the installed -# package version will be considered compatible if it is newer or -# exactly the same as the requested version. This mode should be used -# for packages which are fully backward compatible, also across major -# versions. If SameMajorVersion is used instead, then the behaviour -# differs from AnyNewerVersion in that the major version number must be -# the same as requested, e.g. version 2.0 will not be considered -# compatible if 1.0 is requested. This mode should be used for packages -# which guarantee backward compatibility within the same major version. -# If ExactVersion is used, then the package is only considered -# compatible if the requested version matches exactly its own version -# number (not considering the tweak version). For example, version -# 1.2.3 of a package is only considered compatible to requested version -# 1.2.3. This mode is for packages without compatibility guarantees. -# If your project has more elaborated version matching rules, you will -# need to write your own custom ConfigVersion.cmake file instead of -# using this macro. -# -# Internally, this macro executes configure_file() to create the -# resulting version file. Depending on the COMPATIBILITY, either the -# file BasicConfigVersion-SameMajorVersion.cmake.in or -# BasicConfigVersion-AnyNewerVersion.cmake.in is used. Please note that -# these two files are internal to CMake and you should not call -# configure_file() on them yourself, but they can be used as starting -# point to create more sophisticated custom ConfigVersion.cmake files. -# -# -# -# Example using both configure_package_config_file() and -# write_basic_package_version_file(): CMakeLists.txt: -# -# :: -# -# set(INCLUDE_INSTALL_DIR include/ ... CACHE ) -# set(LIB_INSTALL_DIR lib/ ... CACHE ) -# set(SYSCONFIG_INSTALL_DIR etc/foo/ ... CACHE ) -# ... -# include(CMakePackageConfigHelpers) -# configure_package_config_file(FooConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake -# INSTALL_DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake -# PATH_VARS INCLUDE_INSTALL_DIR SYSCONFIG_INSTALL_DIR) -# write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake -# VERSION 1.2.3 -# COMPATIBILITY SameMajorVersion ) -# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake -# DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake ) -# -# -# -# With a FooConfig.cmake.in: -# -# :: -# -# set(FOO_VERSION x.y.z) -# ... -# @PACKAGE_INIT@ -# ... -# set_and_check(FOO_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") -# set_and_check(FOO_SYSCONFIG_DIR "@PACKAGE_SYSCONFIG_INSTALL_DIR@") -# -# -# -# :: -# -# check_required_components(Foo) - - -#============================================================================= -# Copyright 2012 Alexander Neundorf -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -include(CMakeParseArguments) - -include(WriteBasicConfigVersionFile) - -macro(WRITE_BASIC_PACKAGE_VERSION_FILE) - write_basic_config_version_file(${ARGN}) -endmacro() - - -function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile) - set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO NO_FIND_DEPENDENCY_MACRO) - set(oneValueArgs INSTALL_DESTINATION ) - set(multiValueArgs PATH_VARS ) - - cmake_parse_arguments(CCF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - if(CCF_UNPARSED_ARGUMENTS) - message(FATAL_ERROR "Unknown keywords given to CONFIGURE_PACKAGE_CONFIG_FILE(): \"${CCF_UNPARSED_ARGUMENTS}\"") - endif() - - if(NOT CCF_INSTALL_DESTINATION) - message(FATAL_ERROR "No INSTALL_DESTINATION given to CONFIGURE_PACKAGE_CONFIG_FILE()") - endif() - - if(IS_ABSOLUTE "${CCF_INSTALL_DESTINATION}") - set(absInstallDir "${CCF_INSTALL_DESTINATION}") - else() - set(absInstallDir "${CMAKE_INSTALL_PREFIX}/${CCF_INSTALL_DESTINATION}") - endif() - - file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${CMAKE_INSTALL_PREFIX}" ) - - foreach(var ${CCF_PATH_VARS}) - if(NOT DEFINED ${var}) - message(FATAL_ERROR "Variable ${var} does not exist") - else() - if(IS_ABSOLUTE "${${var}}") - string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${PACKAGE_PREFIX_DIR}" - PACKAGE_${var} "${${var}}") - else() - set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}") - endif() - endif() - endforeach() - - get_filename_component(inputFileName "${_inputFile}" NAME) - - set(PACKAGE_INIT " -####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() ####### -####### Any changes to this file will be overwritten by the next CMake run #### -####### The input file was ${inputFileName} ######## - -get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/${PACKAGE_RELATIVE_PATH}\" ABSOLUTE) -") - - if("${absInstallDir}" MATCHES "^(/usr)?/lib(64)?/.+") - # Handle "/usr move" symlinks created by some Linux distros. - set(PACKAGE_INIT "${PACKAGE_INIT} -# Use original install prefix when loaded through a \"/usr move\" -# cross-prefix symbolic link such as /lib -> /usr/lib. -get_filename_component(_realCurr \"\${CMAKE_CURRENT_LIST_DIR}\" REALPATH) -get_filename_component(_realOrig \"${absInstallDir}\" REALPATH) -if(_realCurr STREQUAL _realOrig) - set(PACKAGE_PREFIX_DIR \"${CMAKE_INSTALL_PREFIX}\") -endif() -unset(_realOrig) -unset(_realCurr) -") - endif() - - if(NOT CCF_NO_SET_AND_CHECK_MACRO) - set(PACKAGE_INIT "${PACKAGE_INIT} -macro(set_and_check _var _file) - set(\${_var} \"\${_file}\") - if(NOT EXISTS \"\${_file}\") - message(FATAL_ERROR \"File or directory \${_file} referenced by variable \${_var} does not exist !\") - endif() -endmacro() -") - endif() - - - if(NOT CCF_NO_CHECK_REQUIRED_COMPONENTS_MACRO) - set(PACKAGE_INIT "${PACKAGE_INIT} -macro(check_required_components _NAME) - foreach(comp \${\${_NAME}_FIND_COMPONENTS}) - if(NOT \${_NAME}_\${comp}_FOUND) - if(\${_NAME}_FIND_REQUIRED_\${comp}) - set(\${_NAME}_FOUND FALSE) - endif() - endif() - endforeach() -endmacro() -") - endif() - - if(NOT CCF_NO_FIND_DEPENDENCY_MACRO) - set(PACKAGE_INIT "${PACKAGE_INIT} -macro(find_dependency dep) - if (NOT \${dep}_FOUND) - if (\${ARGV1}) - set(version \${ARGV1}) - endif() - set(exact_arg) - if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION_EXACT) - set(exact_arg EXACT) - endif() - set(quiet_arg) - if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) - set(quiet_arg QUIET) - endif() - set(required_arg) - if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) - set(required_arg REQUIRED) - endif() - - find_package(\${dep} \${version} \${exact_arg} \${quiet_arg} \${required_arg}) - if (NOT \${dep}_FOUND) - set(\${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE \"\${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency \${dep} could not be found.\") - set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND False) - return() - endif() - set(required_arg) - set(quiet_arg) - set(exact_arg) - endif() -endmacro() -") - endif() - - set(PACKAGE_INIT "${PACKAGE_INIT} -####################################################################################") - - configure_file("${_inputFile}" "${_outputFile}" @ONLY) - -endfunction() From 268cfdc7986ff17d3256571e7925ccce87aa547a Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 19 Jul 2023 14:45:38 -0400 Subject: [PATCH 082/115] COMP: Remove support for setting CTK_QT_VERSION to "4" --- CMake/ctkMacroSetupQt.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMake/ctkMacroSetupQt.cmake b/CMake/ctkMacroSetupQt.cmake index 00a4dfacba..fd2813758a 100644 --- a/CMake/ctkMacroSetupQt.cmake +++ b/CMake/ctkMacroSetupQt.cmake @@ -23,10 +23,10 @@ macro(ctkMacroSetupQt) set(CTK_QT_VERSION "5" CACHE STRING "Expected Qt version") mark_as_advanced(CTK_QT_VERSION) - set_property(CACHE CTK_QT_VERSION PROPERTY STRINGS 4 5) + set_property(CACHE CTK_QT_VERSION PROPERTY STRINGS 5) - if(NOT (CTK_QT_VERSION VERSION_EQUAL "4" OR CTK_QT_VERSION VERSION_EQUAL "5")) - message(FATAL_ERROR "Expected value for CTK_QT_VERSION is either '4' or '5'") + if(NOT CTK_QT_VERSION VERSION_EQUAL "5") + message(FATAL_ERROR "Expected value for CTK_QT_VERSION is '5'") endif() From b86197b7ca9fd79c93702a114d87321de7229e7a Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Tue, 18 Jul 2023 17:50:26 -0400 Subject: [PATCH 083/115] COMP: Update C++ source files removing code specific to Qt 4 --- .../ctkCmdLineModuleExplorerMainWindow.cpp | 8 -- .../ctkCmdLineModuleConcurrentHelpers.cpp | 4 - .../Core/ctkCmdLineModuleFutureInterface.cpp | 13 +- .../Core/ctkCmdLineModuleFutureInterface.h | 4 - .../Snippets/ModuleManager/main.cpp | 8 -- .../ctkCmdLineModuleFrontendQtWebKit_p.h | 2 +- Libs/Core/Testing/Cpp/ctkDummyPlugin.cpp | 5 - .../Testing/Cpp/ctkUtilsIsDirEmptyTest1.cpp | 16 --- Libs/Core/Testing/Cpp/ctkUtilsTest.cpp | 5 - Libs/Core/ctkErrorLogQtMessageHandler.cpp | 63 --------- Libs/DICOM/Core/ctkDICOMQuery.h | 5 - .../Plugins/ctkDICOMWidgetsPlugins.cpp | 7 - .../Testing/Cpp/ctkDICOMModelTest2.cpp | 5 - Libs/DICOM/Widgets/ctkDICOMBrowser.cpp | 4 - .../Widgets/ctkDICOMServerNodeWidget.cpp | 5 - Libs/DICOM/Widgets/ctkDICOMTableView.cpp | 13 -- .../app_test/ctkTestAppActivator.cpp | 6 +- .../pluginA1_test/ctkTestPluginAActivator.cpp | 6 +- .../ctkTestPluginA2Activator.cpp | 6 +- .../pluginA_test/ctkTestPluginAActivator.cpp | 6 +- .../pluginSL1_test/ctkActivatorSL1.cpp | 6 +- .../pluginSL3_test/ctkActivatorSL3.cpp | 8 +- .../pluginSL4_test/ctkActivator.cpp | 6 +- .../pluginS_test/ctkTestPluginSActivator.cpp | 6 +- .../ctkTestPluginMTAttrPwdActivator.cpp | 7 +- .../pluginAttrPwd_test_de.ts | 4 +- .../ctkConfigAdminTestActivator.cpp | 6 +- .../ctkEventAdminTestPerfActivator.cpp | 6 +- .../ctkEventAdminTestActivator.cpp | 6 +- .../ctkMetaTypeTestActivator.cpp | 6 +- .../ctkPluginFrameworkTestPerfActivator.cpp | 6 +- .../ctkPluginFrameworkTestActivator.cpp | 6 +- .../ctkPluginAbstractTracked.tpp | 4 +- .../ctkScriptingPythonWidgetsPlugins.cpp | 7 - .../Widgets/Plugins/ctkVTKWidgetsPlugins.cpp | 7 - .../VTK/Widgets/ctkVTKMagnifyView.cpp | 4 - Libs/Widgets/CMakeLists.txt | 5 +- Libs/Widgets/Plugins/ctkWidgetsPlugins.cpp | 7 - ...leHeaderViewEventTranslatorPlayerTest1.cpp | 9 -- .../Testing/Cpp/ctkPathLineEditTest1.cpp | 8 -- Libs/Widgets/ctkActionsWidget.cpp | 8 -- Libs/Widgets/ctkCheckableComboBox.cpp | 10 -- Libs/Widgets/ctkCollapsibleButton.cpp | 14 -- Libs/Widgets/ctkDoubleSpinBox.cpp | 14 -- Libs/Widgets/ctkIconEnginePlugin.cpp | 8 -- Libs/Widgets/ctkIconEnginePlugin.h | 4 - Libs/Widgets/ctkIconEnginePlugin_qt4.h | 125 ------------------ Libs/Widgets/ctkPixmapIconEngine.cpp | 18 --- Libs/Widgets/ctkSearchBox.cpp | 81 ------------ Libs/Widgets/ctkTestApplication.cpp | 14 -- Libs/Widgets/ctkTestApplication.h | 4 - Libs/Widgets/ctkTreeComboBox.cpp | 9 -- Libs/Widgets/ctkWidgetsUtils.cpp | 4 - Libs/XNAT/Core/Testing/ctkXnatSessionTest.cpp | 5 - Libs/XNAT/Core/ctkXnatAPI.cpp | 6 - Libs/XNAT/Core/ctkXnatSession.cpp | 8 -- .../ctkConfigurationAdminActivator.cpp | 7 +- .../ctkCommandLineModuleAppLogic.cpp | 10 +- .../ctkCommandLineModuleAppPlugin.cpp | 6 +- .../ctkDicomAppHostingCorePlugin.cpp | 7 +- .../ctkExampleDicomAppPlugin.cpp | 6 +- .../ctkExampleDicomHostPlugin.cpp | 7 - .../ctkDicomHostPlugin.cpp | 6 +- .../ctkDicomAppPlugin.cpp | 6 +- .../ctkEventAdminActivator.cpp | 7 +- Plugins/org.commontk.log/ctkLogPlugin.cpp | 6 +- .../ctkMetaTypeActivator.cpp | 7 +- .../ctkPluginGeneratorCorePlugin.cpp | 6 +- .../ctkPluginGeneratorUiPlugin.cpp | 6 +- 69 files changed, 36 insertions(+), 698 deletions(-) delete mode 100644 Libs/Widgets/ctkIconEnginePlugin_qt4.h diff --git a/Applications/ctkCommandLineModuleExplorer/ctkCmdLineModuleExplorerMainWindow.cpp b/Applications/ctkCommandLineModuleExplorer/ctkCmdLineModuleExplorerMainWindow.cpp index 88eb860243..85dba508b6 100644 --- a/Applications/ctkCommandLineModuleExplorer/ctkCmdLineModuleExplorerMainWindow.cpp +++ b/Applications/ctkCommandLineModuleExplorer/ctkCmdLineModuleExplorerMainWindow.cpp @@ -45,11 +45,7 @@ #include #include -#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) -#include -#else #include -#endif #include #include #include @@ -61,11 +57,7 @@ ctkCLModuleExplorerMainWindow::ctkCLModuleExplorerMainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::ctkCmdLineModuleExplorerMainWindow), defaultModuleFrontendFactory(NULL), - #if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) - moduleManager(ctkCmdLineModuleManager::WEAK_VALIDATION, QDesktopServices::storageLocation(QDesktopServices::CacheLocation)), - #else moduleManager(ctkCmdLineModuleManager::WEAK_VALIDATION, QStandardPaths::writableLocation(QStandardPaths::CacheLocation)), - #endif directoryWatcher(&moduleManager), settingsDialog(NULL) { diff --git a/Libs/CommandLineModules/Core/ctkCmdLineModuleConcurrentHelpers.cpp b/Libs/CommandLineModules/Core/ctkCmdLineModuleConcurrentHelpers.cpp index e0e2ecdd2e..34fc0bbc9d 100644 --- a/Libs/CommandLineModules/Core/ctkCmdLineModuleConcurrentHelpers.cpp +++ b/Libs/CommandLineModules/Core/ctkCmdLineModuleConcurrentHelpers.cpp @@ -56,11 +56,7 @@ ctkCmdLineModuleReferenceResult ctkCmdLineModuleConcurrentRegister::operator()(c } return ctkCmdLineModuleReferenceResult(moduleUrl, e.message()); } -#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0)) catch (const QException& e) -#else - catch (const QtConcurrent::Exception& e) -#endif { if (this->Debug) { diff --git a/Libs/CommandLineModules/Core/ctkCmdLineModuleFutureInterface.cpp b/Libs/CommandLineModules/Core/ctkCmdLineModuleFutureInterface.cpp index d54483bbb5..dd2f337e0d 100644 --- a/Libs/CommandLineModules/Core/ctkCmdLineModuleFutureInterface.cpp +++ b/Libs/CommandLineModules/Core/ctkCmdLineModuleFutureInterface.cpp @@ -90,9 +90,7 @@ QFutureInterface::QFutureInterface(State initialState) : QFutureInterfaceBase(initialState) , d(new ctkCmdLineModuleFutureInterfacePrivate(this)) { -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) refT(); -#endif } //---------------------------------------------------------------------------- @@ -100,19 +98,14 @@ QFutureInterface::QFutureInterface(const QFutureInterfac : QFutureInterfaceBase(other) , d(other.d) { -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) refT(); -#endif d->RefCount.ref(); } //---------------------------------------------------------------------------- QFutureInterface::~QFutureInterface() { -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) - if (referenceCountIsOne()) - resultStore().clear(); -#elif QT_VERSION < QT_VERSION_CHECK(5,9,0) +#if QT_VERSION < QT_VERSION_CHECK(5,9,0) if (!derefT()) resultStore().clear(); #else @@ -136,12 +129,8 @@ QFutureInterface QFutureInterface& QFutureInterface::operator=(const QFutureInterface& other) { -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) - if (referenceCountIsOne()) -#else other.refT(); if (!derefT()) -#endif #if QT_VERSION < QT_VERSION_CHECK(5,9,0) resultStore().clear(); #else diff --git a/Libs/CommandLineModules/Core/ctkCmdLineModuleFutureInterface.h b/Libs/CommandLineModules/Core/ctkCmdLineModuleFutureInterface.h index 9bc6598773..20581aa8c7 100644 --- a/Libs/CommandLineModules/Core/ctkCmdLineModuleFutureInterface.h +++ b/Libs/CommandLineModules/Core/ctkCmdLineModuleFutureInterface.h @@ -27,12 +27,8 @@ #include "ctkCmdLineModuleResult.h" #include -#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) -#include -#else #include #include -#endif class ctkCmdLineModuleFuture; diff --git a/Libs/CommandLineModules/Documentation/Snippets/ModuleManager/main.cpp b/Libs/CommandLineModules/Documentation/Snippets/ModuleManager/main.cpp index 56aa421cc4..4ff94dec25 100644 --- a/Libs/CommandLineModules/Documentation/Snippets/ModuleManager/main.cpp +++ b/Libs/CommandLineModules/Documentation/Snippets/ModuleManager/main.cpp @@ -28,11 +28,7 @@ #include "ctkCmdLineModuleRunException.h" #include -#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) -#include -#else #include -#endif #include #include #include @@ -51,11 +47,7 @@ int main(int argc, char** argv) // Use "strict" validation mode, rejecting modules with non-valid XML descriptions. ctkCmdLineModuleManager::STRICT_VALIDATION, // Use the default cache location for this application - #if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) - QDesktopServices::storageLocation(QDesktopServices::CacheLocation) - #else QStandardPaths::writableLocation(QStandardPaths::CacheLocation) - #endif ); // [instantiate-mm] diff --git a/Libs/CommandLineModules/Frontend/QtWebKit/ctkCmdLineModuleFrontendQtWebKit_p.h b/Libs/CommandLineModules/Frontend/QtWebKit/ctkCmdLineModuleFrontendQtWebKit_p.h index 749d972221..e42295ebd8 100644 --- a/Libs/CommandLineModules/Frontend/QtWebKit/ctkCmdLineModuleFrontendQtWebKit_p.h +++ b/Libs/CommandLineModules/Frontend/QtWebKit/ctkCmdLineModuleFrontendQtWebKit_p.h @@ -53,7 +53,7 @@ class ctkCmdLineModuleFrontendQtWebKit : public ctkCmdLineModuleFrontend //virtual QList parameterNames() const; private: -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) +#if QT_VERSION < QT_VERSION_CHECK(5,6,0) mutable QWebView* WebView; #else mutable QWebEngineView* WebView; diff --git a/Libs/Core/Testing/Cpp/ctkDummyPlugin.cpp b/Libs/Core/Testing/Cpp/ctkDummyPlugin.cpp index 976605e2ca..73f2e428ce 100644 --- a/Libs/Core/Testing/Cpp/ctkDummyPlugin.cpp +++ b/Libs/Core/Testing/Cpp/ctkDummyPlugin.cpp @@ -20,7 +20,6 @@ // Qt includes #include -#include // CTK includes #include "ctkDummyPlugin.h" @@ -43,7 +42,3 @@ void ctkDummyPlugin::dummyInterface() { qDebug() << "dummyInterface()"; } - -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) -Q_EXPORT_PLUGIN2( ctkDummyPlugin , ctkDummyPlugin) -#endif diff --git a/Libs/Core/Testing/Cpp/ctkUtilsIsDirEmptyTest1.cpp b/Libs/Core/Testing/Cpp/ctkUtilsIsDirEmptyTest1.cpp index f5ee7288c9..e464407e8c 100644 --- a/Libs/Core/Testing/Cpp/ctkUtilsIsDirEmptyTest1.cpp +++ b/Libs/Core/Testing/Cpp/ctkUtilsIsDirEmptyTest1.cpp @@ -20,9 +20,7 @@ // Qt includes #include -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #include -#endif #include // CTK includes @@ -39,18 +37,8 @@ int ctkUtilsIsDirEmptyTest1(int argc, char * argv [] ) Q_UNUSED(argc); Q_UNUSED(argv); -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) QTemporaryDir tempDir; CHECK_BOOL(tempDir.isValid(), true); -#else - QDir tmp = QDir::temp(); - QString temporaryDirName = - QString("ctkUtilsIsDirEmptyTest1.%1").arg(QTime::currentTime().toString("hhmmsszzz")); - tmp.mkdir(temporaryDirName); - bool isValid = tmp.cd(temporaryDirName); - CHECK_BOOL(isValid, true); - QDir tempDir = QDir(tmp.absolutePath()); -#endif #if (QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)) CHECK_BOOL(QFileInfo::exists(tempDir.path()), true); @@ -72,10 +60,6 @@ int ctkUtilsIsDirEmptyTest1(int argc, char * argv [] ) CHECK_BOOL(ctk::isDirEmpty(QDir(tempDir.path())), false); -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) // QTemporaryDir is automatically deleted -#else - ctk::removeDirRecursively(tempDir.path()); -#endif return EXIT_SUCCESS; } diff --git a/Libs/Core/Testing/Cpp/ctkUtilsTest.cpp b/Libs/Core/Testing/Cpp/ctkUtilsTest.cpp index eaa38f8251..6a489c56cd 100644 --- a/Libs/Core/Testing/Cpp/ctkUtilsTest.cpp +++ b/Libs/Core/Testing/Cpp/ctkUtilsTest.cpp @@ -402,11 +402,6 @@ void ctkUtilsTester::testTakeFirst_data() << (QStringList() << "cloud" << "sun" << "rain"); } -// ---------------------------------------------------------------------------- -#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) -Q_DECLARE_METATYPE (QSet) -#endif - // ---------------------------------------------------------------------------- CTK_TEST_MAIN(ctkUtilsTest) #include "moc_ctkUtilsTest.cpp" diff --git a/Libs/Core/ctkErrorLogQtMessageHandler.cpp b/Libs/Core/ctkErrorLogQtMessageHandler.cpp index 74292dbfae..1d7b72806a 100644 --- a/Libs/Core/ctkErrorLogQtMessageHandler.cpp +++ b/Libs/Core/ctkErrorLogQtMessageHandler.cpp @@ -61,7 +61,6 @@ ctkErrorLogQtMessageHandler::ctkErrorLogQtMessageHandler(QObject* parent) namespace { //------------------------------------------------------------------------------ -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) void ctkErrorLogModelQtMessageOutput(QtMsgType type, const QMessageLogContext& context, const QString& msg) { @@ -127,60 +126,6 @@ void ctkErrorLogModelQtMessageOutput(QtMsgType type, const QMessageLogContext& c } ctkErrorLogQtMessageHandler_CurrentRecursionDepth.deref(); } -#else -void ctkErrorLogModelQtMessageOutput(QtMsgType type, const char *msg) -{ - ctkErrorLogQtMessageHandler_CurrentRecursionDepth.ref(); - // Allow a couple of recursion levels to get a hint about where and why recursion occurs, - // so we stop processing the message if recursion depth is over 10. - if (ctkErrorLogQtMessageHandler_CurrentRecursionDepth > 10) - { - ctkErrorLogQtMessageHandler_CurrentRecursionDepth.deref(); - return; - } - - // Warning: To avoid infinite loop, do not use Q_ASSERT in this function. - if (QString(msg).isEmpty()) - { - ctkErrorLogQtMessageHandler_CurrentRecursionDepth.deref(); - return; - } - ctkErrorLogLevel::LogLevel level = ctkErrorLogLevel::Unknown; - if (type == QtDebugMsg) - { - level = ctkErrorLogLevel::Debug; - } - else if (type == QtWarningMsg) - { - level = ctkErrorLogLevel::Warning; - } - else if (type == QtCriticalMsg) - { - level = ctkErrorLogLevel::Critical; - } - else if (type == QtFatalMsg) - { - level = ctkErrorLogLevel::Fatal; - } - - QCoreApplication * coreApp = QCoreApplication::instance(); - QList handlers = coreApp->property("ctkErrorLogQtMessageHandlers").toList(); - foreach(QVariant v, handlers) - { - ctkErrorLogQtMessageHandler* handler = v.value(); - Q_ASSERT(handler); -// //QPointer handler = v.value >(); -// //if(handler.isNull()) -// // { -// // continue; -// // } - handler->handleMessage( - ctk::qtHandleToString(QThread::currentThreadId()), - level, handler->handlerPrettyName(), ctkErrorLogContext(msg), msg); - } - ctkErrorLogQtMessageHandler_CurrentRecursionDepth.deref(); -} -#endif } // -------------------------------------------------------------------------- @@ -194,18 +139,10 @@ void ctkErrorLogQtMessageHandler::setEnabledInternal(bool value) { if (value) { -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) this->SavedQtMessageHandler = qInstallMessageHandler(ctkErrorLogModelQtMessageOutput); -#else - this->SavedQtMessageHandler = qInstallMsgHandler(ctkErrorLogModelQtMessageOutput); -#endif } else { -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) qInstallMessageHandler(this->SavedQtMessageHandler); -#else - qInstallMsgHandler(this->SavedQtMessageHandler); -#endif } } diff --git a/Libs/DICOM/Core/ctkDICOMQuery.h b/Libs/DICOM/Core/ctkDICOMQuery.h index ad8ab12ab2..613ac55629 100644 --- a/Libs/DICOM/Core/ctkDICOMQuery.h +++ b/Libs/DICOM/Core/ctkDICOMQuery.h @@ -44,13 +44,8 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMQuery : public QObject Q_PROPERTY(QString host READ host WRITE setHost); Q_PROPERTY(int port READ port WRITE setPort); Q_PROPERTY(bool preferCGET READ preferCGET WRITE setPreferCGET); -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) Q_PROPERTY(QList< QPair > studyAndSeriesInstanceUIDQueried READ studyAndSeriesInstanceUIDQueried); Q_PROPERTY(QMap filters READ filters WRITE setFilters); -#else - Q_PROPERTY(QList studyAndSeriesInstanceUIDQueried READ studyAndSeriesInstanceUIDQueried); - Q_PROPERTY(QMap filters READ filters WRITE setFilters); -#endif public: explicit ctkDICOMQuery(QObject* parent = 0); diff --git a/Libs/DICOM/Widgets/Plugins/ctkDICOMWidgetsPlugins.cpp b/Libs/DICOM/Widgets/Plugins/ctkDICOMWidgetsPlugins.cpp index f1ddcca176..94b8552b6f 100644 --- a/Libs/DICOM/Widgets/Plugins/ctkDICOMWidgetsPlugins.cpp +++ b/Libs/DICOM/Widgets/Plugins/ctkDICOMWidgetsPlugins.cpp @@ -18,12 +18,5 @@ =========================================================================*/ -// Qt includes -#include - // CTK includes #include "ctkDICOMWidgetsPlugins.h" - -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) -Q_EXPORT_PLUGIN2(customwidgetplugin, ctkDICOMWidgetsPlugins); -#endif diff --git a/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMModelTest2.cpp b/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMModelTest2.cpp index faf1f43acf..4e8fe22fe5 100644 --- a/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMModelTest2.cpp +++ b/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMModelTest2.cpp @@ -76,13 +76,8 @@ int ctkDICOMModelTest2( int argc, char * argv [] ) QHeaderView* previousHeaderView = viewer.header(); qDebug() << "previous: " << previousHeaderView->isHidden(); ctkCheckableHeaderView* headerView = new ctkCheckableHeaderView(Qt::Horizontal, &viewer); -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) - headerView->setClickable(previousHeaderView->isClickable()); - headerView->setMovable(previousHeaderView->isMovable()); -#else headerView->setSectionsClickable(previousHeaderView->sectionsClickable()); headerView->setSectionsMovable(previousHeaderView->sectionsMovable()); -#endif headerView->setHighlightSections(previousHeaderView->highlightSections()); headerView->checkableModelHelper()->setPropagateDepth(-1); headerView->checkableModelHelper()->setForceCheckability(true); diff --git a/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp b/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp index ba809881e4..344810e1f7 100644 --- a/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp @@ -1450,11 +1450,7 @@ void ctkDICOMBrowser::exportSeries(QString dirPath, QStringList uids) foreach (const QString& filePath, filesForSeries) { // File name example: my/destination/folder/000001.dcm -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) QString destinationFileName = QStringLiteral("%1%2.dcm").arg(destinationDir).arg(fileNumber, 6, 10, QLatin1Char('0')); -#else - QString destinationFileName = QString("%1%2.dcm").arg(destinationDir).arg(fileNumber, 6, 10, QLatin1Char('0')); -#endif if (!QFile::exists(filePath)) { diff --git a/Libs/DICOM/Widgets/ctkDICOMServerNodeWidget.cpp b/Libs/DICOM/Widgets/ctkDICOMServerNodeWidget.cpp index 552602f038..f6e793aa23 100644 --- a/Libs/DICOM/Widgets/ctkDICOMServerNodeWidget.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMServerNodeWidget.cpp @@ -64,13 +64,8 @@ ctkDICOMServerNodeWidget::ctkDICOMServerNodeWidget(QWidget* parentWidget) NameColumn, Qt::Horizontal, static_cast(Qt::Unchecked), Qt::CheckStateRole); QHeaderView* previousHeaderView = d->NodeTable->horizontalHeader(); ctkCheckableHeaderView* headerView = new ctkCheckableHeaderView(Qt::Horizontal, d->NodeTable); -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) headerView->setSectionsClickable(previousHeaderView->sectionsClickable()); headerView->setSectionsMovable(previousHeaderView->sectionsMovable()); -#else - headerView->setClickable(previousHeaderView->isClickable()); - headerView->setMovable(previousHeaderView->isMovable()); -#endif headerView->setHighlightSections(previousHeaderView->highlightSections()); headerView->checkableModelHelper()->setPropagateDepth(-1); d->NodeTable->setHorizontalHeader(headerView); diff --git a/Libs/DICOM/Widgets/ctkDICOMTableView.cpp b/Libs/DICOM/Widgets/ctkDICOMTableView.cpp index 240aa3d8a4..739984b85f 100644 --- a/Libs/DICOM/Widgets/ctkDICOMTableView.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMTableView.cpp @@ -23,9 +23,7 @@ #include "ui_ctkDICOMTableView.h" // Qt includes -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) #include -#endif #include #include #include @@ -171,13 +169,8 @@ void ctkDICOMTableViewPrivate::init() this->dicomSQLFilterModel->setFilterCaseSensitivity(Qt::CaseInsensitive); this->tblDicomDatabaseView->setModel(this->dicomSQLFilterModel); this->tblDicomDatabaseView->setSortingEnabled(true); -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) - this->tblDicomDatabaseView->horizontalHeader()->setResizeMode(QHeaderView::Interactive); - this->tblDicomDatabaseView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents); -#else this->tblDicomDatabaseView->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive); this->tblDicomDatabaseView->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); -#endif this->tblDicomDatabaseView->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft); QObject::connect(this->tblDicomDatabaseView->selectionModel(), @@ -260,7 +253,6 @@ void ctkDICOMTableViewPrivate::applyColumnProperties() QHeaderView::ResizeMode columnResizeMode = QHeaderView::Interactive; if (!fieldFormat.isEmpty()) { -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) QJsonDocument fieldFormatDoc = QJsonDocument::fromJson(fieldFormat.toUtf8()); QJsonObject fieldFormatObj; if (!fieldFormatDoc.isNull()) @@ -314,17 +306,12 @@ void ctkDICOMTableViewPrivate::applyColumnProperties() } else -#endif { // format string is specified but failed to be decoded from json qWarning() << "Invalid ColumnDisplayProperties Format string for column " << columnName << ": " << fieldFormat; } } -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) - this->tblDicomDatabaseView->horizontalHeader()->setResizeMode(col, columnResizeMode); -#else this->tblDicomDatabaseView->horizontalHeader()->setSectionResizeMode(col, columnResizeMode); -#endif if (columnResizeMode == QHeaderView::Stretch && visibility) { diff --git a/Libs/PluginFramework/Testing/FrameworkTestPlugins/app_test/ctkTestAppActivator.cpp b/Libs/PluginFramework/Testing/FrameworkTestPlugins/app_test/ctkTestAppActivator.cpp index a70801fb9b..eff1076b09 100644 --- a/Libs/PluginFramework/Testing/FrameworkTestPlugins/app_test/ctkTestAppActivator.cpp +++ b/Libs/PluginFramework/Testing/FrameworkTestPlugins/app_test/ctkTestAppActivator.cpp @@ -27,7 +27,7 @@ #include -#include +#include #include //---------------------------------------------------------------------------- @@ -55,7 +55,3 @@ void ctkTestAppActivator::stop(ctkPluginContext* context) Q_UNUSED(context) appContainer->stop(); } - -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) -Q_EXPORT_PLUGIN2(app_test, ctkTestAppActivator) -#endif diff --git a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginA1_test/ctkTestPluginAActivator.cpp b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginA1_test/ctkTestPluginAActivator.cpp index c4d7f72039..f152a476ff 100644 --- a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginA1_test/ctkTestPluginAActivator.cpp +++ b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginA1_test/ctkTestPluginAActivator.cpp @@ -25,7 +25,7 @@ #include -#include +#include //---------------------------------------------------------------------------- void ctkTestPluginAActivator::start(ctkPluginContext* context) @@ -38,7 +38,3 @@ void ctkTestPluginAActivator::stop(ctkPluginContext* context) { Q_UNUSED(context) } - -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) -Q_EXPORT_PLUGIN2(pluginA1_test, ctkTestPluginAActivator) -#endif diff --git a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginA2_test/ctkTestPluginA2Activator.cpp b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginA2_test/ctkTestPluginA2Activator.cpp index ab6d6d8329..be453d1e5c 100644 --- a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginA2_test/ctkTestPluginA2Activator.cpp +++ b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginA2_test/ctkTestPluginA2Activator.cpp @@ -24,7 +24,7 @@ #include -#include +#include //---------------------------------------------------------------------------- void ctkTestPluginA2Activator::start(ctkPluginContext* context) @@ -38,7 +38,3 @@ void ctkTestPluginA2Activator::stop(ctkPluginContext* context) Q_UNUSED(context) s->unregister(); } - -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) -Q_EXPORT_PLUGIN2(pluginA2_test, ctkTestPluginA2Activator) -#endif diff --git a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginA_test/ctkTestPluginAActivator.cpp b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginA_test/ctkTestPluginAActivator.cpp index d1b3f86d72..f152a476ff 100644 --- a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginA_test/ctkTestPluginAActivator.cpp +++ b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginA_test/ctkTestPluginAActivator.cpp @@ -25,7 +25,7 @@ #include -#include +#include //---------------------------------------------------------------------------- void ctkTestPluginAActivator::start(ctkPluginContext* context) @@ -38,7 +38,3 @@ void ctkTestPluginAActivator::stop(ctkPluginContext* context) { Q_UNUSED(context) } - -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) -Q_EXPORT_PLUGIN2(pluginA_test, ctkTestPluginAActivator) -#endif diff --git a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginSL1_test/ctkActivatorSL1.cpp b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginSL1_test/ctkActivatorSL1.cpp index c55f52fce2..1d481949ee 100644 --- a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginSL1_test/ctkActivatorSL1.cpp +++ b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginSL1_test/ctkActivatorSL1.cpp @@ -23,7 +23,7 @@ #include "ctkActivatorSL1_p.h" #include "ctkFooService.h" -#include +#include #include //---------------------------------------------------------------------------- @@ -94,7 +94,3 @@ void ctkActivatorSL1::removedService(const ctkServiceReference& reference, ctkFo _serviceRemoved = true; qDebug() << "Removing reference =" << reference; } - -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) -Q_EXPORT_PLUGIN2(pluginSL1_test, ctkActivatorSL1) -#endif diff --git a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginSL3_test/ctkActivatorSL3.cpp b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginSL3_test/ctkActivatorSL3.cpp index ac422709c7..b3dd9f26c2 100644 --- a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginSL3_test/ctkActivatorSL3.cpp +++ b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginSL3_test/ctkActivatorSL3.cpp @@ -24,7 +24,7 @@ #include -#include +#include #include //---------------------------------------------------------------------------- @@ -93,9 +93,3 @@ void ctkActivatorSL3::removedService(const ctkServiceReference& reference, ctkFo _serviceRemoved = true; qDebug() << "SL3: Removing reference =" << reference; } - -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) -Q_EXPORT_PLUGIN2(pluginSL3_test, ctkActivatorSL3) -#endif - - diff --git a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginSL4_test/ctkActivator.cpp b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginSL4_test/ctkActivator.cpp index 54c18a611e..0e5f44084e 100644 --- a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginSL4_test/ctkActivator.cpp +++ b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginSL4_test/ctkActivator.cpp @@ -22,7 +22,7 @@ #include "ctkActivator_p.h" -#include +#include #include #include @@ -46,7 +46,3 @@ void ctkActivator::stop(ctkPluginContext* context) Q_UNUSED(context) //unregister will be done automagically } - -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) -Q_EXPORT_PLUGIN2(pluginSL4_test, ctkActivator) -#endif diff --git a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginS_test/ctkTestPluginSActivator.cpp b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginS_test/ctkTestPluginSActivator.cpp index 804edfaf5a..51ba7273d4 100644 --- a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginS_test/ctkTestPluginSActivator.cpp +++ b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginS_test/ctkTestPluginSActivator.cpp @@ -25,7 +25,7 @@ #include -#include +#include //---------------------------------------------------------------------------- void ctkTestPluginSActivator::start(ctkPluginContext* context) @@ -50,7 +50,3 @@ ctkTestPluginSActivator::ctkTestPluginSActivator() { } - -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) -Q_EXPORT_PLUGIN2(pluginS_test, ctkTestPluginSActivator) -#endif diff --git a/Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/ctkTestPluginMTAttrPwdActivator.cpp b/Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/ctkTestPluginMTAttrPwdActivator.cpp index 91ba939efd..c415ee3414 100644 --- a/Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/ctkTestPluginMTAttrPwdActivator.cpp +++ b/Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/ctkTestPluginMTAttrPwdActivator.cpp @@ -21,7 +21,8 @@ #include "ctkTestPluginMTAttrPwdActivator_p.h" -#include + +#include //---------------------------------------------------------------------------- void ctkTestPluginMTAttrPwdActivator::start(ctkPluginContext* context) @@ -36,7 +37,3 @@ void ctkTestPluginMTAttrPwdActivator::stop(ctkPluginContext* context) { Q_UNUSED(context) } - -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) -Q_EXPORT_PLUGIN2(pluginAttrPwd_test, ctkTestPluginMTAttrPwdActivator) -#endif diff --git a/Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/pluginAttrPwd_test_de.ts b/Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/pluginAttrPwd_test_de.ts index 08ad77ff03..6a49c0c967 100644 --- a/Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/pluginAttrPwd_test_de.ts +++ b/Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/pluginAttrPwd_test_de.ts @@ -4,12 +4,12 @@ ctkTestPluginMTAttrPwdActivator - + Object Objekt - + My object class definition Meine Objektklassendefinition diff --git a/Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigAdminTestActivator.cpp b/Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigAdminTestActivator.cpp index 746755b825..10587399bf 100644 --- a/Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigAdminTestActivator.cpp +++ b/Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigAdminTestActivator.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include "ctkConfigurationAdminTestSuite_p.h" @@ -105,7 +105,3 @@ void ctkConfigAdminTestActivator::stop(ctkPluginContext* context) configPluginTestSuite = 0; configListenerTestSuite = 0; } - -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) -Q_EXPORT_PLUGIN2(org_commontk_configadmintest, ctkConfigAdminTestActivator) -#endif diff --git a/Libs/PluginFramework/Testing/org.commontk.eventadmintest.perf/ctkEventAdminTestPerfActivator.cpp b/Libs/PluginFramework/Testing/org.commontk.eventadmintest.perf/ctkEventAdminTestPerfActivator.cpp index 65e819efa5..0799b9765e 100644 --- a/Libs/PluginFramework/Testing/org.commontk.eventadmintest.perf/ctkEventAdminTestPerfActivator.cpp +++ b/Libs/PluginFramework/Testing/org.commontk.eventadmintest.perf/ctkEventAdminTestPerfActivator.cpp @@ -23,7 +23,7 @@ #include "ctkEventAdminPerfTestSuite_p.h" -#include +#include //---------------------------------------------------------------------------- @@ -78,7 +78,3 @@ void ctkEventAdminTestPerfActivator::stop(ctkPluginContext* context) delete perfTestSuite; perfTestSuite = 0; } - -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) -Q_EXPORT_PLUGIN2(org_commontk_eventadmintest_perf, ctkEventAdminTestPerfActivator) -#endif diff --git a/Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEventAdminTestActivator.cpp b/Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEventAdminTestActivator.cpp index b0ecb26fa1..d3634bb0e3 100644 --- a/Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEventAdminTestActivator.cpp +++ b/Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEventAdminTestActivator.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include "ctkEATopicWildcardTestSuite_p.h" @@ -128,7 +128,3 @@ void ctkEventAdminTestActivator::stop(ctkPluginContext* context) scenario3TestSuite = 0; scenario4TestSuite = 0; } - -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) -Q_EXPORT_PLUGIN2(org_commontk_eventadmintest, ctkEventAdminTestActivator) -#endif diff --git a/Libs/PluginFramework/Testing/org.commontk.metatypetest/ctkMetaTypeTestActivator.cpp b/Libs/PluginFramework/Testing/org.commontk.metatypetest/ctkMetaTypeTestActivator.cpp index d2ab402d3c..f5356dde9b 100644 --- a/Libs/PluginFramework/Testing/org.commontk.metatypetest/ctkMetaTypeTestActivator.cpp +++ b/Libs/PluginFramework/Testing/org.commontk.metatypetest/ctkMetaTypeTestActivator.cpp @@ -27,7 +27,7 @@ #include "ctkMTAttrPasswordTestSuite_p.h" #include "ctkMTLocaleTestSuite_p.h" -#include +#include #include //---------------------------------------------------------------------------- @@ -81,7 +81,3 @@ void ctkMetaTypeTestActivator::stop(ctkPluginContext* context) attrPwdTestSuite = 0; localeTestSuite = 0; } - -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) -Q_EXPORT_PLUGIN2(org_commontk_metatypetest, ctkMetaTypeTestActivator) -#endif diff --git a/Libs/PluginFramework/Testing/org.commontk.pluginfwtest.perf/ctkPluginFrameworkTestPerfActivator.cpp b/Libs/PluginFramework/Testing/org.commontk.pluginfwtest.perf/ctkPluginFrameworkTestPerfActivator.cpp index 805c6552e2..9f11008906 100644 --- a/Libs/PluginFramework/Testing/org.commontk.pluginfwtest.perf/ctkPluginFrameworkTestPerfActivator.cpp +++ b/Libs/PluginFramework/Testing/org.commontk.pluginfwtest.perf/ctkPluginFrameworkTestPerfActivator.cpp @@ -23,7 +23,7 @@ #include "ctkPluginFrameworkPerfRegistryTestSuite_p.h" -#include +#include //---------------------------------------------------------------------------- @@ -54,7 +54,3 @@ void ctkPluginFrameworkTestPerfActivator::stop(ctkPluginContext* context) delete perfTestSuite; perfTestSuite = 0; } - -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) -Q_EXPORT_PLUGIN2(org_commontk_pluginfwtest_perf, ctkPluginFrameworkTestPerfActivator) -#endif diff --git a/Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkPluginFrameworkTestActivator.cpp b/Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkPluginFrameworkTestActivator.cpp index 56019fa714..3fd056ffbe 100644 --- a/Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkPluginFrameworkTestActivator.cpp +++ b/Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkPluginFrameworkTestActivator.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include #include //---------------------------------------------------------------------------- @@ -61,7 +61,3 @@ void ctkPluginFrameworkTestActivator::stop(ctkPluginContext* context) delete serviceListenerTestSuite; delete serviceTrackerTestSuite; } - -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) -Q_EXPORT_PLUGIN2(org_commontk_pluginfwtest, ctkPluginFrameworkTestActivator) -#endif diff --git a/Libs/PluginFramework/ctkPluginAbstractTracked.tpp b/Libs/PluginFramework/ctkPluginAbstractTracked.tpp index 1754385d61..525057992d 100644 --- a/Libs/PluginFramework/ctkPluginAbstractTracked.tpp +++ b/Libs/PluginFramework/ctkPluginAbstractTracked.tpp @@ -278,9 +278,7 @@ void ctkPluginAbstractTracked::modified() template int ctkPluginAbstractTracked::getTrackingCount() const { -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) - return trackingCount; -#elif QT_VERSION < QT_VERSION_CHECK(5,14,0) +#if QT_VERSION < QT_VERSION_CHECK(5,14,0) return trackingCount.load(); #else return trackingCount.loadRelaxed(); diff --git a/Libs/Scripting/Python/Widgets/Plugins/ctkScriptingPythonWidgetsPlugins.cpp b/Libs/Scripting/Python/Widgets/Plugins/ctkScriptingPythonWidgetsPlugins.cpp index f795a1f923..2179666ff0 100644 --- a/Libs/Scripting/Python/Widgets/Plugins/ctkScriptingPythonWidgetsPlugins.cpp +++ b/Libs/Scripting/Python/Widgets/Plugins/ctkScriptingPythonWidgetsPlugins.cpp @@ -18,12 +18,5 @@ =========================================================================*/ -// Qt includes -#include - // CTK includes #include "ctkScriptingPythonWidgetsPlugins.h" - -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) -Q_EXPORT_PLUGIN2(customwidgetplugin, ctkScriptingPythonWidgetsPlugins); -#endif diff --git a/Libs/Visualization/VTK/Widgets/Plugins/ctkVTKWidgetsPlugins.cpp b/Libs/Visualization/VTK/Widgets/Plugins/ctkVTKWidgetsPlugins.cpp index 3d5f274135..1081a303bc 100644 --- a/Libs/Visualization/VTK/Widgets/Plugins/ctkVTKWidgetsPlugins.cpp +++ b/Libs/Visualization/VTK/Widgets/Plugins/ctkVTKWidgetsPlugins.cpp @@ -18,12 +18,5 @@ =========================================================================*/ -// Qt includes -#include - // CTK includes #include "ctkVTKWidgetsPlugins.h" - -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) -Q_EXPORT_PLUGIN2(customwidgetplugin, ctkVTKWidgetsPlugins); -#endif diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKMagnifyView.cpp b/Libs/Visualization/VTK/Widgets/ctkVTKMagnifyView.cpp index 0074690e70..19db2bec65 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKMagnifyView.cpp +++ b/Libs/Visualization/VTK/Widgets/ctkVTKMagnifyView.cpp @@ -627,11 +627,7 @@ bool ctkVTKMagnifyView::eventFilter(QObject * obj, QEvent * event) { QMouseEvent * mouseEvent = static_cast(event); Q_ASSERT(mouseEvent); -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) d->pushUpdatePixmapEvent(mouseEvent->localPos()); -#else - d->pushUpdatePixmapEvent(mouseEvent->posF()); -#endif } // On enter, update the pixmap with the zoomed image (required for zooming when // widget is created with mouse already within it), and emit signal of enter event diff --git a/Libs/Widgets/CMakeLists.txt b/Libs/Widgets/CMakeLists.txt index c272782ffb..088f2cb744 100644 --- a/Libs/Widgets/CMakeLists.txt +++ b/Libs/Widgets/CMakeLists.txt @@ -105,7 +105,6 @@ set(KIT_SRCS ctkHistogram.h ctkIconEnginePlugin.cpp ctkIconEnginePlugin.h - ctkIconEnginePlugin_qt4.h ctkIconEnginePlugin_qt5.h ctkLanguageComboBox.cpp ctkLanguageComboBox.h @@ -314,10 +313,10 @@ set(KIT_MOC_SRCS ctkWorkflowWidgetStep_p.h ) -if(CTK_QT_VERSION VERSION_GREATER "4") +if(CTK_QT_VERSION VERSION_EQUAL "5") list(APPEND KIT_MOC_SRCS ctkIconEnginePlugin_qt5.h) else() - list(APPEND KIT_MOC_SRCS ctkIconEnginePlugin_qt4.h) + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() # Headers that should run through moc without adding diff --git a/Libs/Widgets/Plugins/ctkWidgetsPlugins.cpp b/Libs/Widgets/Plugins/ctkWidgetsPlugins.cpp index 5da131ad49..62346fb411 100644 --- a/Libs/Widgets/Plugins/ctkWidgetsPlugins.cpp +++ b/Libs/Widgets/Plugins/ctkWidgetsPlugins.cpp @@ -18,12 +18,5 @@ =========================================================================*/ -// Qt includes -#include - // CTK includes #include "ctkWidgetsPlugins.h" - -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) -Q_EXPORT_PLUGIN2(customwidgetplugin, ctkWidgetsPlugins); -#endif diff --git a/Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewEventTranslatorPlayerTest1.cpp b/Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewEventTranslatorPlayerTest1.cpp index 37c4a0d81e..bda3520bc3 100644 --- a/Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewEventTranslatorPlayerTest1.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewEventTranslatorPlayerTest1.cpp @@ -106,20 +106,11 @@ int ctkCheckableHeaderViewEventTranslatorPlayerTest1(int argc, char * argv [] ) model.setHeaderData(0, Qt::Horizontal, static_cast(Qt::Checked), Qt::CheckStateRole); QHeaderView* previousHeaderView = table.horizontalHeader(); -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) - bool oldClickable = previousHeaderView->isClickable(); -#else bool oldClickable = previousHeaderView->sectionsClickable(); -#endif ctkCheckableHeaderView* headerView = new ctkCheckableHeaderView(Qt::Horizontal, &table); -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) - headerView->setClickable(oldClickable); - headerView->setMovable(previousHeaderView->isMovable()); -#else headerView->setSectionsClickable(oldClickable); headerView->setSectionsMovable(previousHeaderView->sectionsMovable()); -#endif headerView->setHighlightSections(previousHeaderView->highlightSections()); // propagatetoitems is true by default //headerView->setPropagateToItems(true); diff --git a/Libs/Widgets/Testing/Cpp/ctkPathLineEditTest1.cpp b/Libs/Widgets/Testing/Cpp/ctkPathLineEditTest1.cpp index 66fc28308c..fb06855413 100644 --- a/Libs/Widgets/Testing/Cpp/ctkPathLineEditTest1.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkPathLineEditTest1.cpp @@ -25,11 +25,7 @@ #include #include -#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) -#include -#else #include -#endif // CTK includes #include "ctkPathLineEdit.h" @@ -54,11 +50,7 @@ int ctkPathLineEditTest1(int argc, char * argv [] ) ctkPathLineEdit button3("Dirs", QStringList(), ctkPathLineEdit::Dirs); button3.setShowHistoryButton(false); -#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) - QString documentsFolder = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation); -#else QString documentsFolder = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); -#endif button3.setCurrentPath(documentsFolder); QVBoxLayout* layout = new QVBoxLayout; diff --git a/Libs/Widgets/ctkActionsWidget.cpp b/Libs/Widgets/ctkActionsWidget.cpp index 3072fa5f85..e5c263edf9 100644 --- a/Libs/Widgets/ctkActionsWidget.cpp +++ b/Libs/Widgets/ctkActionsWidget.cpp @@ -409,11 +409,7 @@ bool ctkSortFilterActionsProxyModel::filterAcceptsRow(int source_row, const QMod void ctkRichTextItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem & option, const QModelIndex &index) const { -#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) - QStyleOptionViewItemV4 options = option; -#else QStyleOptionViewItem options = option; -#endif initStyleOption(&options, index); if (! Qt::mightBeRichText(options.text)) { @@ -442,11 +438,7 @@ void ctkRichTextItemDelegate::paint(QPainter* painter, const QStyleOptionViewIte QSize ctkRichTextItemDelegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index)const { -#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) - QStyleOptionViewItemV4 options = option; -#else QStyleOptionViewItem options = option; -#endif initStyleOption(&options, index); if (! Qt::mightBeRichText(options.text)) { diff --git a/Libs/Widgets/ctkCheckableComboBox.cpp b/Libs/Widgets/ctkCheckableComboBox.cpp index 46ad9fbcd6..217d39b4c0 100644 --- a/Libs/Widgets/ctkCheckableComboBox.cpp +++ b/Libs/Widgets/ctkCheckableComboBox.cpp @@ -73,20 +73,10 @@ class ctkComboBoxDelegate : public QItemDelegate { QRect rect = option.rect; -#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) - if (const QStyleOptionViewItemV3 *v3 = qstyleoption_cast(&option)) - { - if (const QAbstractItemView *view = qobject_cast(v3->widget)) - { - rect.setWidth(view->viewport()->width()); - } - } -#else if (const QAbstractItemView *view = qobject_cast(option.widget)) { rect.setWidth(view->viewport()->width()); } -#endif QStyleOption opt; opt.rect = rect; this->ComboBox->style()->drawPrimitive(QStyle::PE_IndicatorToolBarSeparator, &opt, painter, this->ComboBox); diff --git a/Libs/Widgets/ctkCollapsibleButton.cpp b/Libs/Widgets/ctkCollapsibleButton.cpp index d9218e3468..46a91f18b4 100644 --- a/Libs/Widgets/ctkCollapsibleButton.cpp +++ b/Libs/Widgets/ctkCollapsibleButton.cpp @@ -20,9 +20,6 @@ // Qt includes #include -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) -# include -#endif #include #include #include @@ -647,21 +644,10 @@ void ctkCollapsibleButton::paintEvent(QPaintEvent * _event) opt.text, QPalette::ButtonText); // Draw Frame around contents -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) - QStyleOptionFrameV3 fopt; -#else QStyleOptionFrame fopt; -#endif fopt.init(this); // HACK: on some styles, the frame doesn't exactly touch the button. // this is because the button has some kind of extra border. -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) - if (qobject_cast(this->style()) != 0) - { - fopt.rect.setTop(buttonHeight - 1); - } - else -#endif { fopt.rect.setTop(buttonHeight); } diff --git a/Libs/Widgets/ctkDoubleSpinBox.cpp b/Libs/Widgets/ctkDoubleSpinBox.cpp index a2f6afd8f5..639bf1592f 100644 --- a/Libs/Widgets/ctkDoubleSpinBox.cpp +++ b/Libs/Widgets/ctkDoubleSpinBox.cpp @@ -709,13 +709,6 @@ void ctkDoubleSpinBox::setPrefix(const QString &prefix) { return; } - -#if QT_VERSION < 0x040800 - /// Setting the prefix doesn't recompute the sizehint, do it manually here: - /// See: http://bugreports.qt.nokia.com/browse/QTBUG-9530 - d->SpinBox->setRange(d->SpinBox->minimum(), d->SpinBox->maximum()); -#endif - d->SpinBox->setPrefix(prefix); } @@ -734,13 +727,6 @@ void ctkDoubleSpinBox::setSuffix(const QString &suffix) { return; } - -#if QT_VERSION < 0x040800 - /// Setting the suffix doesn't recompute the sizehint, do it manually here: - /// See: http://bugreports.qt.nokia.com/browse/QTBUG-9530 - d->SpinBox->setRange(d->SpinBox->minimum(), d->SpinBox->maximum()); -#endif - d->SpinBox->setSuffix(suffix); } diff --git a/Libs/Widgets/ctkIconEnginePlugin.cpp b/Libs/Widgets/ctkIconEnginePlugin.cpp index a4007e8cbb..8d6903b1bb 100644 --- a/Libs/Widgets/ctkIconEnginePlugin.cpp +++ b/Libs/Widgets/ctkIconEnginePlugin.cpp @@ -35,11 +35,7 @@ class ctkIconEnginePluginPrivate //------------------------------------------------------------------------------ ctkIconEnginePlugin::ctkIconEnginePlugin(QObject* parentObject) -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) : QIconEnginePlugin(parentObject) -#else - : QIconEnginePluginV2(parentObject) -#endif , d_ptr(new ctkIconEnginePluginPrivate) { } @@ -50,11 +46,7 @@ ctkIconEnginePlugin::~ctkIconEnginePlugin() } //------------------------------------------------------------------------------ -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) QIconEngine* ctkIconEnginePlugin::create(const QString& fileName) -#else -QIconEngineV2* ctkIconEnginePlugin::create(const QString& fileName) -#endif { Q_D(ctkIconEnginePlugin); Q_UNUSED(fileName); diff --git a/Libs/Widgets/ctkIconEnginePlugin.h b/Libs/Widgets/ctkIconEnginePlugin.h index cdf12c510d..64a2ab09d7 100644 --- a/Libs/Widgets/ctkIconEnginePlugin.h +++ b/Libs/Widgets/ctkIconEnginePlugin.h @@ -27,10 +27,6 @@ // "#if QT_VERSION >= QT_VERSION_CHECK(...)" in Qt4. As a workaround, // we check for the Qt version here (not parsed by MOC) and provide two // versions of the actual header file according to the used Qt version. -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) # include -#else -# include -#endif #endif diff --git a/Libs/Widgets/ctkIconEnginePlugin_qt4.h b/Libs/Widgets/ctkIconEnginePlugin_qt4.h deleted file mode 100644 index f255514aac..0000000000 --- a/Libs/Widgets/ctkIconEnginePlugin_qt4.h +++ /dev/null @@ -1,125 +0,0 @@ -/*========================================================================= - - Library: CTK - - Copyright (c) Kitware Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0.txt - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -=========================================================================*/ - -#ifndef __ctkIconEnginePlugin_qt4_h -#define __ctkIconEnginePlugin_qt4_h - -// Qt includes -# include -# include - -// CTK includes -#include "ctkPimpl.h" -#include "ctkPixmapIconEngine.h" -#include "ctkWidgetsExport.h" - -class ctkIconEnginePluginPrivate; -class ctkIconEnginePrivate; - -/// \ingroup Widgets -/// ctkIconEnginePlugin must be loaded when starting the application. -/// \code -/// QApplication myApp; -/// QCoreApplication::addLibraryPath("MyApp-build/plugins"); -/// \endcode -/// where the plugin must be located in "MyApp-build/plugins/iconengines" -/// don't forget to declare in the cpp file: -/// Q_EXPORT_PLUGIN2(yourpluginName, ctkIconEnginePlugin) -class CTK_WIDGETS_EXPORT ctkIconEnginePlugin - : public QIconEnginePluginV2 -{ - Q_OBJECT; -public: - ctkIconEnginePlugin(QObject* parent = 0); - virtual ~ctkIconEnginePlugin(); - - virtual QIconEngineV2* create(const QString& filename=QString()); - - /// Support all the Qt image formats by default - virtual QStringList keys()const; - - /// Directory list given to the created icon engines - /// Subdirectories where the icons should be searched, typically: - /// "Small", "Medium", "Large", "XLarge" or - /// "16x16", "32x32", "64x64", "128x128" or - /// "LowDef", "HighDef" - /// \sa ctkIconEnginePlugin::setSizeDirectories - void setSizeDirectories(const QStringList& sizeDirectories); - QStringList sizeDirectories()const; - -protected: - QScopedPointer d_ptr; - -private: - Q_DECLARE_PRIVATE(ctkIconEnginePlugin); - Q_DISABLE_COPY(ctkIconEnginePlugin); -}; - -//------------------------------------------------------------------------------ -/// \ingroup Widgets -/// ctkIconEngine is an icon engine that behaves like the default Qt icon engine -/// QPixmapIconEngine(ctkPixmapIconEngine)), but can automatically support icons -/// in multiple size. When adding a file to an icon, it will automatically check -/// if the same file name exists in a different directory. This allows the -/// application to contains icons in different size,e.g. :/Icons/Small/edit.png -/// and :/Icons/Large/edit.png. -/// Without ctkIconEngine, QIcon already support mutltiple files: -/// \code -/// QIcon editIcon; -/// editIcon.addFile(":/Icons/Small/edit.png"); -/// editIcon.addFile(":/Icons/Large/edit.png"); -/// \endcode -/// Using ctkIconEngine, adding a file to an icon will automatically search for -/// any icon in a different directory: -/// \code -/// ctkIconEngine* autoIconEngine; -/// autoIconEngine->setSizeDirectories(QStringList() << "Large" << "Small"; -/// QIcon editIcon(autoIconEngine); -/// editIcon.addFile(":/Icons/Small/edit.png"); -/// \endcode -/// where the large version of the icon is automatically added. -/// It is mostly useful when using the designer, where only 1 icon file can -/// be specified. It must be used with ctkIconEnginePlugin -/// TODO: support more than just files in resources. -class CTK_WIDGETS_EXPORT ctkIconEngine: public ctkPixmapIconEngine -{ -public: - typedef ctkPixmapIconEngine Superclass; - ctkIconEngine(); - virtual ~ctkIconEngine(); - virtual void addFile(const QString& fileName, const QSize& size, - QIcon::Mode mode, QIcon::State state); - /// Subdirectories where the icons should be searched, typically: - /// "Small", "Medium", "Large", "XLarge" or - /// "16x16", "32x32", "64x64", "128x128" or - /// "LowDef", "HighDef" - void setSizeDirectories(const QStringList& sizeDirectories); - QStringList sizeDirectories()const; - - virtual QString key()const; - -protected: - QScopedPointer d_ptr; - -private: - Q_DECLARE_PRIVATE(ctkIconEngine); - Q_DISABLE_COPY(ctkIconEngine); -}; -#endif diff --git a/Libs/Widgets/ctkPixmapIconEngine.cpp b/Libs/Widgets/ctkPixmapIconEngine.cpp index cb050f5e71..fb37a47a11 100644 --- a/Libs/Widgets/ctkPixmapIconEngine.cpp +++ b/Libs/Widgets/ctkPixmapIconEngine.cpp @@ -33,11 +33,7 @@ ctkPixmapIconEngine::ctkPixmapIconEngine() } ctkPixmapIconEngine::ctkPixmapIconEngine(const ctkPixmapIconEngine &other) -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) : QIconEngine(other) -#else - : QIconEngineV2(other) -#endif , pixmaps(other.pixmaps) { } @@ -276,11 +272,7 @@ QString ctkPixmapIconEngine::key() const return QLatin1String("ctkPixmapIconEngine"); } -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) QIconEngine *ctkPixmapIconEngine::clone() const -#else -QIconEngineV2 *ctkPixmapIconEngine::clone() const -#endif { return new ctkPixmapIconEngine(*this); } @@ -336,15 +328,9 @@ bool ctkPixmapIconEngine::write(QDataStream &out) const void ctkPixmapIconEngine::virtual_hook(int id, void *data) { switch (id) { -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) case QIconEngine::AvailableSizesHook: { QIconEngine::AvailableSizesArgument &arg = *reinterpret_cast(data); -#else - case QIconEngineV2::AvailableSizesHook: { - QIconEngineV2::AvailableSizesArgument &arg = - *reinterpret_cast(data); -#endif arg.sizes.clear(); for (int i = 0; i < pixmaps.size(); ++i) { ctkPixmapIconEngineEntry &pe = pixmaps[i]; @@ -358,10 +344,6 @@ void ctkPixmapIconEngine::virtual_hook(int id, void *data) break; } default: -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) QIconEngine::virtual_hook(id, data); -#else - QIconEngineV2::virtual_hook(id, data); -#endif } } diff --git a/Libs/Widgets/ctkSearchBox.cpp b/Libs/Widgets/ctkSearchBox.cpp index 0976720c1e..d54492a52d 100644 --- a/Libs/Widgets/ctkSearchBox.cpp +++ b/Libs/Widgets/ctkSearchBox.cpp @@ -50,10 +50,6 @@ class ctkSearchBoxPrivate bool showSearchIcon; bool alwaysShowClearIcon; bool hideClearIcon; - -#if QT_VERSION < 0x040700 - QString placeholderText; -#endif }; // -------------------------------------------------- @@ -97,11 +93,7 @@ QRect ctkSearchBoxPrivate::searchRect()const // the frame line width if (q->hasFrame()) { -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) - QStyleOptionFrameV2 opt; -#else QStyleOptionFrame opt; -#endif q->initStyleOption(&opt); sRect.adjust(opt.lineWidth, opt.lineWidth, -opt.lineWidth, -opt.lineWidth); } @@ -127,26 +119,6 @@ ctkSearchBox::~ctkSearchBox() { } -#if QT_VERSION < 0x040700 -// -------------------------------------------------- -QString ctkSearchBox::placeholderText()const -{ - Q_D(const ctkSearchBox); - return d->placeholderText; -} - -// -------------------------------------------------- -void ctkSearchBox::setPlaceholderText(const QString &defaultText) -{ - Q_D(ctkSearchBox); - d->placeholderText = defaultText; - if (!this->hasFocus()) - { - this->update(); - } -} -#endif - // -------------------------------------------------- void ctkSearchBox::setShowSearchIcon(bool show) { @@ -226,59 +198,6 @@ void ctkSearchBox::paintEvent(QPaintEvent * event) QRect cRect = d->clearRect(); QRect sRect = d->showSearchIcon ? d->searchRect() : QRect(); -#if QT_VERSION < 0x040700 - QRect r = rect(); - QPalette pal = palette(); - - QStyleOptionFrameV2 panel; - initStyleOption(&panel); - r = this->style()->subElementRect(QStyle::SE_LineEditContents, &panel, this); - r.setX(r.x() + this->textMargins().left()); - r.setY(r.y() + this->textMargins().top()); - r.setRight(r.right() - this->textMargins().right()); - r.setBottom(r.bottom() - this->textMargins().bottom()); - p.setClipRect(r); - - QFontMetrics fm = fontMetrics(); - Qt::Alignment va = QStyle::visualAlignment(this->layoutDirection(), - QFlag(this->alignment())); - int vscroll = 0; - const int verticalMargin = 1; - const int horizontalMargin = 2; - switch (va & Qt::AlignVertical_Mask) { - case Qt::AlignBottom: - vscroll = r.y() + r.height() - fm.height() - verticalMargin; - break; - case Qt::AlignTop: - vscroll = r.y() + verticalMargin; - break; - default: - //center - vscroll = r.y() + (r.height() - fm.height() + 1) / 2; - break; - } - QRect lineRect(r.x() + horizontalMargin, vscroll, - r.width() - 2*horizontalMargin, fm.height()); - - int minLB = qMax(0, -fm.minLeftBearing()); - - if (this->text().isEmpty()) - { - if (!this->hasFocus() && !this->placeholderText().isEmpty()) - { - QColor col = pal.text().color(); - col.setAlpha(128); - QPen oldpen = p.pen(); - p.setPen(col); - lineRect.adjust(minLB, 0, 0, 0); - QString elidedText = fm.elidedText(this->placeholderText(), Qt::ElideRight, lineRect.width()); - p.drawText(lineRect, va, elidedText); - p.setPen(oldpen); - } - } - p.setClipRect(this->rect()); -#endif - // Draw clearIcon if (!d->hideClearIcon) { diff --git a/Libs/Widgets/ctkTestApplication.cpp b/Libs/Widgets/ctkTestApplication.cpp index 782ea43dfc..40f869d37b 100644 --- a/Libs/Widgets/ctkTestApplication.cpp +++ b/Libs/Widgets/ctkTestApplication.cpp @@ -54,11 +54,7 @@ int ctkTestApplication::Error = 0; //----------------------------------------------------------------------------- ctkTestApplication::ctkTestApplication(int _argc, char** _argv) { -#if QT_VERSION > QT_VERSION_CHECK(5,0,0) qInstallMessageHandler(ctkTestApplication::messageHandler); -#else - qInstallMsgHandler(ctkTestApplication::messageHandler); -#endif // CMake generated driver removes argv[0], // so let's put a dummy back in this->Argv.append("ctkTestApplication"); @@ -78,11 +74,7 @@ ctkTestApplication::ctkTestApplication(int _argc, char** _argv) ctkTestApplication::~ctkTestApplication() { delete this->App; -#if QT_VERSION > QT_VERSION_CHECK(5,0,0) qInstallMessageHandler(0); -#else - qInstallMsgHandler(0); -#endif } //----------------------------------------------------------------------------- @@ -117,14 +109,8 @@ int ctkTestApplication::exec(bool reportErrorsOnExit) } //----------------------------------------------------------------------------- -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) void ctkTestApplication::messageHandler(QtMsgType type, const QMessageLogContext& /*context*/, const QString& msg) { -#else -void ctkTestApplication::messageHandler(QtMsgType type, const char *msgAsStr) -{ - QString msg(msgAsStr); -#endif switch(type) { case QtDebugMsg: diff --git a/Libs/Widgets/ctkTestApplication.h b/Libs/Widgets/ctkTestApplication.h index 267ccf60cb..573c374d27 100644 --- a/Libs/Widgets/ctkTestApplication.h +++ b/Libs/Widgets/ctkTestApplication.h @@ -98,11 +98,7 @@ class CTK_WIDGETS_EXPORT ctkTestApplication : public QObject /// produced by QDebug during execution. static int exec(bool reportErrorsOnExit=false); -#if QT_VERSION >= 0x50000 static void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg); -#else - static void messageHandler(QtMsgType type, const char *msg); -#endif static void delay(int ms); diff --git a/Libs/Widgets/ctkTreeComboBox.cpp b/Libs/Widgets/ctkTreeComboBox.cpp index 40eb8d093e..4f79d579eb 100644 --- a/Libs/Widgets/ctkTreeComboBox.cpp +++ b/Libs/Widgets/ctkTreeComboBox.cpp @@ -30,9 +30,6 @@ #include #include #include -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) -# include -#endif #include #include #include @@ -425,12 +422,6 @@ void ctkTreeComboBox::resizePopup() listRect.moveBottomLeft(above); } -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) && !defined QT_NO_IM - if (QInputContext *qic = this->inputContext()) - { - qic->reset(); - } -#endif QScrollBar *sb = this->view()->horizontalScrollBar(); Qt::ScrollBarPolicy policy = this->view()->horizontalScrollBarPolicy(); bool needHorizontalScrollBar = diff --git a/Libs/Widgets/ctkWidgetsUtils.cpp b/Libs/Widgets/ctkWidgetsUtils.cpp index 911a398a0c..1c7d7b782f 100644 --- a/Libs/Widgets/ctkWidgetsUtils.cpp +++ b/Libs/Widgets/ctkWidgetsUtils.cpp @@ -51,11 +51,7 @@ QImage ctk::grabWidget(QWidget* widget, QRect rectangle) // Let Qt trigger layout mechanism and compute widget size. rectangle = QRect(0,0,-1,-1); } -#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) - QPixmap widgetPixmap = QPixmap::grabWidget(widget, rectangle); -#else QPixmap widgetPixmap = widget->grab(rectangle); -#endif QImage widgetImage = widgetPixmap.toImage(); QPainter painter; painter.begin(&widgetImage); diff --git a/Libs/XNAT/Core/Testing/ctkXnatSessionTest.cpp b/Libs/XNAT/Core/Testing/ctkXnatSessionTest.cpp index 3c802cf5be..b2ce93742d 100644 --- a/Libs/XNAT/Core/Testing/ctkXnatSessionTest.cpp +++ b/Libs/XNAT/Core/Testing/ctkXnatSessionTest.cpp @@ -396,13 +396,8 @@ void ctkXnatSessionTestCase::testUploadAndDownloadFile() QCryptographicHash hashUploaded(QCryptographicHash::Md5); QCryptographicHash hashDownloaded(QCryptographicHash::Md5); -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) hashUploaded.addData(&uploadedFile); hashDownloaded.addData(&downloadedFile); -#else - hashUploaded.addData(uploadedFile.readAll()); - hashDownloaded.addData(downloadedFile.readAll()); -#endif QString md5ChecksumUploaded(hashUploaded.result().toHex()); QString md5ChecksumDownloaded(hashDownloaded.result().toHex()); diff --git a/Libs/XNAT/Core/ctkXnatAPI.cpp b/Libs/XNAT/Core/ctkXnatAPI.cpp index e1fc8f9320..c44149043c 100644 --- a/Libs/XNAT/Core/ctkXnatAPI.cpp +++ b/Libs/XNAT/Core/ctkXnatAPI.cpp @@ -29,9 +29,7 @@ #include #include #include -#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0)) #include -#endif // -------------------------------------------------------------------------- // ctkXnatAPI methods @@ -51,13 +49,9 @@ ctkXnatAPI::~ctkXnatAPI() QUuid ctkXnatAPI::get(const QString& resource, const Parameters& parameters, const qRestAPI::RawHeaders& rawHeaders) { QUrl url = this->createUrl(resource, parameters); -#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) - url.addQueryItem("format", "json"); -#else QUrlQuery urlQuery(url); urlQuery.addQueryItem("format", "json"); url.setQuery(urlQuery); -#endif QNetworkReply* queryReply = this->sendRequest(QNetworkAccessManager::GetOperation, url, rawHeaders); QUuid queryId = queryReply->property("uuid").toString(); return queryId; diff --git a/Libs/XNAT/Core/ctkXnatSession.cpp b/Libs/XNAT/Core/ctkXnatSession.cpp index fddb04f49f..9b300eaa58 100644 --- a/Libs/XNAT/Core/ctkXnatSession.cpp +++ b/Libs/XNAT/Core/ctkXnatSession.cpp @@ -285,11 +285,7 @@ QList ctkXnatSessionPrivate::results(qRestResult* restResult, QS continue; } -#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) - ctkXnatObject* object = reinterpret_cast(QMetaType::construct(typeId)); -#else ctkXnatObject* object = reinterpret_cast(QMetaType(typeId).create()); -#endif if (!customSchemaType.isEmpty()) { // We might have created the default ctkXnatObject sub-class, but can still set @@ -693,11 +689,7 @@ void ctkXnatSession::upload(ctkXnatFile *xnatFile, { QCryptographicHash hash(QCryptographicHash::Md5); -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) hash.addData(&localFile); -#else - hash.addData(localFile.readAll()); -#endif QString md5ChecksumLocal(hash.result().toHex()); // Retrieving the md5 checksum on the server and comparing diff --git a/Plugins/org.commontk.configadmin/ctkConfigurationAdminActivator.cpp b/Plugins/org.commontk.configadmin/ctkConfigurationAdminActivator.cpp index 433cff96bc..f8486dcebb 100644 --- a/Plugins/org.commontk.configadmin/ctkConfigurationAdminActivator.cpp +++ b/Plugins/org.commontk.configadmin/ctkConfigurationAdminActivator.cpp @@ -28,8 +28,7 @@ #include #include -#include - +#include ctkConfigurationAdminActivator::ctkConfigurationAdminActivator() : logTracker(0), factory(0), eventAdapter(0) @@ -78,7 +77,3 @@ void ctkConfigurationAdminActivator::stop(ctkPluginContext* context) logFileFallback.close(); } - -#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) -Q_EXPORT_PLUGIN2(org_commontk_configadmin, ctkConfigurationAdminActivator) -#endif diff --git a/Plugins/org.commontk.dah.cmdlinemoduleapp/ctkCommandLineModuleAppLogic.cpp b/Plugins/org.commontk.dah.cmdlinemoduleapp/ctkCommandLineModuleAppLogic.cpp index ab2e08fbc6..c521c1488c 100644 --- a/Plugins/org.commontk.dah.cmdlinemoduleapp/ctkCommandLineModuleAppLogic.cpp +++ b/Plugins/org.commontk.dah.cmdlinemoduleapp/ctkCommandLineModuleAppLogic.cpp @@ -20,7 +20,7 @@ =============================================================================*/ // Qt includes -#include +#include #include #include #include @@ -45,22 +45,14 @@ // DCMTK includes #include -#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) -#include -#else #include -#endif //---------------------------------------------------------------------------- ctkCommandLineModuleAppLogic::ctkCommandLineModuleAppLogic(const QString & modulelocation) : ctkDicomAbstractApp(ctkCommandLineModuleAppPlugin::getPluginContext()), AppWidget(0), ModuleLocation(modulelocation), - #if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) - ModuleManager(ctkCmdLineModuleManager::WEAK_VALIDATION, QDesktopServices::storageLocation(QDesktopServices::CacheLocation)), - #else ModuleManager(ctkCmdLineModuleManager::WEAK_VALIDATION, QStandardPaths::writableLocation(QStandardPaths::CacheLocation)), - #endif ModuleFrontend(0) { connect(this, SIGNAL(startProgress()), this, SLOT(onStartProgress()), Qt::QueuedConnection); diff --git a/Plugins/org.commontk.dah.cmdlinemoduleapp/ctkCommandLineModuleAppPlugin.cpp b/Plugins/org.commontk.dah.cmdlinemoduleapp/ctkCommandLineModuleAppPlugin.cpp index dba82685e3..48f29fa176 100644 --- a/Plugins/org.commontk.dah.cmdlinemoduleapp/ctkCommandLineModuleAppPlugin.cpp +++ b/Plugins/org.commontk.dah.cmdlinemoduleapp/ctkCommandLineModuleAppPlugin.cpp @@ -20,7 +20,7 @@ =============================================================================*/ // Qt includes -#include +#include #include #include @@ -92,7 +92,3 @@ ctkPluginContext* ctkCommandLineModuleAppPlugin::getPluginContext() { return ctkCommandLineModuleAppPlugin::Context; } - -#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) -Q_EXPORT_PLUGIN2(org_commontk_dah_cmdlinemoduleapp, ctkCommandLineModuleAppPlugin) -#endif diff --git a/Plugins/org.commontk.dah.core/ctkDicomAppHostingCorePlugin.cpp b/Plugins/org.commontk.dah.core/ctkDicomAppHostingCorePlugin.cpp index 07bfdcde26..8729d06c94 100644 --- a/Plugins/org.commontk.dah.core/ctkDicomAppHostingCorePlugin.cpp +++ b/Plugins/org.commontk.dah.core/ctkDicomAppHostingCorePlugin.cpp @@ -19,9 +19,10 @@ =============================================================================*/ +// Qt includes +#include #include "ctkDicomAppHostingCorePlugin_p.h" -#include ctkDicomAppHostingCorePlugin* ctkDicomAppHostingCorePlugin::instance = 0; @@ -61,7 +62,3 @@ ctkPluginContext* ctkDicomAppHostingCorePlugin::getPluginContext() const { return context; } - -#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) -Q_EXPORT_PLUGIN2(org_commontk_dah_core, ctkDicomAppHostingCorePlugin) -#endif diff --git a/Plugins/org.commontk.dah.exampleapp/ctkExampleDicomAppPlugin.cpp b/Plugins/org.commontk.dah.exampleapp/ctkExampleDicomAppPlugin.cpp index b102afec6e..18cab4eee3 100644 --- a/Plugins/org.commontk.dah.exampleapp/ctkExampleDicomAppPlugin.cpp +++ b/Plugins/org.commontk.dah.exampleapp/ctkExampleDicomAppPlugin.cpp @@ -20,7 +20,7 @@ =============================================================================*/ // Qt includes -#include +#include #include #include @@ -66,7 +66,3 @@ ctkPluginContext* ctkExampleDicomAppPlugin::getPluginContext() { return ctkExampleDicomAppPlugin::Context; } - -#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) -Q_EXPORT_PLUGIN2(org_commontk_example_dicomapp, ctkExampleDicomAppPlugin) -#endif diff --git a/Plugins/org.commontk.dah.examplehost/ctkExampleDicomHostPlugin.cpp b/Plugins/org.commontk.dah.examplehost/ctkExampleDicomHostPlugin.cpp index 233be29371..00f5c82b68 100644 --- a/Plugins/org.commontk.dah.examplehost/ctkExampleDicomHostPlugin.cpp +++ b/Plugins/org.commontk.dah.examplehost/ctkExampleDicomHostPlugin.cpp @@ -19,9 +19,6 @@ =============================================================================*/ -// Qt includes -#include - // CTK includes #include "ctkExampleDicomHostPlugin_p.h" @@ -63,7 +60,3 @@ ctkPluginContext* ctkExampleDicomHostPlugin::getPluginContext() const { return this->Context; } - -#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) -Q_EXPORT_PLUGIN2(org_commontk_dah_examplehost, ctkExampleDicomHostPlugin) -#endif diff --git a/Plugins/org.commontk.dah.host/ctkDicomHostPlugin.cpp b/Plugins/org.commontk.dah.host/ctkDicomHostPlugin.cpp index f2909eca55..4b1dbeefd8 100644 --- a/Plugins/org.commontk.dah.host/ctkDicomHostPlugin.cpp +++ b/Plugins/org.commontk.dah.host/ctkDicomHostPlugin.cpp @@ -20,7 +20,7 @@ =============================================================================*/ // Qt includes -#include +#include // CTK includes #include "ctkDicomHostPlugin_p.h" @@ -63,7 +63,3 @@ ctkPluginContext* ctkDicomHostPlugin::getPluginContext() const { return this->Context; } - -#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) -Q_EXPORT_PLUGIN2(org_commontk_dah_host, ctkDicomHostPlugin) -#endif diff --git a/Plugins/org.commontk.dah.hostedapp/ctkDicomAppPlugin.cpp b/Plugins/org.commontk.dah.hostedapp/ctkDicomAppPlugin.cpp index 81d357d3a9..9c94f74a52 100644 --- a/Plugins/org.commontk.dah.hostedapp/ctkDicomAppPlugin.cpp +++ b/Plugins/org.commontk.dah.hostedapp/ctkDicomAppPlugin.cpp @@ -20,7 +20,7 @@ =============================================================================*/ // Qt includes -#include +#include #include // CTK includes @@ -101,7 +101,3 @@ ctkPluginContext* ctkDicomAppPlugin::getPluginContext() { return ctkDicomAppPlugin::Context; } - -#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) -Q_EXPORT_PLUGIN2(org_commontk_dah_hostedapp, ctkDicomAppPlugin) -#endif diff --git a/Plugins/org.commontk.eventadmin/ctkEventAdminActivator.cpp b/Plugins/org.commontk.eventadmin/ctkEventAdminActivator.cpp index 145f25ed48..d334c34a41 100644 --- a/Plugins/org.commontk.eventadmin/ctkEventAdminActivator.cpp +++ b/Plugins/org.commontk.eventadmin/ctkEventAdminActivator.cpp @@ -19,14 +19,13 @@ =============================================================================*/ +#include #include "ctkEventAdminActivator_p.h" #include "util/ctkEALogTracker_p.h" #include "ctkEAConfiguration_p.h" -#include - ctkEALogTracker* ctkEventAdminActivator::logTracker = 0; ctkEventAdminActivator::ctkEventAdminActivator() @@ -71,7 +70,3 @@ ctkLogService* ctkEventAdminActivator::getLogService() { return logTracker; } - -#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) -Q_EXPORT_PLUGIN2(org_commontk_eventadmin, ctkEventAdminActivator) -#endif diff --git a/Plugins/org.commontk.log/ctkLogPlugin.cpp b/Plugins/org.commontk.log/ctkLogPlugin.cpp index 411d3a3dab..129ae57d9c 100644 --- a/Plugins/org.commontk.log/ctkLogPlugin.cpp +++ b/Plugins/org.commontk.log/ctkLogPlugin.cpp @@ -24,7 +24,7 @@ #include "ctkLogQDebug_p.h" -#include +#include #include ctkLogPlugin::ctkLogPlugin() @@ -48,7 +48,3 @@ void ctkLogPlugin::stop(ctkPluginContext* context) logService = 0; } } - -#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) -Q_EXPORT_PLUGIN2(org_commontk_log, ctkLogPlugin) -#endif diff --git a/Plugins/org.commontk.metatype/ctkMetaTypeActivator.cpp b/Plugins/org.commontk.metatype/ctkMetaTypeActivator.cpp index b90e45b226..7a62646daa 100644 --- a/Plugins/org.commontk.metatype/ctkMetaTypeActivator.cpp +++ b/Plugins/org.commontk.metatype/ctkMetaTypeActivator.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include ctkMTLogTracker* ctkMetaTypeActivator::logTracker = 0; @@ -108,8 +108,3 @@ ctkLogService* ctkMetaTypeActivator::getLogService() { return logTracker; } - - -#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) -Q_EXPORT_PLUGIN2(org_commontk_metatype, ctkMetaTypeActivator) -#endif diff --git a/Plugins/org.commontk.plugingenerator.core/ctkPluginGeneratorCorePlugin.cpp b/Plugins/org.commontk.plugingenerator.core/ctkPluginGeneratorCorePlugin.cpp index 8754aaa3ed..175091a109 100644 --- a/Plugins/org.commontk.plugingenerator.core/ctkPluginGeneratorCorePlugin.cpp +++ b/Plugins/org.commontk.plugingenerator.core/ctkPluginGeneratorCorePlugin.cpp @@ -24,7 +24,7 @@ #include "ctkPluginGeneratorCodeModel.h" -#include +#include ctkPluginGeneratorCorePlugin* ctkPluginGeneratorCorePlugin::instance = 0; @@ -59,7 +59,3 @@ ctkPluginGeneratorCorePlugin* ctkPluginGeneratorCorePlugin::getInstance() { return instance; } - -#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) -Q_EXPORT_PLUGIN2(org_commontk_plugingenerator_core, ctkPluginGeneratorCorePlugin) -#endif diff --git a/Plugins/org.commontk.plugingenerator.ui/ctkPluginGeneratorUiPlugin.cpp b/Plugins/org.commontk.plugingenerator.ui/ctkPluginGeneratorUiPlugin.cpp index 3c7f525426..bcdc312e31 100644 --- a/Plugins/org.commontk.plugingenerator.ui/ctkPluginGeneratorUiPlugin.cpp +++ b/Plugins/org.commontk.plugingenerator.ui/ctkPluginGeneratorUiPlugin.cpp @@ -26,7 +26,7 @@ #include -#include +#include #include void ctkPluginGeneratorUiPlugin::start(ctkPluginContext* context) @@ -47,7 +47,3 @@ void ctkPluginGeneratorUiPlugin::stop(ctkPluginContext* context) delete mainExtension; } - -#if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) -Q_EXPORT_PLUGIN2(org_commontk_plugingenerator_ui, ctkPluginGeneratorUiPlugin) -#endif From a0e74a08041427d570d754c571915c849fe47618 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Tue, 18 Jul 2023 18:08:19 -0400 Subject: [PATCH 084/115] COMP: Update CMake files removing support for Qt 4.x * Remove use of Qt4 macros * Anticipate integration of Qt6 by: - explicitly reporting an error message if corresponding CMake code is not implemented. - switching from using Qt5::Module to Qt${CTK_QT_VERSION}::Module where associated logic is straightforward. --- Applications/Testing/Cpp/CMakeLists.txt | 6 +-- .../CMakeLists.txt | 5 -- Applications/ctkExampleHost/CMakeLists.txt | 4 +- Applications/ctkPluginBrowser/CMakeLists.txt | 4 +- .../CTKGenerateCTKConfig.cmake | 4 +- CMake/UseCTK.cmake.in | 4 -- CMake/ctkFunctionGeneratePluginManifest.cmake | 6 +-- CMake/ctkMacroBuildApp.cmake | 20 +------- CMake/ctkMacroBuildLib.cmake | 22 +++----- CMake/ctkMacroBuildLibWrapper.cmake | 4 +- CMake/ctkMacroBuildPlugin.cmake | 51 +++++-------------- CMake/ctkMacroBuildQtPlugin.cmake | 23 ++++----- CMake/ctkMacroGenerateMocs.cmake | 15 ++---- .../ctkMacroGeneratePluginResourceFile.cmake | 5 +- CMake/ctkMacroSetupPlugins.cmake | 19 ++----- CMake/ctkMacroSetupQt.cmake | 33 +----------- CMake/ctkMacroWrapPythonQt.cmake | 4 +- CMakeExternals/Log4Qt.cmake | 13 +++-- CMakeExternals/PythonQt.cmake | 16 +++--- CMakeExternals/QtSOAP.cmake | 13 +++-- CMakeExternals/QtTesting.cmake | 14 ++--- CMakeExternals/VTK.cmake | 18 +++---- CMakeExternals/qRestAPI.cmake | 12 +++-- CMakeExternals/qxmlrpc.cmake | 13 +++-- CMakeLists.txt | 5 -- Libs/CommandLineModules/Core/CMakeLists.txt | 11 ++-- .../Core/Testing/Cpp/CMakeLists.txt | 17 ++----- .../Frontend/QtGui/CMakeLists.txt | 10 ++-- .../Frontend/QtGui/Testing/Cpp/CMakeLists.txt | 16 ++---- .../Frontend/QtWebKit/CMakeLists.txt | 7 +-- .../Testing/Cpp/CMakeLists.txt | 23 +++------ .../Testing/Modules/CMakeLists.txt | 14 +++-- Libs/Core/CMakeLists.txt | 4 +- Libs/Core/Testing/Cpp/CMakeLists.txt | 20 +++----- Libs/Core/target_libraries.cmake | 4 -- Libs/DICOM/Core/CMakeLists.txt | 4 +- Libs/DICOM/Core/ctkDICOMDatabase.h | 2 - Libs/DICOM/Widgets/Testing/Cpp/CMakeLists.txt | 9 ++-- .../ITK/Core/Testing/Cpp/CMakeLists.txt | 2 +- Libs/PluginFramework/CMakeLists.txt | 7 +-- .../Snippets/EventAdmin-Intro/files.cmake | 5 +- .../Testing/Cpp/CMakeLists.txt | 6 +-- .../app_test/CMakeLists.txt | 9 ++-- .../pluginD_test/CMakeLists.txt | 10 +--- .../org.commontk.pluginfwtest/CMakeLists.txt | 2 +- Libs/QtTesting/CMakeLists.txt | 7 +-- .../Python/Core/Testing/Cpp/CMakeLists.txt | 11 ++-- .../VTK/Core/Testing/Cpp/CMakeLists.txt | 4 +- Libs/Visualization/VTK/Widgets/CMakeLists.txt | 4 +- .../VTK/Widgets/Testing/Cpp/CMakeLists.txt | 17 ++----- .../VTK/Widgets/target_libraries.cmake | 4 +- Libs/Widgets/CMakeLists.txt | 2 - Libs/Widgets/Testing/Cpp/CMakeLists.txt | 14 +++-- Libs/XNAT/Core/Testing/CMakeLists.txt | 10 ++-- Libs/XNAT/Widgets/CMakeLists.txt | 4 +- .../Testing/Cpp/CMakeLists.txt | 2 +- Plugins/org.commontk.dah.core/CMakeLists.txt | 7 +-- .../Testing/Cpp/CMakeLists.txt | 2 +- .../Testing/Cpp/CMakeLists.txt | 11 ++-- .../Testing/Cpp/CMakeLists.txt | 2 +- 60 files changed, 210 insertions(+), 406 deletions(-) diff --git a/Applications/Testing/Cpp/CMakeLists.txt b/Applications/Testing/Cpp/CMakeLists.txt index 3a9ba51dab..f33972eecb 100644 --- a/Applications/Testing/Cpp/CMakeLists.txt +++ b/Applications/Testing/Cpp/CMakeLists.txt @@ -30,11 +30,7 @@ if(CTK_APP_ctkDICOMQuery AND CTK_APP_ctkDICOMRetrieve) # Add Tests # ctk_add_executable_utf8(ctkDICOMApplicationTest1 ctkDICOMApplicationTest1.cpp) - if(CTK_QT_VERSION VERSION_LESS "5") - target_link_libraries(ctkDICOMApplicationTest1 ${QT_LIBRARIES}) - else() - target_link_libraries(ctkDICOMApplicationTest1 Qt5::Core) - endif() + target_link_libraries(ctkDICOMApplicationTest1 Qt${CTK_QT_VERSION}::Core) ADD_TEST( NAME ctkDICOMApplicationTest1 COMMAND diff --git a/Applications/ctkCommandLineModuleExplorer/CMakeLists.txt b/Applications/ctkCommandLineModuleExplorer/CMakeLists.txt index f367983b97..25d0f5cab1 100644 --- a/Applications/ctkCommandLineModuleExplorer/CMakeLists.txt +++ b/Applications/ctkCommandLineModuleExplorer/CMakeLists.txt @@ -49,11 +49,6 @@ set(KIT_resources resources/ctkCmdLineModuleExplorer.qrc ) -if(CTK_QT_VERSION VERSION_LESS "5") - set(QT_USE_QTUITOOLS 1) - include(${QT_USE_FILE}) -endif() - # Target libraries - See CMake/ctkFunctionGetTargetLibraries.cmake # The following macro will read the target libraries from the file 'target_libraries.cmake' ctkFunctionGetTargetLibraries(KIT_target_libraries) diff --git a/Applications/ctkExampleHost/CMakeLists.txt b/Applications/ctkExampleHost/CMakeLists.txt index 335ae2bb90..621ebb5183 100644 --- a/Applications/ctkExampleHost/CMakeLists.txt +++ b/Applications/ctkExampleHost/CMakeLists.txt @@ -29,9 +29,7 @@ set(KIT_resources # The following macro will read the target libraries from the file 'target_libraries.cmake' ctkFunctionGetTargetLibraries(KIT_target_libraries) -if(CTK_QT_VERSION VERSION_GREATER "4") - list(APPEND KIT_target_libraries Qt5::Widgets) -endif() +list(APPEND KIT_target_libraries Qt${CTK_QT_VERSION}::Widgets) ctkMacroBuildApp( NAME ${PROJECT_NAME} diff --git a/Applications/ctkPluginBrowser/CMakeLists.txt b/Applications/ctkPluginBrowser/CMakeLists.txt index ecbc67d2d4..45b50276ef 100644 --- a/Applications/ctkPluginBrowser/CMakeLists.txt +++ b/Applications/ctkPluginBrowser/CMakeLists.txt @@ -34,9 +34,7 @@ set(KIT_resources # The following macro will read the target libraries from the file 'target_libraries.cmake' ctkFunctionGetTargetLibraries(KIT_target_libraries) -if(CTK_QT_VERSION VERSION_GREATER "4") - list(APPEND KIT_target_libraries Qt5::Widgets) -endif() +list(APPEND KIT_target_libraries Qt${CTK_QT_VERSION}::Widgets) ctkMacroBuildApp( NAME ${PROJECT_NAME} diff --git a/CMake/LastConfigureStep/CTKGenerateCTKConfig.cmake b/CMake/LastConfigureStep/CTKGenerateCTKConfig.cmake index 65c2498eef..038cae23fe 100644 --- a/CMake/LastConfigureStep/CTKGenerateCTKConfig.cmake +++ b/CMake/LastConfigureStep/CTKGenerateCTKConfig.cmake @@ -135,9 +135,7 @@ set(CTK_CONFIG_CODE "####### Expanded from \@CTK_CONFIG_CODE\@ #######\n") set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}# The CTK DGraph executable used to compute target dependency graphs\n") set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}set(CTK_DGRAPH_EXECUTABLE \"${DGraph_EXECUTABLE}\")\n") set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}# Qt configuration\n") -if(CTK_QT_VERSION STREQUAL "4") - set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}set(CTK_QT_QMAKE_EXECUTABLE \"${QT_QMAKE_EXECUTABLE}\")\n") # FIXME: Just pass Qt version (and bitness?) -elseif(DEFINED Qt5_DIR) +if(DEFINED Qt5_DIR) set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}set(CTK_Qt5_DIR \"${Qt5_DIR}\")\n") elseif(DEFINED CMAKE_PREFIX_PATH) set(CTK_CONFIG_CODE "${CTK_CONFIG_CODE}set(CTK_CMAKE_PREFIX_PATH \"${CMAKE_PREFIX_PATH}\")\n") diff --git a/CMake/UseCTK.cmake.in b/CMake/UseCTK.cmake.in index 685dce915f..136480d59a 100644 --- a/CMake/UseCTK.cmake.in +++ b/CMake/UseCTK.cmake.in @@ -35,10 +35,6 @@ if(NOT CTK_USE_FILE_INCLUDED) endif() include_directories(${new_include_directories}) - if(NOT DEFINED QT_QMAKE_EXECUTABLE AND CTK_QT_VERSION STREQUAL "4") - set(QT_QMAKE_EXECUTABLE ${CTK_QT_QMAKE_EXECUTABLE}) - endif() - if(CTK_QT_VERSION STREQUAL "5") if(NOT DEFINED Qt5_DIR AND DEFINED CTK_Qt5_DIR) # Setting "Qt5_DIR" is the preferred approach diff --git a/CMake/ctkFunctionGeneratePluginManifest.cmake b/CMake/ctkFunctionGeneratePluginManifest.cmake index 7fa9b51e67..589fc8d7e2 100644 --- a/CMake/ctkFunctionGeneratePluginManifest.cmake +++ b/CMake/ctkFunctionGeneratePluginManifest.cmake @@ -95,13 +95,11 @@ function(ctkFunctionGeneratePluginManifest QRC_SRCS) configure_file("${CTK_CMAKE_DIR}/MANIFEST.MF.in" "${_manifest_filepath}" @ONLY) configure_file("${CTK_CMAKE_DIR}/plugin_manifest.qrc.in" "${_manifest_qrc_filepath}" @ONLY) - - if (CTK_QT_VERSION VERSION_GREATER "4") + if(CTK_QT_VERSION VERSION_EQUAL "5") QT5_ADD_RESOURCES(_qrc_src ${_manifest_qrc_filepath}) else() - QT4_ADD_RESOURCES(_qrc_src ${_manifest_qrc_filepath}) + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() - set(${QRC_SRCS} ${${QRC_SRCS}} ${_qrc_src} PARENT_SCOPE) endfunction() diff --git a/CMake/ctkMacroBuildApp.cmake b/CMake/ctkMacroBuildApp.cmake index c061c13cdb..18da3b3119 100644 --- a/CMake/ctkMacroBuildApp.cmake +++ b/CMake/ctkMacroBuildApp.cmake @@ -70,17 +70,12 @@ macro(ctkMacroBuildApp) ${my_library_dirs} ) - if(CTK_QT_VERSION VERSION_LESS "5") - # Add Qt include dirs and defines - include(${QT_USE_FILE}) - endif() - # Make sure variable are cleared set(MY_UI_CPP) set(MY_MOC_CPP) set(MY_QRC_SRCS) - if (CTK_QT_VERSION VERSION_GREATER "4") + if(CTK_QT_VERSION VERSION_EQUAL "5") # Wrap if(MY_MOC_SRCS) # this is a workaround for Visual Studio. The relative include paths in the generated @@ -94,18 +89,7 @@ macro(ctkMacroBuildApp) QT5_ADD_RESOURCES(MY_QRC_SRCS ${MY_RESOURCES}) endif() else() - # Wrap - if(MY_MOC_SRCS) - # this is a workaround for Visual Studio. The relative include paths in the generated - # moc files can get very long and can't be resolved by the MSVC compiler. - foreach(moc_src ${MY_MOC_SRCS}) - QT4_WRAP_CPP(MY_MOC_CPP ${moc_src} OPTIONS -f${moc_src}) - endforeach() - endif() - QT4_WRAP_UI(MY_UI_CPP ${MY_UI_FORMS}) - if(DEFINED MY_RESOURCES) - QT4_ADD_RESOURCES(MY_QRC_SRCS ${MY_RESOURCES}) - endif() + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() source_group("Resources" FILES diff --git a/CMake/ctkMacroBuildLib.cmake b/CMake/ctkMacroBuildLib.cmake index 89f10e11b6..c222aed332 100644 --- a/CMake/ctkMacroBuildLib.cmake +++ b/CMake/ctkMacroBuildLib.cmake @@ -74,11 +74,6 @@ macro(ctkMacroBuildLib) ${my_includes} ) - if(CTK_QT_VERSION VERSION_LESS "5") - # Add Qt include dirs and defines - include(${QT_USE_FILE}) - endif() - # Add the library directories from the external project ctkFunctionGetLibraryDirs(my_library_dirs ${lib_name}) @@ -117,33 +112,32 @@ ${${MY_EXPORT_CUSTOM_CONTENT_FROM_VARIABLE}} if(MY_MOC_SRCS) # this is a workaround for Visual Studio. The relative include paths in the generated # moc files can get very long and can't be resolved by the MSVC compiler. - if(CTK_QT_VERSION VERSION_GREATER "4") + if(CTK_QT_VERSION VERSION_EQUAL "5") foreach(moc_src ${MY_MOC_SRCS}) qt5_wrap_cpp(MY_MOC_CPP ${moc_src} OPTIONS -f${moc_src} OPTIONS -DHAVE_QT5) endforeach() else() - foreach(moc_src ${MY_MOC_SRCS}) - QT4_WRAP_CPP(MY_MOC_CPP ${moc_src} OPTIONS -f${moc_src}) - endforeach() + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() endif() if(MY_GENERATE_MOC_SRCS) - QT4_GENERATE_MOCS(${MY_GENERATE_MOC_SRCS}) + QT5_GENERATE_MOCS(${MY_GENERATE_MOC_SRCS}) endif() - if(CTK_QT_VERSION VERSION_GREATER "4") + if(CTK_QT_VERSION VERSION_EQUAL "5") if(Qt5Widgets_FOUND) qt5_wrap_ui(MY_UI_CPP ${MY_UI_FORMS}) elseif(MY_UI_FORMS) message(WARNING "Argument UI_FORMS ignored because Qt5Widgets module was not specified") endif() else() - QT4_WRAP_UI(MY_UI_CPP ${MY_UI_FORMS}) + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() + if(DEFINED MY_RESOURCES AND NOT MY_RESOURCES STREQUAL "") - if(CTK_QT_VERSION VERSION_GREATER "4") + if(CTK_QT_VERSION VERSION_EQUAL "5") qt5_add_resources(MY_QRC_SRCS ${MY_RESOURCES}) else() - QT4_ADD_RESOURCES(MY_QRC_SRCS ${MY_RESOURCES}) + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() endif() diff --git a/CMake/ctkMacroBuildLibWrapper.cmake b/CMake/ctkMacroBuildLibWrapper.cmake index b1e2580e80..2c5d13c0f5 100644 --- a/CMake/ctkMacroBuildLibWrapper.cmake +++ b/CMake/ctkMacroBuildLibWrapper.cmake @@ -124,10 +124,10 @@ macro(ctkMacroBuildLibWrapper) KIT_PYTHONQT_SRCS "${MY_SRCS}" FALSE ${HAS_DECORATOR}) if(HAS_DECORATOR) list(APPEND KIT_PYTHONQT_SRCS ${DECORATOR_HEADER}) - if (CTK_QT_VERSION VERSION_GREATER "4") + if(CTK_QT_VERSION VERSION_EQUAL "5") qt5_wrap_cpp(KIT_PYTHONQT_SRCS ${DECORATOR_HEADER} OPTIONS -f${DECORATOR_HEADER}) else() - QT4_WRAP_CPP(KIT_PYTHONQT_SRCS ${DECORATOR_HEADER} OPTIONS -f${DECORATOR_HEADER}) + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() endif() add_library(${lib_name}PythonQt ${MY_WRAPPER_LIBRARY_TYPE} ${KIT_PYTHONQT_SRCS}) diff --git a/CMake/ctkMacroBuildPlugin.cmake b/CMake/ctkMacroBuildPlugin.cmake index 28656c2d67..a6108a225d 100644 --- a/CMake/ctkMacroBuildPlugin.cmake +++ b/CMake/ctkMacroBuildPlugin.cmake @@ -140,12 +140,7 @@ macro(ctkMacroBuildPlugin) # and external dependencies ctkFunctionGetIncludeDirs(my_includes ${lib_name}) - if(CTK_QT_VERSION VERSION_LESS "5") - # Add Qt include dirs and defines - include(${QT_USE_FILE}) - else() - find_package(Qt5 COMPONENTS LinguistTools REQUIRED) - endif() + find_package(Qt${CTK_QT_VERSION} COMPONENTS LinguistTools REQUIRED) # Add the library directories from the external project ctkFunctionGetLibraryDirs(my_library_dirs ${lib_name}) @@ -171,7 +166,7 @@ macro(ctkMacroBuildPlugin) set(MY_QRC_SRCS) # Wrap - if (CTK_QT_VERSION VERSION_GREATER "4") + if(CTK_QT_VERSION VERSION_EQUAL "5") set(target) if(Qt5Core_VERSION VERSION_GREATER "5.2.0") set(target TARGET ${lib_name}) @@ -188,18 +183,9 @@ macro(ctkMacroBuildPlugin) QT5_ADD_RESOURCES(MY_QRC_SRCS ${MY_RESOURCES}) endif() else() - if(MY_MOC_SRCS) - # this is a workaround for Visual Studio. The relative include paths in the generated - # moc files can get very long and can't be resolved by the MSVC compiler. - foreach(moc_src ${MY_MOC_SRCS}) - QT4_WRAP_CPP(MY_MOC_CPP ${moc_src} OPTIONS -f${moc_src} ${MY_MOC_OPTIONS} TARGET ${lib_name}) - endforeach() - endif() - QT4_WRAP_UI(MY_UI_CPP ${MY_UI_FORMS}) - if(DEFINED MY_RESOURCES) - QT4_ADD_RESOURCES(MY_QRC_SRCS ${MY_RESOURCES}) - endif() + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() + # Add the generated manifest qrc file set(manifest_qrc_src ) ctkFunctionGeneratePluginManifest(manifest_qrc_src @@ -232,11 +218,12 @@ macro(ctkMacroBuildPlugin) if(MY_TRANSLATIONS) set_source_files_properties(${MY_TRANSLATIONS} PROPERTIES OUTPUT_LOCATION ${_translations_dir}) - if(CTK_QT_VERSION VERSION_GREATER "4") + if(CTK_QT_VERSION VERSION_EQUAL "5") qt5_create_translation(_plugin_qm_files ${MY_SRCS} ${MY_UI_FORMS} ${MY_TRANSLATIONS}) - else() - QT4_CREATE_TRANSLATION(_plugin_qm_files ${MY_SRCS} ${MY_UI_FORMS} ${MY_TRANSLATIONS}) - endif() + else() + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") + endif() + endif() if(_plugin_qm_files) @@ -294,24 +281,10 @@ macro(ctkMacroBuildPlugin) PUBLIC "$" "$" ) - if(CTK_QT_VERSION VERSION_LESS "5") - # Add Qt include dirs to the target - target_include_directories(${lib_name} PUBLIC ${QT_INCLUDE_DIR}) - foreach(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN - QAXSERVER QAXCONTAINER QTDECLARATIVE QTSCRIPT QTSVG QTUITOOLS QTHELP - QTWEBKIT PHONON QTSCRIPTTOOLS QTMULTIMEDIA QTXMLPATTERNS QTGUI QTTEST - QTDBUS QTXML QTSQL QTNETWORK QTCORE) - if (QT_USE_${module} OR QT_USE_${module}_DEPENDS) - if (QT_${module}_FOUND) - target_include_directories(${lib_name} PUBLIC ${QT_${module}_INCLUDE_DIR}) - endif () - endif () - endforeach() - endif() - if(MY_TEST_PLUGIN AND CTK_QT_VERSION VERSION_GREATER "4") - find_package(Qt5Test REQUIRED) - target_link_libraries(${lib_name} PRIVATE Qt5::Test) + if(MY_TEST_PLUGIN) + find_package(Qt${CTK_QT_VERSION} COMPONENTS Test REQUIRED) + target_link_libraries(${lib_name} PRIVATE Qt${CTK_QT_VERSION}::Test) endif() # Set the output directory for the plugin diff --git a/CMake/ctkMacroBuildQtPlugin.cmake b/CMake/ctkMacroBuildQtPlugin.cmake index 00af36bd80..08cd300d5a 100644 --- a/CMake/ctkMacroBuildQtPlugin.cmake +++ b/CMake/ctkMacroBuildQtPlugin.cmake @@ -87,7 +87,7 @@ macro(ctkMacroBuildQtPlugin) # Wrap set(MY_QRC_SRCS "") - if(CTK_QT_VERSION VERSION_GREATER "4") + if(CTK_QT_VERSION VERSION_EQUAL "5") set(target) if(Qt5Core_VERSION VERSION_GREATER "5.2.0") set(target TARGET ${MY_LIBNAME}) @@ -97,21 +97,14 @@ macro(ctkMacroBuildQtPlugin) if(DEFINED MY_RESOURCES) qt5_add_resources(MY_QRC_SRCS ${MY_RESOURCES}) endif() - else() - QT4_WRAP_CPP(MY_MOC_CPP ${MY_MOC_SRCS}) - if(DEFINED MY_RESOURCES) - QT4_ADD_RESOURCES(MY_QRC_SRCS ${MY_RESOURCES}) - endif() - endif() - if(CTK_QT_VERSION VERSION_GREATER "4") if(Qt5Widgets_FOUND) qt5_wrap_ui(MY_UI_CPP ${MY_UI_FORMS}) elseif(MY_UI_FORMS) message(WARNING "Argument UI_FORMS ignored because Qt5Widgets module was not specified") endif() else() - QT4_WRAP_UI(MY_UI_CPP ${MY_UI_FORMS}) + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() source_group("Resources" FILES @@ -137,8 +130,10 @@ macro(ctkMacroBuildQtPlugin) # Apply properties to the library target. set(compile_flags "-DQT_PLUGIN") - if(CTK_QT_VERSION VERSION_GREATER "4") + if(CTK_QT_VERSION VERSION_EQUAL "5") set(compile_flags "${compile_flags} -DHAVE_QT5") + else() + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() set_target_properties(${lib_name} PROPERTIES COMPILE_FLAGS "${compile_flags}" @@ -190,15 +185,17 @@ macro(ctkMacroBuildQtPlugin) endmacro() macro(ctkMacroBuildQtDesignerPlugin) - if(CTK_QT_VERSION VERSION_GREATER "4") + if(CTK_QT_VERSION VERSION_EQUAL "5") find_package(Qt5 COMPONENTS Designer REQUIRED) add_definitions(${Qt5Designer_DEFINITIONS}) include_directories(${Qt5Designer_INCLUDE_DIRS}) + else() + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() ctkMacroBuildQtPlugin( PLUGIN_DIR designer ${ARGN}) - if(CTK_QT_VERSION VERSION_GREATER "4") + if(CTK_QT_VERSION VERSION_EQUAL "5") cmake_parse_arguments(MY "" # no options "NAME;EXPORT_DIRECTIVE;FOLDER;PLUGIN_DIR" # one value args @@ -206,6 +203,8 @@ macro(ctkMacroBuildQtDesignerPlugin) ${ARGN} ) target_link_libraries(${MY_NAME} Qt5::Designer) + else() + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() endmacro() diff --git a/CMake/ctkMacroGenerateMocs.cmake b/CMake/ctkMacroGenerateMocs.cmake index 6306d995a4..c97edb8f33 100644 --- a/CMake/ctkMacroGenerateMocs.cmake +++ b/CMake/ctkMacroGenerateMocs.cmake @@ -1,10 +1,10 @@ -# QT4_GENERATE_MOCS(inputfile1 [inputfile2 ...]) +# QT5_GENERATE_MOCS(inputfile1 [inputfile2 ...]) include(MacroAddFileDependencies) function(_ctk_generate_mocs) - if(CTK_QT_VERSION VERSION_GREATER "4") + if(CTK_QT_VERSION VERSION_EQUAL "5") if(Qt5_VERSION VERSION_LESS "5.15.0") QT5_GET_MOC_FLAGS(_moc_flags) else() @@ -12,7 +12,7 @@ function(_ctk_generate_mocs) # by qt5_generate_moc called below. endif() else() - QT4_GET_MOC_FLAGS(_moc_flags) + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() foreach(file ${ARGN}) @@ -30,7 +30,7 @@ function(_ctk_generate_mocs) set(moc_file ${CMAKE_CURRENT_BINARY_DIR}/moc_${source_name}${source_ext}) - if(CTK_QT_VERSION VERSION_GREATER "4") + if(CTK_QT_VERSION VERSION_EQUAL "5") if(Qt5_VERSION VERSION_LESS "5.6") QT5_CREATE_MOC_COMMAND(${abs_file} ${moc_file} "${_moc_flags}" "" "") elseif(Qt5_VERSION VERSION_LESS "5.15.0") @@ -41,17 +41,12 @@ function(_ctk_generate_mocs) qt5_generate_moc(${abs_file} ${moc_file}) endif() else() - QT4_CREATE_MOC_COMMAND(${abs_file} ${moc_file} "${_moc_flags}" "" "") + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() MACRO_ADD_FILE_DEPENDENCIES(${abs_file} ${moc_file}) endforeach() endfunction() -# create a Qt4 alias -macro(QT4_GENERATE_MOCS) - _ctk_generate_mocs(${ARGN}) -endmacro() - # create a Qt5 alias macro(QT5_GENERATE_MOCS) _ctk_generate_mocs(${ARGN}) diff --git a/CMake/ctkMacroGeneratePluginResourceFile.cmake b/CMake/ctkMacroGeneratePluginResourceFile.cmake index 29fcf83268..350fb4e996 100644 --- a/CMake/ctkMacroGeneratePluginResourceFile.cmake +++ b/CMake/ctkMacroGeneratePluginResourceFile.cmake @@ -38,11 +38,10 @@ macro(ctkMacroGeneratePluginResourceFile QRC_SRCS) ") configure_file("${CTK_CMAKE_DIR}/plugin_resources_cached.qrc.in" "${_qrc_filepath}" @ONLY) - - if (CTK_QT_VERSION VERSION_GREATER "4") + if(CTK_QT_VERSION VERSION_EQUAL "5") QT5_ADD_RESOURCES(${QRC_SRCS} ${_qrc_filepath}) else() - QT4_ADD_RESOURCES(${QRC_SRCS} ${_qrc_filepath}) + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() endmacro() diff --git a/CMake/ctkMacroSetupPlugins.cmake b/CMake/ctkMacroSetupPlugins.cmake index 8f7428b73a..1af75d0112 100644 --- a/CMake/ctkMacroSetupPlugins.cmake +++ b/CMake/ctkMacroSetupPlugins.cmake @@ -100,20 +100,10 @@ macro(ctkMacroSetupPlugins ) # Add the project specific variable name containing plug-in targets to the list set_property(GLOBAL APPEND PROPERTY CTK_PLUGIN_LIBRARIES_VARS ${CMAKE_PROJECT_NAME}_PLUGIN_LIBRARIES) endif() - - # Set up Qt, if not already done - #if(NOT QT4_FOUND) - # set(minimum_required_qt_version "4.6") - # find_package(Qt4 REQUIRED) - - # if("${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}" VERSION_LESS "${minimum_required_qt_version}") - # message(FATAL_ERROR "error: CTK requires Qt >= ${minimum_required_qt_version} -- you cannot use Qt ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}.") - # endif() - #endif() - + # Set the variable QT_INSTALLED_LIBRARY_DIR that contains all # Qt shared libraries - if (CTK_QT_VERSION VERSION_GREATER "4") + if(CTK_QT_VERSION VERSION_EQUAL "5") if(WIN32) get_target_property(_qt5_moc_executable Qt5::moc LOCATION) get_filename_component(QT_INSTALLED_LIBRARY_DIR ${_qt5_moc_executable} PATH) @@ -122,10 +112,7 @@ macro(ctkMacroSetupPlugins ) get_filename_component(QT_INSTALLED_LIBRARY_DIR ${_qt5_core_lib} PATH) endif() else() - set(QT_INSTALLED_LIBRARY_DIR ${QT_LIBRARY_DIR}) - if(WIN32) - get_filename_component(QT_INSTALLED_LIBRARY_DIR ${QT_QMAKE_EXECUTABLE} PATH) - endif() + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() set(plugin_symbolic_names ) diff --git a/CMake/ctkMacroSetupQt.cmake b/CMake/ctkMacroSetupQt.cmake index fd2813758a..37550596d2 100644 --- a/CMake/ctkMacroSetupQt.cmake +++ b/CMake/ctkMacroSetupQt.cmake @@ -29,8 +29,7 @@ macro(ctkMacroSetupQt) message(FATAL_ERROR "Expected value for CTK_QT_VERSION is '5'") endif() - - if(CTK_QT_VERSION VERSION_GREATER "4") + if(CTK_QT_VERSION VERSION_EQUAL "5") cmake_minimum_required(VERSION 2.8.12) find_package(Qt5 COMPONENTS Core) set(CTK_QT5_COMPONENTS Core Xml XmlPatterns Concurrent Sql Test Multimedia) @@ -57,35 +56,7 @@ macro(ctkMacroSetupQt) endif() else() - set(minimum_required_qt_version "4.6") - - find_package(Qt4) - - if(QT4_FOUND) - - if("${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}" VERSION_LESS "${minimum_required_qt_version}") - message(FATAL_ERROR "error: CTK requires Qt >= ${minimum_required_qt_version} -- you cannot use Qt ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}.") - endif() - - set(QT_USE_QTNETWORK ON) - set(QT_USE_QTSQL ON) - set(QT_USE_QTOPENGL ON) - set(QT_USE_QTXML ON) - set(QT_USE_QTXMLPATTERNS ON) - set(QT_USE_QTTEST ${BUILD_TESTING}) - include(${QT_USE_FILE}) - - # Set variable QT_INSTALLED_LIBRARY_DIR that will contains - # Qt shared library - set(QT_INSTALLED_LIBRARY_DIR ${QT_LIBRARY_DIR}) - if(WIN32) - get_filename_component(QT_INSTALLED_LIBRARY_DIR ${QT_QMAKE_EXECUTABLE} PATH) - endif() - - mark_as_superbuild(QT_QMAKE_EXECUTABLE) # Qt 4 - else() - message(FATAL_ERROR "error: Qt4 was not found on your system. You probably need to set the QT_QMAKE_EXECUTABLE variable") - endif() + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() mark_as_superbuild(CTK_QT_VERSION) diff --git a/CMake/ctkMacroWrapPythonQt.cmake b/CMake/ctkMacroWrapPythonQt.cmake index cff713b872..fe3d563e2b 100644 --- a/CMake/ctkMacroWrapPythonQt.cmake +++ b/CMake/ctkMacroWrapPythonQt.cmake @@ -165,10 +165,10 @@ macro(ctkMacroWrapPythonQt WRAPPING_NAMESPACE TARGET SRCS_LIST_NAME SOURCES IS_W COMMENT "PythonQt Wrapping - Generating ${wrapper_init_cpp_filename}" VERBATIM ) - if(CTK_QT_VERSION VERSION_GREATER "4") + if(CTK_QT_VERSION VERSION_EQUAL "5") qt5_wrap_cpp(${TARGET}_MOC_CXX ${CMAKE_CURRENT_BINARY_DIR}/${wrapper_h_filename}) else() - QT4_WRAP_CPP(${TARGET}_MOC_CXX ${CMAKE_CURRENT_BINARY_DIR}/${wrapper_h_filename}) + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() # The following files are generated diff --git a/CMakeExternals/Log4Qt.cmake b/CMakeExternals/Log4Qt.cmake index 646c7459f9..a7436d4ef8 100644 --- a/CMakeExternals/Log4Qt.cmake +++ b/CMakeExternals/Log4Qt.cmake @@ -41,11 +41,8 @@ if(NOT DEFINED Log4Qt_DIR) endif() set(ep_cache_args) - if(CTK_QT_VERSION VERSION_LESS "5") - list(APPEND ep_cache_args - -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} - ) - else() + + if(CTK_QT_VERSION VERSION_EQUAL "5") list(APPEND ep_cache_args -DQt5_DIR:PATH=${Qt5_DIR} ) @@ -55,6 +52,12 @@ if(NOT DEFINED Log4Qt_DIR) -DCMAKE_PREFIX_PATH:PATH=${CMAKE_PREFIX_PATH} ) endif() + elseif(CTK_QT_VERSION VERSION_EQUAL "6") + list(APPEND ep_cache_args + -DQt6_DIR:PATH=${Qt6_DIR} + ) + else() + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() ExternalProject_Add(${proj} diff --git a/CMakeExternals/PythonQt.cmake b/CMakeExternals/PythonQt.cmake index 5c6e1911d6..1989e44f51 100644 --- a/CMakeExternals/PythonQt.cmake +++ b/CMakeExternals/PythonQt.cmake @@ -34,7 +34,7 @@ if(NOT DEFINED PYTHONQT_INSTALL_DIR) set(qtlibs core gui multimedia network opengl sql svg uitools xml) # Enable Qt libraries PythonQt wrapping if required - if(CTK_QT_VERSION VERSION_GREATER "4") + if(CTK_QT_VERSION VERSION_EQUAL "5") list(APPEND ep_PythonQt_args -DQt5_DIR:PATH=${Qt5_DIR} ) @@ -48,11 +48,12 @@ if(NOT DEFINED PYTHONQT_INSTALL_DIR) if(CTK_QT_VERSION VERSION_LESS "5.6.0") list(APPEND qtlibs webkit) endif() - else() - list(APPEND ep_PythonQt_args - -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} + elseif(CTK_QT_VERSION VERSION_EQUAL "6") + list(APPEND ep_cache_args + -DQt6_DIR:PATH=${Qt6_DIR} ) - list(APPEND qtlibs webkit) + else() + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() # Set desired qt version for PythonQt @@ -80,11 +81,10 @@ if(NOT DEFINED PYTHONQT_INSTALL_DIR) endif() ctkFunctionExtractOptimizedLibrary(PYTHON_LIBRARIES PYTHON_LIBRARY) - - if (CTK_QT_VERSION VERSION_GREATER "4") + if(CTK_QT_VERSION VERSION_EQUAL "5") set(revision_tag c4a5a155b2942d4b003862c3317105b4a1ea6755) # patched-9 else() - set(revision_tag 90c08fb0d523622d2de9e7a91f4ef116a66a8801) # patched-5 + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() if(${proj}_REVISION_TAG) diff --git a/CMakeExternals/QtSOAP.cmake b/CMakeExternals/QtSOAP.cmake index 72640ea370..7866953a4a 100644 --- a/CMakeExternals/QtSOAP.cmake +++ b/CMakeExternals/QtSOAP.cmake @@ -41,11 +41,8 @@ if(NOT DEFINED QtSOAP_DIR) endif() set(ep_cache_args) - if(CTK_QT_VERSION VERSION_LESS "5") - list(APPEND ep_cache_args - -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} - ) - else() + + if(CTK_QT_VERSION VERSION_EQUAL "5") list(APPEND ep_cache_args -DQt5_DIR:PATH=${Qt5_DIR} ) @@ -55,6 +52,12 @@ if(NOT DEFINED QtSOAP_DIR) -DCMAKE_PREFIX_PATH:PATH=${CMAKE_PREFIX_PATH} ) endif() + elseif(CTK_QT_VERSION VERSION_EQUAL "6") + list(APPEND ep_cache_args + -DQt6_DIR:PATH=${Qt6_DIR} + ) + else() + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() ExternalProject_Add(${proj} diff --git a/CMakeExternals/QtTesting.cmake b/CMakeExternals/QtTesting.cmake index cd9c97c127..ba6b7e498e 100644 --- a/CMakeExternals/QtTesting.cmake +++ b/CMakeExternals/QtTesting.cmake @@ -56,11 +56,7 @@ if(NOT DEFINED QtTesting_DIR) set(ep_cache_args -DQtTesting_QT_VERSION:STRING=${CTK_QT_VERSION}) - if(CTK_QT_VERSION VERSION_LESS "5") - list(APPEND ep_cache_args - -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} - ) - else() + if(CTK_QT_VERSION VERSION_EQUAL "5") list(APPEND ep_cache_args -DQt5_DIR:PATH=${Qt5_DIR} ) @@ -70,8 +66,14 @@ if(NOT DEFINED QtTesting_DIR) -DCMAKE_PREFIX_PATH:PATH=${CMAKE_PREFIX_PATH} ) endif() + elseif(CTK_QT_VERSION VERSION_EQUAL "6") + list(APPEND ep_cache_args + -DQt6_DIR:PATH=${Qt6_DIR} + ) + else() + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() - message(STATUS "Adding project:${proj}") + ExternalProject_Add(${proj} ${${proj}_EXTERNAL_PROJECT_ARGS} SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj} diff --git a/CMakeExternals/VTK.cmake b/CMakeExternals/VTK.cmake index 5ac851910e..31af0a6496 100644 --- a/CMakeExternals/VTK.cmake +++ b/CMakeExternals/VTK.cmake @@ -30,11 +30,7 @@ endif() if(NOT DEFINED VTK_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}) if(NOT DEFINED CTK_VTK_VERSION_MAJOR) - if(CTK_QT_VERSION VERSION_LESS "5") - set(CTK_VTK_VERSION_MAJOR "8") - else() set(CTK_VTK_VERSION_MAJOR "9") - endif() endif() if(NOT CTK_VTK_VERSION_MAJOR MATCHES "^(8|9)$") message(FATAL_ERROR "Expected value for CTK_VTK_VERSION_MAJOR is either '8' or '9'") @@ -104,16 +100,18 @@ if(NOT DEFINED VTK_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj}) endif() endif() - if(CTK_QT_VERSION VERSION_LESS "5") - # Qt4 - list(APPEND additional_vtk_cmakevars - -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} - ) - else() + if(CTK_QT_VERSION VERSION_EQUAL "5") # Qt5 list(APPEND additional_vtk_cmakevars -DQt5_DIR:PATH=${Qt5_DIR} ) + elseif(CTK_QT_VERSION VERSION_EQUAL "6") + # Qt6 + list(APPEND additional_vtk_cmakevars + -DQt6_DIR:PATH=${Qt6_DIR} + ) + else() + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() # VTK 8 diff --git a/CMakeExternals/qRestAPI.cmake b/CMakeExternals/qRestAPI.cmake index 61df51672a..c5fd0b0cdf 100644 --- a/CMakeExternals/qRestAPI.cmake +++ b/CMakeExternals/qRestAPI.cmake @@ -41,11 +41,7 @@ if(NOT DEFINED ${proj}_DIR) endif() set(ep_cache_args) - if(CTK_QT_VERSION VERSION_LESS "5") - list(APPEND ep_cache_args - -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} - ) - else() + if(CTK_QT_VERSION VERSION_EQUAL "5") list(APPEND ep_cache_args -DQt5_DIR:PATH=${Qt5_DIR} ) @@ -55,6 +51,12 @@ if(NOT DEFINED ${proj}_DIR) -DCMAKE_PREFIX_PATH:PATH=${CMAKE_PREFIX_PATH} ) endif() + elseif(CTK_QT_VERSION VERSION_EQUAL "6") + list(APPEND ep_cache_args + -DQt6_DIR:PATH=${Qt6_DIR} + ) + else() + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() ExternalProject_Add(${proj} diff --git a/CMakeExternals/qxmlrpc.cmake b/CMakeExternals/qxmlrpc.cmake index 268341c72a..4bfe8808bb 100644 --- a/CMakeExternals/qxmlrpc.cmake +++ b/CMakeExternals/qxmlrpc.cmake @@ -43,11 +43,8 @@ if(NOT DEFINED qxmlrpc_DIR) endif() set(ep_cache_args) - if(CTK_QT_VERSION VERSION_LESS "5") - list(APPEND ep_cache_args - -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} - ) - else() + + if(CTK_QT_VERSION VERSION_EQUAL "5") list(APPEND ep_cache_args -DQt5_DIR:PATH=${Qt5_DIR} ) @@ -57,6 +54,12 @@ if(NOT DEFINED qxmlrpc_DIR) -DCMAKE_PREFIX_PATH:PATH=${CMAKE_PREFIX_PATH} ) endif() + elseif(CTK_QT_VERSION VERSION_EQUAL "6") + list(APPEND ep_cache_args + -DQt6_DIR:PATH=${Qt6_DIR} + ) + else() + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() ExternalProject_Add(${proj} diff --git a/CMakeLists.txt b/CMakeLists.txt index 07370da301..bf2028cf95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -420,11 +420,6 @@ endif() # ctkMacroSetupQt() -# Update CTK_BASE_LIBRARIES with QT libraries -if(QT4_FOUND) - set(CTK_BASE_LIBRARIES ${CTK_BASE_LIBRARIES} ${QT_LIBRARIES} CACHE INTERNAL "CTK base libraries" FORCE) -endif() - #----------------------------------------------------------------------------- # To make options show up in both CTK-SuperBuild and CTK regular build, let's add them # before the SuperBuild script is included diff --git a/Libs/CommandLineModules/Core/CMakeLists.txt b/Libs/CommandLineModules/Core/CMakeLists.txt index ce55df9e43..9e45f65f13 100644 --- a/Libs/CommandLineModules/Core/CMakeLists.txt +++ b/Libs/CommandLineModules/Core/CMakeLists.txt @@ -79,12 +79,11 @@ set(KIT_resources # The following macro will read the target libraries from the file 'target_libraries.cmake' ctkFunctionGetTargetLibraries(KIT_target_libraries) -if(CTK_QT_VERSION VERSION_GREATER "4") - list(APPEND KIT_target_libraries Qt5::XmlPatterns Qt5::Widgets Qt5::Concurrent) -else() - set(QT_USE_QTXMLPATTERNS 1) - include(${QT_USE_FILE}) -endif() +list(APPEND KIT_target_libraries + Qt${CTK_QT_VERSION}::Concurrent + Qt${CTK_QT_VERSION}::XmlPatterns + Qt${CTK_QT_VERSION}::Widgets + ) ctkMacroBuildLib( NAME ${PROJECT_NAME} diff --git a/Libs/CommandLineModules/Core/Testing/Cpp/CMakeLists.txt b/Libs/CommandLineModules/Core/Testing/Cpp/CMakeLists.txt index a913bba331..8ffe456455 100644 --- a/Libs/CommandLineModules/Core/Testing/Cpp/CMakeLists.txt +++ b/Libs/CommandLineModules/Core/Testing/Cpp/CMakeLists.txt @@ -25,7 +25,7 @@ include_directories( set(Tests_MOC_CPP) set(Tests_UI_CPP) set(Tests_RESOURCES_SRCS) -if(CTK_QT_VERSION VERSION_GREATER "4") +if(CTK_QT_VERSION VERSION_EQUAL "5") QT5_WRAP_CPP(Tests_MOC_CPP ${Tests_MOC_SRCS}) QT5_GENERATE_MOCS( ctkCmdLineModuleManagerTest.cpp @@ -36,22 +36,13 @@ if(CTK_QT_VERSION VERSION_GREATER "4") endif() QT5_ADD_RESOURCES(Tests_RESOURCES_SRCS ${Tests_RESOURCES}) else() - QT4_WRAP_CPP(Tests_MOC_CPP ${Tests_MOC_SRCS}) - QT4_GENERATE_MOCS( - ctkCmdLineModuleManagerTest.cpp - ctkCmdLineModuleXmlProgressWatcherTest.cpp - ) - if(TEST_UI_FORMS) - QT4_WRAP_UI(Tests_UI_CPP ${Tests_UI_FORMS}) - endif() - QT4_ADD_RESOURCES(Tests_RESOURCES_SRCS ${Tests_RESOURCES}) + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() + ctk_add_executable_utf8(${KIT}CppTests ${Tests} ${Tests_SRCS} ${Tests_MOC_CPP} ${Tests_UI_CPP} ${Tests_RESOURCES_SRCS}) target_link_libraries(${KIT}CppTests ${LIBRARY_NAME} ${CTK_BASE_LIBRARIES}) -if(CTK_QT_VERSION VERSION_GREATER "4") - target_link_libraries(${KIT}CppTests Qt5::Test) -endif() +target_link_libraries(${KIT}CppTests Qt${CTK_QT_VERSION}::Test) # # Add Tests diff --git a/Libs/CommandLineModules/Frontend/QtGui/CMakeLists.txt b/Libs/CommandLineModules/Frontend/QtGui/CMakeLists.txt index 3ad6dd1e6d..643638dc4a 100644 --- a/Libs/CommandLineModules/Frontend/QtGui/CMakeLists.txt +++ b/Libs/CommandLineModules/Frontend/QtGui/CMakeLists.txt @@ -42,12 +42,10 @@ set(KIT_resources # The following macro will read the target libraries from the file 'target_libraries.cmake' ctkFunctionGetTargetLibraries(KIT_target_libraries) -if(CTK_QT_VERSION VERSION_GREATER "4") - list(APPEND KIT_target_libraries Qt5::UiTools Qt5::Widgets) -else() - set(QT_USE_QTUITOOLS 1) - include(${QT_USE_FILE}) -endif() +list(APPEND KIT_target_libraries + Qt${CTK_QT_VERSION}::UiTools + Qt${CTK_QT_VERSION}::Widgets + ) ctkMacroBuildLib( NAME ${PROJECT_NAME} diff --git a/Libs/CommandLineModules/Frontend/QtGui/Testing/Cpp/CMakeLists.txt b/Libs/CommandLineModules/Frontend/QtGui/Testing/Cpp/CMakeLists.txt index 4fa7d64a26..0f8daec2bf 100644 --- a/Libs/CommandLineModules/Frontend/QtGui/Testing/Cpp/CMakeLists.txt +++ b/Libs/CommandLineModules/Frontend/QtGui/Testing/Cpp/CMakeLists.txt @@ -27,7 +27,7 @@ include_directories( set(Tests_MOC_CPP) set(Tests_UI_CPP) set(Tests_RESOURCES_SRCS) -if(CTK_QT_VERSION VERSION_GREATER "4") +if(CTK_QT_VERSION VERSION_EQUAL "5") QT5_WRAP_CPP(Tests_MOC_CPP ${Tests_MOC_SRCS}) QT5_GENERATE_MOCS( ctkCmdLineModuleFrontendQtGuiTest.cpp @@ -38,23 +38,13 @@ if(CTK_QT_VERSION VERSION_GREATER "4") endif() QT5_ADD_RESOURCES(Tests_RESOURCES_SRCS ${Tests_RESOURCES}) else() - QT4_WRAP_CPP(Tests_MOC_CPP ${Tests_MOC_SRCS}) - QT4_GENERATE_MOCS( - ctkCmdLineModuleFrontendQtGuiTest.cpp - ctkCmdLineModuleQtXslTransformTest.cpp - ) - if(TEST_UI_FORMS) - QT4_WRAP_UI(Tests_UI_CPP ${Tests_UI_FORMS}) - endif() - QT4_ADD_RESOURCES(Tests_RESOURCES_SRCS ${Tests_RESOURCES}) + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() ctk_add_executable_utf8(${KIT}CppTests ${Tests} ${Tests_SRCS} ${Tests_MOC_CPP} ${Tests_UI_CPP} ${Tests_RESOURCES_SRCS}) target_link_libraries(${KIT}CppTests ${LIBRARY_NAME} ${CTK_BASE_LIBRARIES}) -if(CTK_QT_VERSION VERSION_GREATER "4") - target_link_libraries(${KIT}CppTests Qt5::Test) -endif() +target_link_libraries(${KIT}CppTests Qt${CTK_QT_VERSION}::Test) # # Add Tests diff --git a/Libs/CommandLineModules/Frontend/QtWebKit/CMakeLists.txt b/Libs/CommandLineModules/Frontend/QtWebKit/CMakeLists.txt index 234dd56d4d..a83e9aca00 100644 --- a/Libs/CommandLineModules/Frontend/QtWebKit/CMakeLists.txt +++ b/Libs/CommandLineModules/Frontend/QtWebKit/CMakeLists.txt @@ -36,15 +36,16 @@ set(KIT_resources # The following macro will read the target libraries from the file 'target_libraries.cmake' ctkFunctionGetTargetLibraries(KIT_target_libraries) -if(CTK_QT_VERSION VERSION_GREATER "4") +if(CTK_QT_VERSION VERSION_EQUAL "5") if(TARGET Qt5::WebKitWidgets) list(APPEND KIT_target_libraries Qt5::WebKitWidgets) else() list(APPEND KIT_target_libraries Qt5::WebEngineWidgets) endif() +elseif(CTK_QT_VERSION VERSION_EQUAL "6") + list(APPEND KIT_target_libraries Qt6::WebEngineWidgets) else() - set(QT_USE_QTWEBKIT 1) - include(${QT_USE_FILE}) + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() ctkMacroBuildLib( diff --git a/Libs/CommandLineModules/Testing/Cpp/CMakeLists.txt b/Libs/CommandLineModules/Testing/Cpp/CMakeLists.txt index 58a290ae26..2f1a3fdf7c 100644 --- a/Libs/CommandLineModules/Testing/Cpp/CMakeLists.txt +++ b/Libs/CommandLineModules/Testing/Cpp/CMakeLists.txt @@ -5,11 +5,6 @@ set(_test_srcs) set(_test_mocs) if(CTK_LIB_CommandLineModules/Frontend/QtGui) - if(CTK_QT_VERSION VERSION_LESS "5") - set(QT_USE_QTUITOOLS 1) - include(${QT_USE_FILE}) - endif() - if(CTK_LIB_CommandLineModules/Backend/LocalProcess) set(_test_cpp_files ctkCmdLineModuleFutureTest.cpp @@ -72,7 +67,7 @@ endif() set(Tests_MOC_CPP) set(Tests_UI_CPP) set(Tests_RESOURCES_SRCS) -if (CTK_QT_VERSION VERSION_GREATER "4") +if(CTK_QT_VERSION VERSION_EQUAL "5") QT5_WRAP_CPP(Tests_MOC_CPP ${Tests_MOC_SRCS}) if(_test_mocs) QT5_GENERATE_MOCS(${_test_mocs}) @@ -82,23 +77,17 @@ if (CTK_QT_VERSION VERSION_GREATER "4") endif() QT5_ADD_RESOURCES(Tests_RESOURCES_SRCS ${Tests_RESOURCES}) else() - QT4_WRAP_CPP(Tests_MOC_CPP ${Tests_MOC_SRCS}) - if(_test_mocs) - QT4_GENERATE_MOCS(${_test_mocs}) - endif() - if(TEST_UI_FORMS) - QT4_WRAP_UI(Tests_UI_CPP ${Tests_UI_FORMS}) - endif() - QT4_ADD_RESOURCES(Tests_RESOURCES_SRCS ${Tests_RESOURCES}) + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() ctk_add_executable_utf8(${KIT}CppTests ${Tests} ${Tests_SRCS} ${Tests_MOC_CPP} ${Tests_UI_CPP} ${Tests_RESOURCES_SRCS}) target_link_libraries(${KIT}CppTests ${_additional_link_libraries}) add_dependencies(${KIT}CppTests ctkCmdLineTestModules) -if(CTK_QT_VERSION VERSION_GREATER "4") - target_link_libraries(${KIT}CppTests Qt5::Gui Qt5::Test) -endif() +target_link_libraries(${KIT}CppTests + Qt${CTK_QT_VERSION}::Gui + Qt${CTK_QT_VERSION}::Test + ) if(TARGET CTKCommandLineModulesCoreCppTests) add_dependencies(${KIT}CppTests CTKCommandLineModulesCoreCppTests) diff --git a/Libs/CommandLineModules/Testing/Modules/CMakeLists.txt b/Libs/CommandLineModules/Testing/Modules/CMakeLists.txt index 279ea1556d..aa1b3bf74e 100644 --- a/Libs/CommandLineModules/Testing/Modules/CMakeLists.txt +++ b/Libs/CommandLineModules/Testing/Modules/CMakeLists.txt @@ -5,18 +5,16 @@ function(ctkFunctionCreateCmdLineModule name) set(_src_files ${ARGN}) list(APPEND _src_files ctkCmdLineModule${name}.cpp) - if(CTK_QT_VERSION VERSION_LESS "5") - qt4_add_resources(_src_files ctkCmdLineModule${name}.qrc) - else() + if(CTK_QT_VERSION VERSION_EQUAL "5") qt5_add_resources(_src_files ctkCmdLineModule${name}.qrc) + else() + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() ctk_add_executable_utf8(ctkCmdLineModule${name} ${_src_files}) - if(CTK_QT_VERSION VERSION_LESS "5") - target_link_libraries(ctkCmdLineModule${name} CTKCore ${QT_LIBRARIES}) - else() - target_link_libraries(ctkCmdLineModule${name} CTKCore Qt5::Widgets) - endif() + + target_link_libraries(ctkCmdLineModule${name} CTKCore Qt${CTK_QT_VERSION}::Widgets) + add_dependencies(ctkCmdLineTestModules ctkCmdLineModule${name}) endfunction() diff --git a/Libs/Core/CMakeLists.txt b/Libs/Core/CMakeLists.txt index aaed441f31..1873e89be5 100644 --- a/Libs/Core/CMakeLists.txt +++ b/Libs/Core/CMakeLists.txt @@ -136,9 +136,7 @@ set(KIT_target_libraries) ctkFunctionGetTargetLibraries(KIT_target_libraries) -if(CTK_QT_VERSION VERSION_GREATER "4") - list(APPEND KIT_target_libraries Qt5::Core) -endif() +list(APPEND KIT_target_libraries Qt${CTK_QT_VERSION}::Core) ctkMacroBuildLib( NAME ${PROJECT_NAME} diff --git a/Libs/Core/Testing/Cpp/CMakeLists.txt b/Libs/Core/Testing/Cpp/CMakeLists.txt index 371c375037..afefcce2a2 100644 --- a/Libs/Core/Testing/Cpp/CMakeLists.txt +++ b/Libs/Core/Testing/Cpp/CMakeLists.txt @@ -36,6 +36,7 @@ set(KITTests_SRCS ctkLoggerTest1.cpp ctkModelTesterTest1.cpp ctkModelTesterTest2.cpp + ctkUtf8Test1.cpp ctkUtilsCopyDirRecursivelyTest1.cpp ctkUtilsIsDirEmptyTest1.cpp ctkUtilsQtHandleToStringTest1.cpp @@ -53,11 +54,6 @@ set(KITTests_SRCS ctkWorkflowTest2.cpp ctkWorkflowTest3.cpp ) -if(CTK_QT_VERSION VERSION_GREATER "4") - list(APPEND KITTests_SRCS - ctkUtf8Test1.cpp - ) -endif() if(HAVE_BFD) list(APPEND KITTests_SRCS ctkBinaryFileDescriptorTest1.cpp @@ -105,12 +101,11 @@ set(Tests_Helpers_MOC_CPPS ) set(Tests_Helpers_MOC_CPP) -if(CTK_QT_VERSION VERSION_GREATER "4") +if(CTK_QT_VERSION VERSION_EQUAL "5") qt5_wrap_cpp(Tests_Helpers_MOC_CPP ${Tests_Helpers_MOC_SRCS}) qt5_generate_mocs(${Tests_Helpers_MOC_CPPS}) else() - QT4_WRAP_CPP(Tests_Helpers_MOC_CPP ${Tests_Helpers_MOC_SRCS}) - QT4_GENERATE_MOCS(${Tests_Helpers_MOC_CPPS}) + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() if(HAVE_BFD) @@ -127,10 +122,11 @@ endif() ctk_add_executable_utf8(${KIT}CppTests ${Tests} ${Tests_Helpers_SRCS} ${Tests_Helpers_MOC_CPP}) target_link_libraries(${KIT}CppTests ${LIBRARY_NAME} ${CTK_BASE_LIBRARIES} CTKDummyPlugin) -if(CTK_QT_VERSION VERSION_GREATER "4") - find_package(Qt5 COMPONENTS Test Widgets REQUIRED) - target_link_libraries(${KIT}CppTests Qt5::Test Qt5::Widgets) -endif() +find_package(Qt${CTK_QT_VERSION} COMPONENTS Test Widgets REQUIRED) +target_link_libraries(${KIT}CppTests + Qt${CTK_QT_VERSION}::Test + Qt${CTK_QT_VERSION}::Widgets + ) if(UNIX AND NOT APPLE) target_link_libraries(${KIT}CppTests rt) diff --git a/Libs/Core/target_libraries.cmake b/Libs/Core/target_libraries.cmake index e4411abd99..bd6d821595 100644 --- a/Libs/Core/target_libraries.cmake +++ b/Libs/Core/target_libraries.cmake @@ -7,7 +7,3 @@ set(target_libraries BFD_LIBRARIES ) - -if (CTK_QT_VERSION VERSION_LESS "5") - list(APPEND target_libraries QT_LIBRARIES) -endif() diff --git a/Libs/DICOM/Core/CMakeLists.txt b/Libs/DICOM/Core/CMakeLists.txt index 634f3d16c6..80a5422544 100644 --- a/Libs/DICOM/Core/CMakeLists.txt +++ b/Libs/DICOM/Core/CMakeLists.txt @@ -88,9 +88,7 @@ set(KIT_resources # The following macro will read the target libraries from the file 'target_libraries.cmake' ctkFunctionGetTargetLibraries(KIT_target_libraries) -if(CTK_QT_VERSION VERSION_GREATER "4") - list(APPEND KIT_target_libraries Qt5::Sql) -endif() +list(APPEND KIT_target_libraries Qt${CTK_QT_VERSION}::Sql) # create a dcm query/retrieve service config file that points to the build dir set (DCMQRSCP_STORE_DIR ${CMAKE_CURRENT_BINARY_DIR}/Testing) diff --git a/Libs/DICOM/Core/ctkDICOMDatabase.h b/Libs/DICOM/Core/ctkDICOMDatabase.h index 3fb6ad80ac..491f6fe316 100644 --- a/Libs/DICOM/Core/ctkDICOMDatabase.h +++ b/Libs/DICOM/Core/ctkDICOMDatabase.h @@ -33,7 +33,6 @@ class QDateTime; class ctkDICOMDatabasePrivate; class DcmDataset; class ctkDICOMAbstractThumbnailGenerator; -class ctkDICOMBrowser; class ctkDICOMDisplayedFieldGenerator; /// \ingroup DICOM_Core @@ -451,7 +450,6 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMDatabase : public QObject private: Q_DECLARE_PRIVATE(ctkDICOMDatabase); Q_DISABLE_COPY(ctkDICOMDatabase); - friend class ctkDICOMBrowser; // For access to databaseChanged() if building against Qt4 }; #endif diff --git a/Libs/DICOM/Widgets/Testing/Cpp/CMakeLists.txt b/Libs/DICOM/Widgets/Testing/Cpp/CMakeLists.txt index d198b7beb5..8434d43437 100644 --- a/Libs/DICOM/Widgets/Testing/Cpp/CMakeLists.txt +++ b/Libs/DICOM/Widgets/Testing/Cpp/CMakeLists.txt @@ -26,14 +26,13 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) -set(CTK_QT_TEST_LIBRARY ) +find_package(Qt${CTK_QT_VERSION} COMPONENTS Test REQUIRED) +set(CTK_QT_TEST_LIBRARY Qt${CTK_QT_VERSION}::Test) -if (CTK_QT_VERSION VERSION_GREATER "4") - find_package(Qt5Test REQUIRED) - set(CTK_QT_TEST_LIBRARY Qt5::Test) +if(CTK_QT_VERSION VERSION_EQUAL "5") qt5_generate_mocs(${Tests_MOC_CPPS}) else() - qt4_generate_mocs(${Tests_MOC_CPPS}) + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() SET (TestsToRun ${Tests}) diff --git a/Libs/ImageProcessing/ITK/Core/Testing/Cpp/CMakeLists.txt b/Libs/ImageProcessing/ITK/Core/Testing/Cpp/CMakeLists.txt index 2fdbbeea56..15fca5f9fa 100644 --- a/Libs/ImageProcessing/ITK/Core/Testing/Cpp/CMakeLists.txt +++ b/Libs/ImageProcessing/ITK/Core/Testing/Cpp/CMakeLists.txt @@ -34,7 +34,7 @@ include_directories( # ctkVTKObjectTestHelper.cpp # ) -#QT4_WRAP_CPP(KIT_HELPER_SRCS ctkVTKObjectTestHelper.h) +#QT5_WRAP_CPP(KIT_HELPER_SRCS ctkVTKObjectTestHelper.h) # # Tests diff --git a/Libs/PluginFramework/CMakeLists.txt b/Libs/PluginFramework/CMakeLists.txt index 06f8db9a4c..4e4c092e7a 100644 --- a/Libs/PluginFramework/CMakeLists.txt +++ b/Libs/PluginFramework/CMakeLists.txt @@ -157,9 +157,10 @@ set(KIT_resources # The following macro will read the target libraries from the file 'target_libraries.cmake' ctkFunctionGetTargetLibraries(KIT_target_libraries) -if(CTK_QT_VERSION VERSION_GREATER "4") - list(APPEND KIT_target_libraries Qt5::Sql Qt5::Concurrent) -endif() +list(APPEND KIT_target_libraries + Qt${CTK_QT_VERSION}::Concurrent + Qt${CTK_QT_VERSION}::Sql + ) # Create a MANIFEST.MF resource for the PluginFramework library, # pretending that it is a plugin (the system plugin) diff --git a/Libs/PluginFramework/Documentation/Snippets/EventAdmin-Intro/files.cmake b/Libs/PluginFramework/Documentation/Snippets/EventAdmin-Intro/files.cmake index 720e0e0c99..867e25b96f 100644 --- a/Libs/PluginFramework/Documentation/Snippets/EventAdmin-Intro/files.cmake +++ b/Libs/PluginFramework/Documentation/Snippets/EventAdmin-Intro/files.cmake @@ -8,11 +8,10 @@ set(_moc_files ) foreach(_moc_file ${_moc_files}) - if (CTK_QT_VERSION VERSION_GREATER "4") + if(CTK_QT_VERSION VERSION_EQUAL "5") QT5_WRAP_CPP(snippet_src_files EventAdmin-Intro/${_moc_file} OPTIONS -f${CMAKE_CURRENT_SOURCE_DIR}/EventAdmin-Intro/${_moc_file}) else() - QT4_WRAP_CPP(snippet_src_files EventAdmin-Intro/${_moc_file} - OPTIONS -f${CMAKE_CURRENT_SOURCE_DIR}/EventAdmin-Intro/${_moc_file}) + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() endforeach() diff --git a/Libs/PluginFramework/Testing/Cpp/CMakeLists.txt b/Libs/PluginFramework/Testing/Cpp/CMakeLists.txt index f3ca856c8c..94c2fa1a5e 100644 --- a/Libs/PluginFramework/Testing/Cpp/CMakeLists.txt +++ b/Libs/PluginFramework/Testing/Cpp/CMakeLists.txt @@ -13,13 +13,11 @@ set(MOC_SRCS ) set(MY_MOC_CXX ) -#QT4_WRAP_CPP(MY_MOC_CXX ${MOC_SRCS}) +#QT5_WRAP_CPP(MY_MOC_CXX ${MOC_SRCS}) set(lib_name ${fwtestutil_lib}) add_library(${lib_name} SHARED ${SRCS} ${MY_MOC_CXX}) target_link_libraries(${lib_name} ${fw_lib}) -if(CTK_QT_VERSION VERSION_GREATER "4") - target_link_libraries(${lib_name} Qt5::Test) -endif() +target_link_libraries(${lib_name} Qt${CTK_QT_VERSION}::Test) diff --git a/Libs/PluginFramework/Testing/FrameworkTestPlugins/app_test/CMakeLists.txt b/Libs/PluginFramework/Testing/FrameworkTestPlugins/app_test/CMakeLists.txt index 401d183765..6c7a60841a 100644 --- a/Libs/PluginFramework/Testing/FrameworkTestPlugins/app_test/CMakeLists.txt +++ b/Libs/PluginFramework/Testing/FrameworkTestPlugins/app_test/CMakeLists.txt @@ -37,12 +37,11 @@ set(MOC_SRCS ) set(MY_MOC_CXX ) -if(CTK_QT_VERSION VERSION_GREATER "4") +if(CTK_QT_VERSION VERSION_EQUAL "5") qt5_wrap_cpp(MY_MOC_CXX ${MOC_SRCS}) else() - qt4_wrap_cpp(MY_MOC_CXX ${MOC_SRCS}) + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() - set(test_executable ${fw_lib}AppTests) ctk_add_executable_utf8(${test_executable} ${SRCS} ${MY_MOC_CXX}) @@ -50,9 +49,7 @@ target_link_libraries(${test_executable} ${fw_lib} ) -if(CTK_QT_VERSION VERSION_GREATER "4") - target_link_libraries(${test_executable} Qt5::Test) -endif() +target_link_libraries(${test_executable} Qt${CTK_QT_VERSION}::Test) add_dependencies(${test_executable} ${PROJECT_NAME}) diff --git a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginD_test/CMakeLists.txt b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginD_test/CMakeLists.txt index 7a519b8dd6..a6bb4afc39 100644 --- a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginD_test/CMakeLists.txt +++ b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginD_test/CMakeLists.txt @@ -8,17 +8,9 @@ set(PLUGIN_SRCS set(lib_name ${PROJECT_NAME}) -if(CTK_QT_VERSION VERSION_LESS "5") - include(${QT_USE_FILE}) -endif() - add_library(${lib_name} SHARED ${PLUGIN_SRCS}) -if(CTK_QT_VERSION VERSION_LESS "5") - target_link_libraries(${lib_name} ${QT_LIBRARIES}) -else() - target_link_libraries(${lib_name} Qt5::Core) -endif() +target_link_libraries(${lib_name} Qt${CTK_QT_VERSION}::Core) # Apply properties to the library target. set_target_properties(${lib_name} PROPERTIES diff --git a/Libs/PluginFramework/Testing/org.commontk.pluginfwtest/CMakeLists.txt b/Libs/PluginFramework/Testing/org.commontk.pluginfwtest/CMakeLists.txt index 90d1f51ff2..f3a10eb92e 100644 --- a/Libs/PluginFramework/Testing/org.commontk.pluginfwtest/CMakeLists.txt +++ b/Libs/PluginFramework/Testing/org.commontk.pluginfwtest/CMakeLists.txt @@ -49,7 +49,7 @@ set(MOC_SRCS ) set(MY_MOC_CXX ) -#QT4_WRAP_CPP(MY_MOC_CXX ${MOC_SRCS}) +#QT5_WRAP_CPP(MY_MOC_CXX ${MOC_SRCS}) set(test_executable ${fw_lib}CppTests) diff --git a/Libs/QtTesting/CMakeLists.txt b/Libs/QtTesting/CMakeLists.txt index 846207740d..6d1171d84c 100644 --- a/Libs/QtTesting/CMakeLists.txt +++ b/Libs/QtTesting/CMakeLists.txt @@ -150,9 +150,10 @@ set(QtTesting_LIBRARIES QtTesting) # The following macro will read the target libraries from the file 'target_libraries.cmake' ctkFunctionGetTargetLibraries(KIT_target_libraries) -if(CTK_QT_VERSION VERSION_GREATER "4") - list(APPEND KIT_target_libraries Qt5::Xml Qt5::XmlPatterns) -endif() +list(APPEND KIT_target_libraries + Qt${CTK_QT_VERSION}::Xml + Qt${CTK_QT_VERSION}::XmlPatterns + ) ctkMacroBuildLib( NAME ${PROJECT_NAME} diff --git a/Libs/Scripting/Python/Core/Testing/Cpp/CMakeLists.txt b/Libs/Scripting/Python/Core/Testing/Cpp/CMakeLists.txt index 31593d59d3..0ae968b06b 100644 --- a/Libs/Scripting/Python/Core/Testing/Cpp/CMakeLists.txt +++ b/Libs/Scripting/Python/Core/Testing/Cpp/CMakeLists.txt @@ -13,18 +13,15 @@ set(LIBRARY_NAME ${PROJECT_NAME}) include_directories(${CMAKE_SOURCE_DIR}/Libs/Testing ${CMAKE_CURRENT_BINARY_DIR}) -set(CTK_QT_TEST_LIBRARY ) +find_package(Qt${CTK_QT_VERSION} COMPONENTS Test REQUIRED) +set(CTK_QT_TEST_LIBRARY Qt${CTK_QT_VERSION}::Test) -if (CTK_QT_VERSION VERSION_GREATER "4") - find_package(Qt5Test REQUIRED) - set(CTK_QT_TEST_LIBRARY Qt5::Test) +if(CTK_QT_VERSION VERSION_EQUAL "5") QT5_GENERATE_MOCS( ctkAbstractPythonManagerTest.cpp ) else() - QT4_GENERATE_MOCS( - ctkAbstractPythonManagerTest.cpp - ) + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() ctk_add_executable_utf8(${KIT}CppTests ${Tests}) diff --git a/Libs/Visualization/VTK/Core/Testing/Cpp/CMakeLists.txt b/Libs/Visualization/VTK/Core/Testing/Cpp/CMakeLists.txt index 56dfda926e..58b659ffee 100644 --- a/Libs/Visualization/VTK/Core/Testing/Cpp/CMakeLists.txt +++ b/Libs/Visualization/VTK/Core/Testing/Cpp/CMakeLists.txt @@ -40,11 +40,11 @@ set(KIT_HELPER_SRCS ctkVTKObjectTestHelper.cpp ) -if(CTK_QT_VERSION VERSION_GREATER "4") +if(CTK_QT_VERSION VERSION_EQUAL "5") QT5_WRAP_CPP(KIT_HELPER_SRCS ctkVTKObjectTestHelper.h) include_directories(${Qt5Widgets_INCLUDE_DIRS}) else() - QT4_WRAP_CPP(KIT_HELPER_SRCS ctkVTKObjectTestHelper.h) + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() # diff --git a/Libs/Visualization/VTK/Widgets/CMakeLists.txt b/Libs/Visualization/VTK/Widgets/CMakeLists.txt index 5c4661fa79..fcc9dde095 100644 --- a/Libs/Visualization/VTK/Widgets/CMakeLists.txt +++ b/Libs/Visualization/VTK/Widgets/CMakeLists.txt @@ -251,9 +251,7 @@ endif() # Prefer QVTKOpenGLWidget to QVTKWidget when using Qt5 set(_use_qvtkopenglwidget 1) if(VTK_VERSION VERSION_LESS "8.90") - if(CTK_QT_VERSION VERSION_LESS "5" - OR VTK_VERSION VERSION_LESS "8" - OR (NOT VTK_RENDERING_BACKEND STREQUAL "OpenGL2")) + if(NOT VTK_RENDERING_BACKEND STREQUAL "OpenGL2") set(_use_qvtkopenglwidget 0) endif() endif() diff --git a/Libs/Visualization/VTK/Widgets/Testing/Cpp/CMakeLists.txt b/Libs/Visualization/VTK/Widgets/Testing/Cpp/CMakeLists.txt index 9563360268..f38b82f0c7 100644 --- a/Libs/Visualization/VTK/Widgets/Testing/Cpp/CMakeLists.txt +++ b/Libs/Visualization/VTK/Widgets/Testing/Cpp/CMakeLists.txt @@ -107,7 +107,7 @@ endif() set(TEST_MOC_CPP) set(TEST_UI_CPP) set(Tests_RESOURCES_SRCS) -if(CTK_QT_VERSION VERSION_GREATER "4") +if(CTK_QT_VERSION VERSION_EQUAL "5") if(TEST_MOC_SOURCES) QT5_WRAP_CPP(TEST_MOC_CPP ${TEST_MOC_SOURCES}) endif() @@ -119,16 +119,7 @@ if(CTK_QT_VERSION VERSION_GREATER "4") endif() QT5_ADD_RESOURCES(Tests_RESOURCES_SRCS ${Tests_RESOURCES}) else() - if(TEST_MOC_SOURCES) - QT4_WRAP_CPP(TEST_MOC_CPP ${TEST_MOC_SOURCES}) - endif() - QT4_GENERATE_MOCS( - ctkVTKPropertyWidgetTest.cpp - ) - if(TEST_UI_FORMS) - QT4_WRAP_UI(TEST_UI_CPP ${TEST_UI_FORMS}) - endif() - QT4_ADD_RESOURCES(Tests_RESOURCES_SRCS ${Tests_RESOURCES}) + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() ctk_add_executable_utf8(${KIT}CppTests ${Tests} ${TEST_MOC_CPP} ${TEST_UI_CPP} ${Tests_RESOURCES_SRCS}) @@ -144,9 +135,7 @@ endif() target_link_libraries(${KIT}CppTests ${LIBRARY_NAME} ${VTK_CHARTS_LIB} ${CTK_BASE_LIBRARIES}) -if(CTK_QT_VERSION VERSION_GREATER "4") - target_link_libraries(${KIT}CppTests ${Qt5Test_LIBRARIES}) -endif() +target_link_libraries(${KIT}CppTests Qt${CTK_QT_VERSION}::Test) if(CTK_USE_QTTESTING) target_link_libraries(${KIT}CppTests CTKQtTesting) endif() diff --git a/Libs/Visualization/VTK/Widgets/target_libraries.cmake b/Libs/Visualization/VTK/Widgets/target_libraries.cmake index 7edaeb805d..24d220e17c 100644 --- a/Libs/Visualization/VTK/Widgets/target_libraries.cmake +++ b/Libs/Visualization/VTK/Widgets/target_libraries.cmake @@ -9,6 +9,8 @@ set(target_libraries CTKWidgets CTKVisualizationVTKCore ) -if (CTK_QT_VERSION VERSION_GREATER "4") +if(CTK_QT_VERSION VERSION_EQUAL "5") list(APPEND target_libraries Qt5Network_LIBRARIES Qt5WebKit_LIBRARIES) +else() + message(FATAL_ERROR "Support for this Qt is not implemented") endif() diff --git a/Libs/Widgets/CMakeLists.txt b/Libs/Widgets/CMakeLists.txt index 088f2cb744..f66fdc7b78 100644 --- a/Libs/Widgets/CMakeLists.txt +++ b/Libs/Widgets/CMakeLists.txt @@ -352,9 +352,7 @@ set(KIT_resources # The following macro will read the target libraries from the file 'target_libraries.cmake' ctkFunctionGetTargetLibraries(KIT_target_libraries) -if(CTK_QT_VERSION VERSION_GREATER "4") list(APPEND KIT_target_libraries Qt5::Widgets Qt5::Xml Qt5::OpenGL) -endif() # A player and a translator must be added for custom Qt widgets if(CTK_USE_QTTESTING) diff --git a/Libs/Widgets/Testing/Cpp/CMakeLists.txt b/Libs/Widgets/Testing/Cpp/CMakeLists.txt index a0bc6d6bdf..81917bf532 100644 --- a/Libs/Widgets/Testing/Cpp/CMakeLists.txt +++ b/Libs/Widgets/Testing/Cpp/CMakeLists.txt @@ -232,7 +232,7 @@ set(Tests_MOC_CPPS set(Tests_MOC_CPP) set(Tests_UI_CPP) set(Tests_RESOURCES_SRCS) -if(CTK_QT_VERSION VERSION_GREATER "4") +if(CTK_QT_VERSION VERSION_EQUAL "5") qt5_wrap_cpp(Tests_MOC_CPP ${Tests_MOC_SRCS}) qt5_generate_mocs(${Tests_MOC_CPPS}) if(TEST_UI_FORMS) @@ -240,24 +240,22 @@ if(CTK_QT_VERSION VERSION_GREATER "4") endif() qt5_add_resources(Tests_RESOURCES_SRCS ${Tests_RESOURCES}) else() - QT4_WRAP_CPP(Tests_MOC_CPP ${Tests_MOC_SRCS}) - QT4_GENERATE_MOCS(${Tests_MOC_CPPS}) - if(TEST_UI_FORMS) - QT4_WRAP_UI(Tests_UI_CPP ${Tests_UI_FORMS}) - endif() - QT4_ADD_RESOURCES(Tests_RESOURCES_SRCS ${Tests_RESOURCES}) + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() ctk_add_executable_utf8(${KIT}CppTests ${Tests} ${Tests_SRCS} ${Tests_MOC_CPP} ${Tests_UI_CPP} ${Tests_RESOURCES_SRCS}) target_link_libraries(${KIT}CppTests ${LIBRARY_NAME}) -if(CTK_QT_VERSION VERSION_GREATER "4") +if(CTK_QT_VERSION VERSION_EQUAL "5") list(APPEND KIT_target_libraries Qt5::Test) if(CTK_USE_QTTESTING) list(APPEND KIT_target_libraries Qt5::Xml Qt5::XmlPatterns) endif() target_link_libraries(${KIT}CppTests ${KIT_target_libraries}) +else() + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() + if(CTK_USE_QTTESTING) target_link_libraries(${KIT}CppTests CTKQtTesting) endif() diff --git a/Libs/XNAT/Core/Testing/CMakeLists.txt b/Libs/XNAT/Core/Testing/CMakeLists.txt index 9f7c7d6521..90fa3ea938 100644 --- a/Libs/XNAT/Core/Testing/CMakeLists.txt +++ b/Libs/XNAT/Core/Testing/CMakeLists.txt @@ -12,17 +12,15 @@ set(KITTests_MOC_SRCS ctkXnatSessionTest.h ) -if(CTK_QT_VERSION VERSION_LESS "5") - QT4_WRAP_CPP(KITTests_MOC_CPP ${KITTests_MOC_SRCS}) -else() +if(CTK_QT_VERSION VERSION_EQUAL "5") qt5_wrap_cpp(KITTests_MOC_CPP ${KITTests_MOC_SRCS}) +else() + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() ctk_add_executable_utf8(${KIT}CppTests ${Tests} ${KITTests_SRCS} ${KITTests_MOC_SRCS} ${KITTests_MOC_CPP}) target_link_libraries(${KIT}CppTests ${LIBRARY_NAME} ${CTK_BASE_LIBRARIES}) -if(CTK_QT_VERSION VERSION_GREATER "4") - target_link_libraries(${KIT}CppTests Qt5::Test) -endif() +target_link_libraries(${KIT}CppTests Qt${CTK_QT_VERSION}::Test) SIMPLE_TEST(ctkXnatSessionTest) diff --git a/Libs/XNAT/Widgets/CMakeLists.txt b/Libs/XNAT/Widgets/CMakeLists.txt index 505f1d9958..919aa9c0bf 100644 --- a/Libs/XNAT/Widgets/CMakeLists.txt +++ b/Libs/XNAT/Widgets/CMakeLists.txt @@ -31,9 +31,7 @@ set(KIT_target_libraries) ctkFunctionGetTargetLibraries(KIT_target_libraries) -if(CTK_QT_VERSION VERSION_GREATER "4") - list(APPEND KIT_target_libraries Qt5::Widgets) -endif() +list(APPEND KIT_target_libraries Qt${CTK_QT_VERSION}::Widgets) ctkMacroBuildLib( NAME ${PROJECT_NAME} diff --git a/Plugins/org.commontk.configadmin/Testing/Cpp/CMakeLists.txt b/Plugins/org.commontk.configadmin/Testing/Cpp/CMakeLists.txt index fd47cead9b..e4187012cb 100644 --- a/Plugins/org.commontk.configadmin/Testing/Cpp/CMakeLists.txt +++ b/Plugins/org.commontk.configadmin/Testing/Cpp/CMakeLists.txt @@ -6,7 +6,7 @@ set(MOC_SRCS ) set(MY_MOC_CXX ) -#QT4_WRAP_CPP(MY_MOC_CXX ${MOC_SRCS}) +#QT5_WRAP_CPP(MY_MOC_CXX ${MOC_SRCS}) set(test_executable ${PROJECT_NAME}CppTests) diff --git a/Plugins/org.commontk.dah.core/CMakeLists.txt b/Plugins/org.commontk.dah.core/CMakeLists.txt index b2577ea4d0..17540dd081 100644 --- a/Plugins/org.commontk.dah.core/CMakeLists.txt +++ b/Plugins/org.commontk.dah.core/CMakeLists.txt @@ -47,9 +47,10 @@ set(PLUGIN_resources #Compute the plugin dependencies ctkFunctionGetTargetLibraries(PLUGIN_target_libraries) -if(CTK_QT_VERSION VERSION_GREATER "4") - list(APPEND PLUGIN_target_libraries Qt5::Network Qt5::Widgets) -endif() +list(APPEND PLUGIN_target_libraries + Qt${CTK_QT_VERSION}::Network + Qt${CTK_QT_VERSION}::Widgets + ) ctkMacroBuildPlugin( NAME ${PROJECT_NAME} diff --git a/Plugins/org.commontk.eventadmin/Testing/Cpp/CMakeLists.txt b/Plugins/org.commontk.eventadmin/Testing/Cpp/CMakeLists.txt index 51016bb159..c656a2a6b7 100644 --- a/Plugins/org.commontk.eventadmin/Testing/Cpp/CMakeLists.txt +++ b/Plugins/org.commontk.eventadmin/Testing/Cpp/CMakeLists.txt @@ -6,7 +6,7 @@ set(MOC_SRCS ) set(MY_MOC_CXX ) -#QT4_WRAP_CPP(MY_MOC_CXX ${MOC_SRCS}) +#QT5_WRAP_CPP(MY_MOC_CXX ${MOC_SRCS}) # Create a test for this EventAdmin implementation diff --git a/Plugins/org.commontk.eventbus/Testing/Cpp/CMakeLists.txt b/Plugins/org.commontk.eventbus/Testing/Cpp/CMakeLists.txt index 834c7f52c5..9baff30b5f 100644 --- a/Plugins/org.commontk.eventbus/Testing/Cpp/CMakeLists.txt +++ b/Plugins/org.commontk.eventbus/Testing/Cpp/CMakeLists.txt @@ -36,25 +36,24 @@ macro(ctkMacroInitProject test) if(NOT ${FILE_NAME} STREQUAL "main") ## Assign the moc custom filename set(MOC_FILE "${FILE_NAME}.moc") - if (CTK_QT_VERSION VERSION_GREATER "4") + if(CTK_QT_VERSION VERSION_EQUAL "5") QT5_GENERATE_MOC(${FILE_NAME_ABS} ${MOC_FILE}) else() - QT4_GENERATE_MOC(${FILE_NAME_ABS} ${MOC_FILE}) + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() list(APPEND MY_MOC_CXX "${CMAKE_CURRENT_BINARY_DIR}/${MOC_FILE}") endif() endforeach() else() ## Moc the library's .h files - if (CTK_QT_VERSION VERSION_GREATER "4") + if(CTK_QT_VERSION VERSION_EQUAL "5") QT5_WRAP_CPP(MY_MOC_CXX ${include_file_list}) QT5_WRAP_UI(MY_UI_CXX ${ui_file_list}) #QT5_ADD_RESOURCES(MY_RESOURCE_CXX ${resource_file_list}) else() - QT4_WRAP_CPP(MY_MOC_CXX ${include_file_list}) - QT4_WRAP_UI(MY_UI_CXX ${ui_file_list}) - #QT4_ADD_RESOURCES(MY_RESOURCE_CXX ${resource_file_list}) + message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() + endif() set(PROJECT_SRCS diff --git a/Plugins/org.commontk.metatype/Testing/Cpp/CMakeLists.txt b/Plugins/org.commontk.metatype/Testing/Cpp/CMakeLists.txt index a10c0ed229..debb809350 100644 --- a/Plugins/org.commontk.metatype/Testing/Cpp/CMakeLists.txt +++ b/Plugins/org.commontk.metatype/Testing/Cpp/CMakeLists.txt @@ -6,7 +6,7 @@ set(MOC_SRCS ) set(MY_MOC_CXX ) -#QT4_WRAP_CPP(MY_MOC_CXX ${MOC_SRCS}) +#QT5_WRAP_CPP(MY_MOC_CXX ${MOC_SRCS}) set(test_executable ${PROJECT_NAME}CppTests) From 319f0ba502a4270e9e9573e1bae557a53cd49951 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 19 Jul 2023 17:52:27 -0400 Subject: [PATCH 085/115] DOC: Update obsolete references from doc.trolltech.com to doc.qt.io --- Documentation/Doxyfile.txt.in | 10 +++++----- Libs/PluginFramework/ctkPluginActivator.h | 2 +- Libs/PluginFramework/ctkPluginConstants.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Documentation/Doxyfile.txt.in b/Documentation/Doxyfile.txt.in index 21a6881642..f46235df45 100644 --- a/Documentation/Doxyfile.txt.in +++ b/Documentation/Doxyfile.txt.in @@ -1137,25 +1137,25 @@ QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace +# https://doc.qt.io/qt-5/qthelpproject.html#namespace QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders +# https://doc.qt.io/qt-5/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to # add. For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters +# https://doc.qt.io/qt-5/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see -# +# # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = @@ -1163,7 +1163,7 @@ QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's # filter section matches. -# +# # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = diff --git a/Libs/PluginFramework/ctkPluginActivator.h b/Libs/PluginFramework/ctkPluginActivator.h index 58208e599a..5e42d1508a 100644 --- a/Libs/PluginFramework/ctkPluginActivator.h +++ b/Libs/PluginFramework/ctkPluginActivator.h @@ -60,7 +60,7 @@ * where mypluginlib is the basename of your shared plugin library. * *

- * See the Qt Documentation about + * See the Qt Documentation about * How to Create Qt Plugins for details. * * The class implementing the %ctkPluginActivator interface must have a public diff --git a/Libs/PluginFramework/ctkPluginConstants.h b/Libs/PluginFramework/ctkPluginConstants.h index 09d0526312..fa10337924 100644 --- a/Libs/PluginFramework/ctkPluginConstants.h +++ b/Libs/PluginFramework/ctkPluginConstants.h @@ -98,7 +98,7 @@ struct CTK_PLUGINFW_EXPORT ctkPluginConstants { /** * Specifies the hints on how symbols in dynamic shared objects (plug-ins) are * resolved. The value of this property must be of type - * QLibrary::LoadHints. + * QLibrary::LoadHints. * * Setting this property to QLibrary::ExportExternalSymbolsHint may * be necessary on some platforms (e.g. ELF platforms with gcc < 4.5) to get From 3023129fb69f3bb42b846e930af83c36bb84bd52 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 19 Jul 2023 17:58:35 -0400 Subject: [PATCH 086/115] DOC: Remove obsolete references to Q_EXPORT_PLUGIN2 specific to Qt4 --- Libs/PluginFramework/ctkPluginActivator.h | 7 ++----- Libs/Widgets/ctkIconEnginePlugin_qt5.h | 2 -- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/Libs/PluginFramework/ctkPluginActivator.h b/Libs/PluginFramework/ctkPluginActivator.h index 5e42d1508a..f2241ac222 100644 --- a/Libs/PluginFramework/ctkPluginActivator.h +++ b/Libs/PluginFramework/ctkPluginActivator.h @@ -47,17 +47,14 @@ * { * Q_OBJECT * Q_INTERFACES(ctkPluginActivator) + * Q_PLUGIN_METADATA(IID "org_commontk_myplugin") * * public: * void start(ctkPluginContext* context); * void stop(ctkPluginContext* context); * }; * \endcode - * And in your implementation file: - * \code - * Q_EXPORT_PLUGIN2(mypluginlib, MyPlugin) - * \endcode - * where mypluginlib is the basename of your shared plugin library. + * where myplugin is the name of your plugin. * *

* See the Qt Documentation about diff --git a/Libs/Widgets/ctkIconEnginePlugin_qt5.h b/Libs/Widgets/ctkIconEnginePlugin_qt5.h index 5fec1234c3..389d7a79a6 100644 --- a/Libs/Widgets/ctkIconEnginePlugin_qt5.h +++ b/Libs/Widgets/ctkIconEnginePlugin_qt5.h @@ -40,8 +40,6 @@ class ctkIconEnginePrivate; /// QCoreApplication::addLibraryPath("MyApp-build/plugins"); /// \endcode /// where the plugin must be located in "MyApp-build/plugins/iconengines" -/// don't forget to declare in the cpp file: -/// Q_EXPORT_PLUGIN2(yourpluginName, ctkIconEnginePlugin) class CTK_WIDGETS_EXPORT ctkIconEnginePlugin : public QIconEnginePlugin { From 4e6acd682a532ac8fd898617ff682a2aa570c0d7 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 19 Jul 2023 18:09:43 -0400 Subject: [PATCH 087/115] ENH: Update Log4Qt external project GitHub fork to support Qt5 This commit switches to using the maintained & updates "MEONMedical" fork instead of the commontk" one. --- CMakeExternals/Log4Qt.cmake | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeExternals/Log4Qt.cmake b/CMakeExternals/Log4Qt.cmake index a7436d4ef8..492d9646b7 100644 --- a/CMakeExternals/Log4Qt.cmake +++ b/CMakeExternals/Log4Qt.cmake @@ -24,7 +24,7 @@ endif() if(NOT DEFINED Log4Qt_DIR) - set(revision_tag 8d3558b0f636cbf8ff83) + set(revision_tag e2a65d5d0c626a33f9384f2a9227efee3035dbf9) if(${proj}_REVISION_TAG) set(revision_tag ${${proj}_REVISION_TAG}) endif() @@ -36,7 +36,7 @@ if(NOT DEFINED Log4Qt_DIR) set(location_args GIT_REPOSITORY ${${proj}_GIT_REPOSITORY} GIT_TAG ${revision_tag}) else() - set(location_args GIT_REPOSITORY "https://github.com/commontk/Log4Qt.git" + set(location_args GIT_REPOSITORY "https://github.com/MEONMedical/Log4Qt.git" GIT_TAG ${revision_tag}) endif() @@ -44,6 +44,7 @@ if(NOT DEFINED Log4Qt_DIR) if(CTK_QT_VERSION VERSION_EQUAL "5") list(APPEND ep_cache_args + -DQT_DIR:PATH=${Qt5_DIR} -DQt5_DIR:PATH=${Qt5_DIR} ) # XXX Backward compatible way @@ -54,6 +55,7 @@ if(NOT DEFINED Log4Qt_DIR) endif() elseif(CTK_QT_VERSION VERSION_EQUAL "6") list(APPEND ep_cache_args + -DQT_DIR:PATH=${Qt6_DIR} -DQt6_DIR:PATH=${Qt6_DIR} ) else() @@ -66,14 +68,14 @@ if(NOT DEFINED Log4Qt_DIR) BINARY_DIR ${proj}-build PREFIX ${proj}${ep_suffix} ${location_args} - INSTALL_COMMAND "" CMAKE_CACHE_ARGS ${ep_common_cache_args} ${ep_cache_args} DEPENDS ${${proj}_DEPENDENCIES} ) - set(Log4Qt_DIR ${CMAKE_BINARY_DIR}/${proj}-build) + set(Log4Qt_INSTALL_DIR ${ep_install_dir}) + set(Log4Qt_DIR ${Log4Qt_INSTALL_DIR}/lib/cmake/Log4Qt/) else() ExternalProject_Add_Empty(${proj} DEPENDS ${${proj}_DEPENDENCIES}) From 22a43f773e44aaa49c08fca1f42d04abeddc96b3 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 19 Jul 2023 18:12:31 -0400 Subject: [PATCH 088/115] BUG: Re-enable support for "org.commontk.log4qt" plugin with Qt5 This commit is a follow-up of d6f12b003 (Make more libs and apps compatible with Qt5.) where the plugin was originally removed from the set of plugins available when building against Qt5. --- CMakeLists.txt | 5 +---- Plugins/org.commontk.log4qt/ctkLog4QtPlugin.cpp | 4 ---- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bf2028cf95..358ada316d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -649,13 +649,10 @@ set(plugin_list org.commontk.configadmin org.commontk.eventadmin org.commontk.log + org.commontk.log4qt org.commontk.metatype ) -if(CTK_QT_VERSION VERSION_LESS "5") - list(APPEND plugin_list org.commontk.log4qt) -endif() - foreach(_plugin ${plugin_list}) ctk_plugin_option(${_plugin} "Build the ${_plugin} plugin." OFF) endforeach() diff --git a/Plugins/org.commontk.log4qt/ctkLog4QtPlugin.cpp b/Plugins/org.commontk.log4qt/ctkLog4QtPlugin.cpp index 86b2c8cdc0..e0cea90735 100644 --- a/Plugins/org.commontk.log4qt/ctkLog4QtPlugin.cpp +++ b/Plugins/org.commontk.log4qt/ctkLog4QtPlugin.cpp @@ -55,7 +55,3 @@ ctkPluginContext* ctkLog4QtPlugin::getPluginContext() const { return context; } - -Q_EXPORT_PLUGIN2(org_commontk_log4qt, ctkLog4QtPlugin) - - From 4f6262c47e6f45ab5ed5bf7a366a73b291f48a4f Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 19 Jul 2023 18:17:04 -0400 Subject: [PATCH 089/115] DOC: Add comment documenting why the "eventbus" plugin is disabled with Qt5 --- CMakeLists.txt | 6 ++++-- Plugins/org.commontk.eventbus/ctkEventBusPlugin.cpp | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 358ada316d..8d80d7a443 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -579,7 +579,8 @@ ctk_app_option(ctkExampleHostedApp "Build the DICOM example application" OFF CTK_ENABLE_DICOMApplicationHosting AND CTK_BUILD_EXAMPLES) -if(CTK_QT_VERSION VERSION_LESS "5") +if(FALSE) +# Since EventBusDemo depends on qmlrpc that is lacking Qt5 support, it is excluded. ctk_app_option(ctkEventBusDemo "Build the DICOM example application" OFF CTK_ENABLE_PluginFramework AND CTK_BUILD_EXAMPLES) @@ -683,7 +684,8 @@ ctk_plugin_option(org.commontk.dah.examplehost CTK_APP_ctkExampleHost) # Plug-ins related to the EventBus demo application -if(CTK_QT_VERSION VERSION_LESS "5") +if(FALSE) +# Since EventBusDemo depends on qmlrpc that is lacking Qt5 support, it is excluded. ctk_plugin_option(org.commontk.eventbus "Build the org.commontk.eventbus plugin." OFF CTK_APP_ctkEventBusDemo) diff --git a/Plugins/org.commontk.eventbus/ctkEventBusPlugin.cpp b/Plugins/org.commontk.eventbus/ctkEventBusPlugin.cpp index 15b8835e13..4f3a8c80c3 100644 --- a/Plugins/org.commontk.eventbus/ctkEventBusPlugin.cpp +++ b/Plugins/org.commontk.eventbus/ctkEventBusPlugin.cpp @@ -63,5 +63,3 @@ ctkPluginContext* ctkEventBusPlugin::getPluginContext() const { return context; } - -Q_EXPORT_PLUGIN2(org_commontk_eventbus, ctkEventBusPlugin) From 7e0f5561b9bc492ede581569ae6072e12946d262 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 19 Jul 2023 18:44:29 -0400 Subject: [PATCH 090/115] ENH: Re-enable support for building ctkQtTesting example app with Qt5 This commit is a follow-up of d6f12b003 (Make more libs and apps compatible with Qt5.) where the application was originally excluded. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d80d7a443..e2f42f0e3e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -621,7 +621,7 @@ ctk_app_option(ctkSimplePythonShell "Build the DICOM example application" OFF CTK_ENABLE_Python_Wrapping AND CTK_BUILD_EXAMPLES) -if(CTK_USE_QTTESTING AND CTK_QT_VERSION VERSION_LESS "5") +if(CTK_USE_QTTESTING) ctk_app_option(ctkQtTesting "Build the ctkQtTesting example application" OFF CTK_BUILD_EXAMPLES) From 541ca1976bf532db28b9a8c0a1aeb50cecb2f6d8 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 19 Jul 2023 18:37:07 -0400 Subject: [PATCH 091/115] DOC: Fix typos Typos in CMakeLists.txt (qmlrpc -> qxmlrpc) was introduced in 4f6262c4 (DOC: Add comment documenting why the "eventbus" plugin is disabled with Qt5) and identified while inspecting the file. Remaining of typos were identified and/or fixed using codespell using the following script: ``` python3 -m venv /tmp/codespell source /tmp/codespell-venv/bin/activate pip install codespell echo "comunication currentry fwe dependees invokable maked numer noe objekt ot requestor ser serie statics ta te to ue" > /tmp/.codespellignore codespell -I /tmp/.codespellignore -$(fd -e h -e hpp -e cpp -e txt -e dox -e cmake) codespell -I /tmp/.codespellignore -w -$(fd -e h -e hpp -e cpp -e txt -e dox -e cmake) ``` --- CMakeLists.txt | 4 ++-- Libs/CommandLineModules/Core/ctkCmdLineModuleParameter.h | 2 +- Libs/Core/ctkCallback.h | 2 +- Libs/Core/ctkErrorLogAbstractModel.h | 2 +- Libs/DICOM/Core/Testing/Cpp/ctkDICOMDatabaseTest4.cpp | 2 +- .../org.commontk.eventadmintest/ctkEAScenario1TestSuite.cpp | 6 +++--- Libs/Scripting/Python/Core/ctkAbstractPythonManager.cpp | 4 ++-- Libs/Scripting/Python/Core/ctkAbstractPythonManager.h | 4 ++-- Libs/Widgets/ctkComboBox.cpp | 2 +- Libs/Widgets/ctkConsole.cpp | 2 +- Libs/Widgets/ctkCoordinatesWidget.h | 2 +- Libs/Widgets/ctkDoubleSpinBox.h | 2 +- Libs/Widgets/ctkFlowLayout.h | 4 ++-- Libs/Widgets/ctkLayoutManager.h | 2 +- Libs/Widgets/ctkPathLineEdit.h | 2 +- Libs/XNAT/Core/ctkXnatDataModel.h | 2 +- Libs/XNAT/Core/ctkXnatSession.h | 2 +- 17 files changed, 23 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e2f42f0e3e..e98c20b37a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -580,7 +580,7 @@ ctk_app_option(ctkExampleHostedApp CTK_ENABLE_DICOMApplicationHosting AND CTK_BUILD_EXAMPLES) if(FALSE) -# Since EventBusDemo depends on qmlrpc that is lacking Qt5 support, it is excluded. +# Since EventBusDemo depends on qxmlrpc that is lacking Qt5 support, it is excluded. ctk_app_option(ctkEventBusDemo "Build the DICOM example application" OFF CTK_ENABLE_PluginFramework AND CTK_BUILD_EXAMPLES) @@ -685,7 +685,7 @@ ctk_plugin_option(org.commontk.dah.examplehost # Plug-ins related to the EventBus demo application if(FALSE) -# Since EventBusDemo depends on qmlrpc that is lacking Qt5 support, it is excluded. +# Since EventBusDemo depends on qxmlrpc that is lacking Qt5 support, it is excluded. ctk_plugin_option(org.commontk.eventbus "Build the org.commontk.eventbus plugin." OFF CTK_APP_ctkEventBusDemo) diff --git a/Libs/CommandLineModules/Core/ctkCmdLineModuleParameter.h b/Libs/CommandLineModules/Core/ctkCmdLineModuleParameter.h index 82e0720ad6..788917805a 100644 --- a/Libs/CommandLineModules/Core/ctkCmdLineModuleParameter.h +++ b/Libs/CommandLineModules/Core/ctkCmdLineModuleParameter.h @@ -209,7 +209,7 @@ class CTK_CMDLINEMODULECORE_EXPORT ctkCmdLineModuleParameter QStringList fileExtensions() const; /** - * @return The coordinate system (either "lps", "ras", oder "ijk") for the "point" or "region" + * @return The coordinate system (either "lps", "ras", or "ijk") for the "point" or "region" * parameter tags. */ QString coordinateSystem() const; diff --git a/Libs/Core/ctkCallback.h b/Libs/Core/ctkCallback.h index 7dd5a1be2b..5adb060ffc 100644 --- a/Libs/Core/ctkCallback.h +++ b/Libs/Core/ctkCallback.h @@ -29,7 +29,7 @@ //--------------------------------------------------------------------------- /// \ingroup Core -/// The following example prints debug statement everytime the current value +/// The following example prints debug statement every time the current value /// of the slider is changed: /// void print() { qDebug() << "signal called"; } /// ... diff --git a/Libs/Core/ctkErrorLogAbstractModel.h b/Libs/Core/ctkErrorLogAbstractModel.h index 734d91a8fa..2784707a4c 100644 --- a/Libs/Core/ctkErrorLogAbstractModel.h +++ b/Libs/Core/ctkErrorLogAbstractModel.h @@ -144,7 +144,7 @@ public Q_SLOTS: /// Call addEntry method via a connection (the same way as message handlers call it). /// It is recommended to use this method instead of addEntry to ensure messages are logged in correct order. - /// Directly calling addEntry would make that log entry processed immedately, getting ahead of entries that + /// Directly calling addEntry would make that log entry processed immediately, getting ahead of entries that /// message handlers add via a queued connection. void postEntry(const QDateTime& currentDateTime, const QString& threadId, ctkErrorLogLevel::LogLevel logLevel, const QString& origin, const ctkErrorLogContext& context, const QString& text); diff --git a/Libs/DICOM/Core/Testing/Cpp/ctkDICOMDatabaseTest4.cpp b/Libs/DICOM/Core/Testing/Cpp/ctkDICOMDatabaseTest4.cpp index 20e1ac3e00..a040d62cf7 100644 --- a/Libs/DICOM/Core/Testing/Cpp/ctkDICOMDatabaseTest4.cpp +++ b/Libs/DICOM/Core/Testing/Cpp/ctkDICOMDatabaseTest4.cpp @@ -138,7 +138,7 @@ int ctkDICOMDatabaseTest4( int argc, char * argv [] ) if (database.cachedTag(instanceUID, badTag) != QString("__TAG_NOT_IN_INSTANCE__")) { - std::cerr << "ctkDICOMDatabase: bad tag should have sentinal value in cache" << std::endl; + std::cerr << "ctkDICOMDatabase: bad tag should have sentinel value in cache" << std::endl; return EXIT_FAILURE; } diff --git a/Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario1TestSuite.cpp b/Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario1TestSuite.cpp index 82c7da04c7..b9fa190b61 100644 --- a/Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario1TestSuite.cpp +++ b/Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEAScenario1TestSuite.cpp @@ -136,7 +136,7 @@ void ctkEAScenario1EventConsumer::handleEvent(const ctkEvent& event) /* check if message is null */ if(!message.isNull()) { - /* its a syncronous message */ + /* its a synchronous message */ numOfsynchMessages++; /* print that a message is received */ qDebug() << "received a synchronous event with message:" << message; @@ -144,7 +144,7 @@ void ctkEAScenario1EventConsumer::handleEvent(const ctkEvent& event) int aquiredNumber= message.toInt(); /* assert that the message is the expected one */ QVERIFY2(synchMessageExpectedNumber == aquiredNumber, - qPrintable(QString("Expected syncronous message number: %1 got: %2 - order NOT conserved") + qPrintable(QString("Expected synchronous message number: %1 got: %2 - order NOT conserved") .arg(synchMessageExpectedNumber).arg(aquiredNumber))); /* the next messages of this type should be +1 */ @@ -161,7 +161,7 @@ void ctkEAScenario1EventConsumer::handleEvent(const ctkEvent& event) int aquiredNumber= message.toInt(); /* assert that the message is the expected one */ QVERIFY2(asynchMessageExpectedNumber==aquiredNumber, - qPrintable(QString("Expected asyncronous message number: %1 got: %2 - order NOT conserved") + qPrintable(QString("Expected asynchronous message number: %1 got: %2 - order NOT conserved") .arg(asynchMessageExpectedNumber).arg(aquiredNumber))); /* the next messages of this type should be +1 */ diff --git a/Libs/Scripting/Python/Core/ctkAbstractPythonManager.cpp b/Libs/Scripting/Python/Core/ctkAbstractPythonManager.cpp index c5b748bca9..f8bf24be93 100644 --- a/Libs/Scripting/Python/Core/ctkAbstractPythonManager.cpp +++ b/Libs/Scripting/Python/Core/ctkAbstractPythonManager.cpp @@ -123,8 +123,8 @@ bool ctkAbstractPythonManager::initialize() //----------------------------------------------------------------------------- PythonQtObjectPtr ctkAbstractPythonManager::mainContext() { - bool initalized = this->initialize(); - if (initalized) + bool initialized = this->initialize(); + if (initialized) { return PythonQt::self()->getMainModule(); } diff --git a/Libs/Scripting/Python/Core/ctkAbstractPythonManager.h b/Libs/Scripting/Python/Core/ctkAbstractPythonManager.h index 7c75081e9c..7ee963f3a4 100644 --- a/Libs/Scripting/Python/Core/ctkAbstractPythonManager.h +++ b/Libs/Scripting/Python/Core/ctkAbstractPythonManager.h @@ -118,7 +118,7 @@ class CTK_SCRIPTING_PYTHON_CORE_EXPORT ctkAbstractPythonManager : public QObject static QStringList dir_object(PyObject* object, bool appendParenthesis = false); - /// Given a python variable name, it returns the string list splited + /// Given a python variable name, it returns the string list split /// at every dots which will be outside parenthesis /// (It also takes care about the possibility that quotes can include parenthesis) static QStringList splitByDotOutsideParenthesis(const QString& pythonVariableName); @@ -143,7 +143,7 @@ class CTK_SCRIPTING_PYTHON_CORE_EXPORT ctkAbstractPythonManager : public QObject /// \sa pythonInitialized bool isPythonInitialized()const; - /// Returns True if a python error occured. + /// Returns True if a python error occurred. /// \sa PythonQt::hadError() bool pythonErrorOccured()const; diff --git a/Libs/Widgets/ctkComboBox.cpp b/Libs/Widgets/ctkComboBox.cpp index 21192f59c0..bcd00da3e7 100644 --- a/Libs/Widgets/ctkComboBox.cpp +++ b/Libs/Widgets/ctkComboBox.cpp @@ -167,7 +167,7 @@ void ctkComboBoxPrivate::initStyleOption(QStyleOptionComboBox* opt)const } QRect textRect = q->style()->subControlRect( QStyle::CC_ComboBox, opt, QStyle::SC_ComboBoxEditField, q); - // TODO substract icon size + // TODO subtract icon size opt->currentText = opt->fontMetrics.elidedText(opt->currentText, this->ElideMode, textRect.width()); diff --git a/Libs/Widgets/ctkConsole.cpp b/Libs/Widgets/ctkConsole.cpp index 1a303af84f..3fe88cfa93 100644 --- a/Libs/Widgets/ctkConsole.cpp +++ b/Libs/Widgets/ctkConsole.cpp @@ -1056,7 +1056,7 @@ void ctkConsolePrivate::pasteText(const QString& text) // // For example, an empty line in a Python function could not be executed line-by-line, because // then empty line would be interpreted as the end of the function. - // In contrast, the empty line would not cause any issue when execuing the whole string at once + // In contrast, the empty line would not cause any issue when executing the whole string at once // (the empty line would be just ignored). // // We cannot execute at once if a command is already being edited (some command has been already typed in the current line) diff --git a/Libs/Widgets/ctkCoordinatesWidget.h b/Libs/Widgets/ctkCoordinatesWidget.h index 179515014c..297e55cd00 100644 --- a/Libs/Widgets/ctkCoordinatesWidget.h +++ b/Libs/Widgets/ctkCoordinatesWidget.h @@ -32,7 +32,7 @@ class ctkCoordinatesWidgetPrivate; /// \ingroup Widgets /// /// ctkCoordinatesWidget is a simple container of dimension coordinates. -/// For each coordinate a double spinbox is associated, everytime a value is +/// For each coordinate a double spinbox is associated, every time a value is /// modified, the signal valueChanged is fired. /// TODO: use pimpl class CTK_WIDGETS_EXPORT ctkCoordinatesWidget : public QWidget diff --git a/Libs/Widgets/ctkDoubleSpinBox.h b/Libs/Widgets/ctkDoubleSpinBox.h index a0eb9707de..1f2e51f491 100644 --- a/Libs/Widgets/ctkDoubleSpinBox.h +++ b/Libs/Widgets/ctkDoubleSpinBox.h @@ -320,7 +320,7 @@ public Q_SLOTS: void setReadOnly(bool readOnly); Q_SIGNALS: - /// Emitted everytime the spinbox value is modified + /// Emitted every time the spinbox value is modified /// \sa QDoubleSpinBox::valueChanged() void valueChanged(double); void valueChanged(const QString &); diff --git a/Libs/Widgets/ctkFlowLayout.h b/Libs/Widgets/ctkFlowLayout.h index 81581a8a01..c65af2dae4 100644 --- a/Libs/Widgets/ctkFlowLayout.h +++ b/Libs/Widgets/ctkFlowLayout.h @@ -36,9 +36,9 @@ class ctkFlowLayoutPrivate; class CTK_WIDGETS_EXPORT ctkFlowLayout : public QLayout { Q_OBJECT - /// If orientation is Qt::Horizontal, items are layed out from left to right + /// If orientation is Qt::Horizontal, items are laid out from left to right /// then top to bottom if there is no more horizontal space. - /// If orientation is Qt::Vertical, items are layed out from top to bottom + /// If orientation is Qt::Vertical, items are laid out from top to bottom /// then left to right if there is no more vertical space. /// Qt::Horizontal by default /// \sa preferredExpandingDirections diff --git a/Libs/Widgets/ctkLayoutManager.h b/Libs/Widgets/ctkLayoutManager.h index 9066f00007..9e46340fb6 100644 --- a/Libs/Widgets/ctkLayoutManager.h +++ b/Libs/Widgets/ctkLayoutManager.h @@ -116,7 +116,7 @@ class CTK_WIDGETS_EXPORT ctkLayoutManager: public QObject /// Multiple viewports can be specified by adding a "viewports" XML element and adding multiple /// child "layout" elements. Viewport name is specified in the "name" attribute of each "layout" element. Q_INVOKABLE void setViewport(QWidget* widget, const QString& viewportName); - /// Get viewport widget by nam. + /// Get viewport widget by name. Q_INVOKABLE QWidget* viewport(const QString& viewportName)const; /// Get all viewport names. QStringList viewportNames()const; diff --git a/Libs/Widgets/ctkPathLineEdit.h b/Libs/Widgets/ctkPathLineEdit.h index 1961c9024f..e51d1d5c47 100644 --- a/Libs/Widgets/ctkPathLineEdit.h +++ b/Libs/Widgets/ctkPathLineEdit.h @@ -229,7 +229,7 @@ class CTK_WIDGETS_EXPORT ctkPathLineEdit: public QWidget void setSizeAdjustPolicy(SizeAdjustPolicy policy); int minimumContentsLength()const; - void setMinimumContentsLength(int lenght); + void setMinimumContentsLength(int length); /// Return the combo box internally used by the path line edit Q_INVOKABLE QComboBox* comboBox() const; diff --git a/Libs/XNAT/Core/ctkXnatDataModel.h b/Libs/XNAT/Core/ctkXnatDataModel.h index d90eaa47ad..017a472613 100644 --- a/Libs/XNAT/Core/ctkXnatDataModel.h +++ b/Libs/XNAT/Core/ctkXnatDataModel.h @@ -33,7 +33,7 @@ class ctkXnatSession; /** * @ingroup XNAT_Core * - * @brief The ctkXnatDataModel class reprents the root object in a + * @brief The ctkXnatDataModel class represents the root object in a * XNAT data hierarchy. */ class CTK_XNAT_CORE_EXPORT ctkXnatDataModel : public ctkXnatObject diff --git a/Libs/XNAT/Core/ctkXnatSession.h b/Libs/XNAT/Core/ctkXnatSession.h index b686166173..deda63839a 100644 --- a/Libs/XNAT/Core/ctkXnatSession.h +++ b/Libs/XNAT/Core/ctkXnatSession.h @@ -45,7 +45,7 @@ class ctkXnatResource; /** * @ingroup XNAT_Core * - * @brief The ctkXnatSession class reprents a session object associated + * @brief The ctkXnatSession class represents a session object associated * with a specific XNAT connection. */ class CTK_XNAT_CORE_EXPORT ctkXnatSession : public QObject From 911d9a3d8848d63d3fc947dcad72ec7c65382964 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 19 Jul 2023 19:47:08 -0400 Subject: [PATCH 092/115] STYLE: Remove obsolete CTK_NULLPTR macro not needed with C++ >= 11 This commit replaces occurrences of the CTK_NULLPTR macro with nullptr. This one-liner was used to perform the update: git grep -l "CTK_NULLPTR" | fgrep -v CMakeLists.txt | fgrep -v .cmake | xargs sed -i '' -e "s/CTK_NULLPTR/nullptr/g" Adapted from Slicer/Slicer@015d346b9 (STYLE: Replace ITK_NULLPTR with nullptr) --- Libs/Core/ctkCompilerDetections_p.h | 5 ----- Libs/Core/ctkErrorLogAbstractModel.cpp | 2 +- Libs/DICOM/Core/ctkDICOMDatabase.cpp | 2 +- Libs/DICOM/Core/ctkDICOMDatabase.h | 4 ++-- .../Core/ctkDICOMDisplayedFieldGenerator.cpp | 2 +- ...ICOMDisplayedFieldGeneratorRuleFactory.cpp | 4 ++-- ...kDICOMDisplayedFieldGeneratorRuleFactory.h | 2 +- Libs/DICOM/Core/ctkDICOMIndexer.cpp | 4 ++-- .../Widgets/ctkDICOMQueryRetrieveWidget.cpp | 2 +- Libs/DICOM/Widgets/ctkDICOMTableView.cpp | 2 +- .../VTK/Core/ctkVTKScalarsToColorsUtils.cpp | 8 +++---- .../vtkDiscretizableColorTransferChart.cpp | 18 +++++++-------- .../Core/vtkScalarsToColorsContextItem.cpp | 2 +- .../Core/vtkScalarsToColorsPreviewChart.cpp | 2 +- .../ctkVTKScalarsToColorsComboBoxTest1.cpp | 2 +- ...ctkVTKDiscretizableColorTransferWidget.cpp | 22 +++++++++---------- .../ctkVTKDiscretizableColorTransferWidget.h | 2 +- .../Widgets/ctkVTKScalarsToColorsComboBox.cpp | 8 +++---- 18 files changed, 44 insertions(+), 49 deletions(-) diff --git a/Libs/Core/ctkCompilerDetections_p.h b/Libs/Core/ctkCompilerDetections_p.h index 7b03ab427b..94947d3519 100644 --- a/Libs/Core/ctkCompilerDetections_p.h +++ b/Libs/Core/ctkCompilerDetections_p.h @@ -32,11 +32,6 @@ /* * C++11 keywords and expressions */ -#ifdef Q_NULLPTR -# define CTK_NULLPTR Q_NULLPTR -#else -# define CTK_NULLPTR NULL -#endif #if (__cplusplus >= 201103L) || ( defined(_MSC_VER) && _MSC_VER >= 1700 ) # define CTK_OVERRIDE override diff --git a/Libs/Core/ctkErrorLogAbstractModel.cpp b/Libs/Core/ctkErrorLogAbstractModel.cpp index 11e904b423..077daef177 100644 --- a/Libs/Core/ctkErrorLogAbstractModel.cpp +++ b/Libs/Core/ctkErrorLogAbstractModel.cpp @@ -588,7 +588,7 @@ ctkErrorLogAbstractMessageHandler* ctkErrorLogAbstractModel::msgHandler(const QS Q_D(const ctkErrorLogAbstractModel); if (!d->RegisteredHandlers.keys().contains(handlerName)) { - return CTK_NULLPTR; + return nullptr; } return d->RegisteredHandlers[handlerName]; } diff --git a/Libs/DICOM/Core/ctkDICOMDatabase.cpp b/Libs/DICOM/Core/ctkDICOMDatabase.cpp index fb5d405096..ee0300b80b 100644 --- a/Libs/DICOM/Core/ctkDICOMDatabase.cpp +++ b/Libs/DICOM/Core/ctkDICOMDatabase.cpp @@ -78,7 +78,7 @@ ctkDICOMDatabasePrivate::ctkDICOMDatabasePrivate(ctkDICOMDatabase& o) , LoggedExecVerbose(false) , DisplayedFieldsTableAvailable(false) , UseShortStoragePath(true) - , ThumbnailGenerator(CTK_NULLPTR) + , ThumbnailGenerator(nullptr) , TagCacheVerified(false) , SchemaVersion("0.7.0") { diff --git a/Libs/DICOM/Core/ctkDICOMDatabase.h b/Libs/DICOM/Core/ctkDICOMDatabase.h index 491f6fe316..98ce3aa369 100644 --- a/Libs/DICOM/Core/ctkDICOMDatabase.h +++ b/Libs/DICOM/Core/ctkDICOMDatabase.h @@ -136,7 +136,7 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMDatabase : public QObject /// \return true if schema was updated Q_INVOKABLE bool updateSchema( const char* schemaFile = ctkDICOMDatabase::defaultSchemaFile(), - const char* newDatabaseDir = CTK_NULLPTR); + const char* newDatabaseDir = nullptr); /// Update the database schema only if the versions don't match /// \param schemaFile SQL file containing schema definition @@ -147,7 +147,7 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMDatabase : public QObject /// \return true if schema was updated Q_INVOKABLE bool updateSchemaIfNeeded( const char* schemaFile = ctkDICOMDatabase::defaultSchemaFile(), - const char* newDatabaseDir = CTK_NULLPTR); + const char* newDatabaseDir = nullptr); /// Return the schema version needed by the current version of this code Q_INVOKABLE QString schemaVersion(); diff --git a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGenerator.cpp b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGenerator.cpp index ff1b6710a0..8d94fd7a79 100644 --- a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGenerator.cpp +++ b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGenerator.cpp @@ -40,7 +40,7 @@ static ctkLogger logger("org.commontk.dicom.DICOMDisplayedFieldGenerator" ); //------------------------------------------------------------------------------ ctkDICOMDisplayedFieldGeneratorPrivate::ctkDICOMDisplayedFieldGeneratorPrivate(ctkDICOMDisplayedFieldGenerator& o) : q_ptr(&o) - , Database(CTK_NULLPTR) + , Database(nullptr) { } diff --git a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.cpp b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.cpp index 490a311e0f..9adb34dab4 100644 --- a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.cpp +++ b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.cpp @@ -34,7 +34,7 @@ #include //---------------------------------------------------------------------------- -ctkDICOMDisplayedFieldGeneratorRuleFactory *ctkDICOMDisplayedFieldGeneratorRuleFactory::Instance = CTK_NULLPTR; +ctkDICOMDisplayedFieldGeneratorRuleFactory *ctkDICOMDisplayedFieldGeneratorRuleFactory::Instance = nullptr; //---------------------------------------------------------------------------- class ctkDICOMDisplayedFieldGeneratorRuleFactoryCleanup @@ -88,7 +88,7 @@ void ctkDICOMDisplayedFieldGeneratorRuleFactory::cleanup() if (ctkDICOMDisplayedFieldGeneratorRuleFactory::Instance) { delete ctkDICOMDisplayedFieldGeneratorRuleFactory::Instance; - ctkDICOMDisplayedFieldGeneratorRuleFactory::Instance = CTK_NULLPTR; + ctkDICOMDisplayedFieldGeneratorRuleFactory::Instance = nullptr; } } diff --git a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.h b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.h index 3472fe71d4..e20f6ecdf8 100644 --- a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.h +++ b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.h @@ -69,7 +69,7 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMDisplayedFieldGeneratorRuleFactory : public static void cleanup(); private: - ctkDICOMDisplayedFieldGeneratorRuleFactory(QObject* parent=CTK_NULLPTR); + ctkDICOMDisplayedFieldGeneratorRuleFactory(QObject* parent=nullptr); ~ctkDICOMDisplayedFieldGeneratorRuleFactory() CTK_OVERRIDE; Q_DISABLE_COPY(ctkDICOMDisplayedFieldGeneratorRuleFactory); diff --git a/Libs/DICOM/Core/ctkDICOMIndexer.cpp b/Libs/DICOM/Core/ctkDICOMIndexer.cpp index 9d255c0273..6581fb9072 100644 --- a/Libs/DICOM/Core/ctkDICOMIndexer.cpp +++ b/Libs/DICOM/Core/ctkDICOMIndexer.cpp @@ -290,7 +290,7 @@ void ctkDICOMIndexerPrivateWorker::writeIndexingResultsToDatabase(ctkDICOMDataba //------------------------------------------------------------------------------ ctkDICOMIndexerPrivate::ctkDICOMIndexerPrivate(ctkDICOMIndexer& o) : q_ptr(&o) - , Database(CTK_NULLPTR) + , Database(nullptr) , BackgroundImportEnabled(false) , FollowSymlinks(true) { @@ -317,7 +317,7 @@ ctkDICOMIndexerPrivate::~ctkDICOMIndexerPrivate() this->RequestQueue.setStopRequested(true); this->WorkerThread.quit(); this->WorkerThread.wait(); - q->setDatabase(CTK_NULLPTR); + q->setDatabase(nullptr); } //------------------------------------------------------------------------------ diff --git a/Libs/DICOM/Widgets/ctkDICOMQueryRetrieveWidget.cpp b/Libs/DICOM/Widgets/ctkDICOMQueryRetrieveWidget.cpp index 7cdcd586e4..1329530557 100644 --- a/Libs/DICOM/Widgets/ctkDICOMQueryRetrieveWidget.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMQueryRetrieveWidget.cpp @@ -375,7 +375,7 @@ void ctkDICOMQueryRetrieveWidget::retrieve() // Get information which server we want to get the study from and prepare request accordingly QMap::iterator queryIt = d->QueriesByStudyUID.find(studyUID); - ctkDICOMQuery* query = (queryIt == d->QueriesByStudyUID.end() ? CTK_NULLPTR : *queryIt); + ctkDICOMQuery* query = (queryIt == d->QueriesByStudyUID.end() ? nullptr : *queryIt); if (!query) { logger.warn("Retrieve of series " + seriesUID + " failed. No query found for study " + studyUID + "."); diff --git a/Libs/DICOM/Widgets/ctkDICOMTableView.cpp b/Libs/DICOM/Widgets/ctkDICOMTableView.cpp index 739984b85f..0612d51f3b 100644 --- a/Libs/DICOM/Widgets/ctkDICOMTableView.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMTableView.cpp @@ -634,7 +634,7 @@ bool ctkDICOMTableView::eventFilter(QObject *obj, QEvent *event) { QKeyEvent* keyEvent = static_cast(event); QAbstractItemModel* itemModel = d->tblDicomDatabaseView->model(); - if (keyEvent != CTK_NULLPTR && itemModel->rowCount() > 0) + if (keyEvent != nullptr && itemModel->rowCount() > 0) { if (keyEvent->key() == Qt::Key_Home) { diff --git a/Libs/Visualization/VTK/Core/ctkVTKScalarsToColorsUtils.cpp b/Libs/Visualization/VTK/Core/ctkVTKScalarsToColorsUtils.cpp index 7915ad360c..66a2cdd224 100644 --- a/Libs/Visualization/VTK/Core/ctkVTKScalarsToColorsUtils.cpp +++ b/Libs/Visualization/VTK/Core/ctkVTKScalarsToColorsUtils.cpp @@ -55,7 +55,7 @@ void ctk::remapColorScale( } /// Opacity - if (rescaledColorTransferFunction->GetScalarOpacityFunction() != CTK_NULLPTR) + if (rescaledColorTransferFunction->GetScalarOpacityFunction() != nullptr) { rescaledColorTransferFunction->GetScalarOpacityFunction()-> RemoveAllPoints(); @@ -67,7 +67,7 @@ void ctk::remapColorScale( rescaledColorTransferFunction->SetScalarOpacityFunction(opacityFunction); } - if (colorTransferFunction->GetScalarOpacityFunction() == CTK_NULLPTR) + if (colorTransferFunction->GetScalarOpacityFunction() == nullptr) { rescaledColorTransferFunction->Build(); return; @@ -101,7 +101,7 @@ void ctk::remapColorScale( // ---------------------------------------------------------------------------- void ctk::reverseColorMap(vtkDiscretizableColorTransferFunction* ctf) { - if (ctf == CTK_NULLPTR) + if (ctf == nullptr) { return; } @@ -127,7 +127,7 @@ void ctk::reverseColorMap(vtkDiscretizableColorTransferFunction* ctf) void ctk::setTransparency(vtkDiscretizableColorTransferFunction* ctf, double transparency) { - if (ctf == CTK_NULLPTR) + if (ctf == nullptr) { return; } diff --git a/Libs/Visualization/VTK/Core/vtkDiscretizableColorTransferChart.cpp b/Libs/Visualization/VTK/Core/vtkDiscretizableColorTransferChart.cpp index 7fe3c64c1c..bb1c6af62c 100644 --- a/Libs/Visualization/VTK/Core/vtkDiscretizableColorTransferChart.cpp +++ b/Libs/Visualization/VTK/Core/vtkDiscretizableColorTransferChart.cpp @@ -138,8 +138,8 @@ vtkDiscretizableColorTransferChart::vtkDiscretizableColorTransferChart() this->SetActionToButton(ZOOM, -1);/// We don't want to zoom this->SetActionToButton(PAN, -1);/// Axes are not forced to bounds, disable panning - this->CompositeHiddenItem = CTK_NULLPTR; - this->ControlPoints = CTK_NULLPTR; + this->CompositeHiddenItem = nullptr; + this->ControlPoints = nullptr; this->rangeMoving = RangeMoving_NONE; @@ -165,7 +165,7 @@ void vtkDiscretizableColorTransferChart::SetColorTransferFunction( vtkDiscretizableColorTransferFunction* function) { double range[2] = { VTK_DOUBLE_MAX, VTK_DOUBLE_MIN }; - if (function != CTK_NULLPTR) + if (function != nullptr) { range[0] = function->GetRange()[0]; range[1] = function->GetRange()[1]; @@ -191,10 +191,10 @@ void vtkDiscretizableColorTransferChart::SetColorTransferFunction( << " " << this->CurrentRange[1]; #endif - if (function == CTK_NULLPTR) + if (function == nullptr) { - this->CompositeHiddenItem = CTK_NULLPTR; - this->ControlPoints = CTK_NULLPTR; + this->CompositeHiddenItem = nullptr; + this->ControlPoints = nullptr; #ifdef DEBUG_RANGE qDebug() << "DEBUG_RANGE data range = " << this->DataRange[0] @@ -478,8 +478,8 @@ void vtkDiscretizableColorTransferChart::SetCurrentRange( // ---------------------------------------------------------------------------- void vtkDiscretizableColorTransferChart::RemapColorTransferFunction() { - if (this->ColorTransferFunction == CTK_NULLPTR - || this->ControlPoints == CTK_NULLPTR) + if (this->ColorTransferFunction == nullptr + || this->ControlPoints == nullptr) { return; } @@ -583,7 +583,7 @@ vtkDiscretizableColorTransferChart::GetControlPointsItem() // ---------------------------------------------------------------------------- bool vtkDiscretizableColorTransferChart::IsProcessingColorTransferFunction() const { - if (this->ControlPoints == CTK_NULLPTR) + if (this->ControlPoints == nullptr) { return false; } diff --git a/Libs/Visualization/VTK/Core/vtkScalarsToColorsContextItem.cpp b/Libs/Visualization/VTK/Core/vtkScalarsToColorsContextItem.cpp index e26cb7b229..26526b35fe 100644 --- a/Libs/Visualization/VTK/Core/vtkScalarsToColorsContextItem.cpp +++ b/Libs/Visualization/VTK/Core/vtkScalarsToColorsContextItem.cpp @@ -127,7 +127,7 @@ void vtkScalarsToColorsContextItem::CopyColorTransferFunction( { this->ResetColorTransferFunction(); - if (ctf == CTK_NULLPTR) + if (ctf == nullptr) { this->SetVisibleRange(0, 255); diff --git a/Libs/Visualization/VTK/Core/vtkScalarsToColorsPreviewChart.cpp b/Libs/Visualization/VTK/Core/vtkScalarsToColorsPreviewChart.cpp index e33f11d0b4..6cc6cf9c59 100644 --- a/Libs/Visualization/VTK/Core/vtkScalarsToColorsPreviewChart.cpp +++ b/Libs/Visualization/VTK/Core/vtkScalarsToColorsPreviewChart.cpp @@ -70,7 +70,7 @@ void vtkScalarsToColorsPreviewChart::SetColorTransferFunction( compositeVisibleItem->SetInteractive(false); compositeVisibleItem->SetOpacity(1); compositeVisibleItem->SelectableOff(); - if (function == CTK_NULLPTR) + if (function == nullptr) { vtkSmartPointer ctf = vtkSmartPointer::New(); diff --git a/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKScalarsToColorsComboBoxTest1.cpp b/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKScalarsToColorsComboBoxTest1.cpp index c9d860804d..1dfb71894f 100644 --- a/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKScalarsToColorsComboBoxTest1.cpp +++ b/Libs/Visualization/VTK/Widgets/Testing/Cpp/ctkVTKScalarsToColorsComboBoxTest1.cpp @@ -66,7 +66,7 @@ int ctkVTKScalarsToColorsComboBoxTest1(int argc, char * argv [] ) "\tCurrent count: " << scalarsToColorsComboBox.count() << "\n"; return EXIT_FAILURE; } - scalarsToColorsComboBox.addScalarsToColors(CTK_NULLPTR, "(none)"); + scalarsToColorsComboBox.addScalarsToColors(nullptr, "(none)"); scalarsToColorsComboBox.show(); diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKDiscretizableColorTransferWidget.cpp b/Libs/Visualization/VTK/Widgets/ctkVTKDiscretizableColorTransferWidget.cpp index e6796efd69..3071b2f035 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKDiscretizableColorTransferWidget.cpp +++ b/Libs/Visualization/VTK/Widgets/ctkVTKDiscretizableColorTransferWidget.cpp @@ -125,12 +125,12 @@ ::ctkVTKDiscretizableColorTransferWidgetPrivate( ctkVTKDiscretizableColorTransferWidget& object) : q_ptr(&object) { - this->scalarsToColorsSelector = CTK_NULLPTR; + this->scalarsToColorsSelector = nullptr; // Option menu - this->nanButton = CTK_NULLPTR; - this->discretizeCheckBox = CTK_NULLPTR; - this->nbOfDiscreteValuesSpinBox = CTK_NULLPTR; + this->nanButton = nullptr; + this->discretizeCheckBox = nullptr; + this->nbOfDiscreteValuesSpinBox = nullptr; this->dataRange[0] = VTK_DOUBLE_MAX; this->dataRange[1] = VTK_DOUBLE_MIN; @@ -191,7 +191,7 @@ void ctkVTKDiscretizableColorTransferWidgetPrivate::setupUi(QWidget* widget) this->previousOpacityValue = opacitySlider->value(); - this->scalarsToColorsSelector->addScalarsToColors(CTK_NULLPTR, ctkVTKDiscretizableColorTransferWidget::tr("Reset")); + this->scalarsToColorsSelector->addScalarsToColors(nullptr, ctkVTKDiscretizableColorTransferWidget::tr("Reset")); this->scalarsToColorsSelector->setCurrentIndex(-1); this->eventLink = vtkSmartPointer::New(); @@ -237,7 +237,7 @@ void ctkVTKDiscretizableColorTransferWidgetPrivate::setupUi(QWidget* widget) discretizeLayout->setContentsMargins(0, 0, 0, 0); optionButton->setIcon(q->style()->standardIcon( - QStyle::SP_FileDialogDetailedView, CTK_NULLPTR, optionButton)); + QStyle::SP_FileDialogDetailedView, nullptr, optionButton)); QLabel* nanLabel = new QLabel(ctkVTKDiscretizableColorTransferWidget::tr("NaN values")); this->nanButton = new ctkColorPickerButton; @@ -346,7 +346,7 @@ ctkVTKDiscretizableColorTransferWidgetPrivate::colorTransferFunctionModifiedCall vtkSmartPointer dctf = self->scalarsToColorsContextItem->GetDiscretizableColorTransferFunction(); - if (dctf == CTK_NULLPTR) + if (dctf == nullptr) { return; } @@ -480,7 +480,7 @@ void ctkVTKDiscretizableColorTransferWidget::setHistogramConnection( if (!input) { - d->histogramFilter = CTK_NULLPTR; + d->histogramFilter = nullptr; d->dataMean = 0.; return; } @@ -594,7 +594,7 @@ void ctkVTKDiscretizableColorTransferWidget::updateCtfWidgets() { Q_D(ctkVTKDiscretizableColorTransferWidget); - if (this->discretizableColorTransferFunction() == CTK_NULLPTR) + if (this->discretizableColorTransferFunction() == nullptr) { this->disableCtfWidgets(); } @@ -686,8 +686,8 @@ void ctkVTKDiscretizableColorTransferWidget::updateHistogram() // fill bins and frequencies - if (d->histogramFilter == CTK_NULLPTR - || d->histogramFilter->GetInputConnection(0, 0) == CTK_NULLPTR) + if (d->histogramFilter == nullptr + || d->histogramFilter->GetInputConnection(0, 0) == nullptr) { bins->SetNumberOfTuples(1); bins->SetTuple1(0, 0); diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKDiscretizableColorTransferWidget.h b/Libs/Visualization/VTK/Widgets/ctkVTKDiscretizableColorTransferWidget.h index 63c309b287..b15823277c 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKDiscretizableColorTransferWidget.h +++ b/Libs/Visualization/VTK/Widgets/ctkVTKDiscretizableColorTransferWidget.h @@ -49,7 +49,7 @@ class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKDiscretizableColorTransferWidge /// \accessors viewBackgroundColor() setViewBackgroundColor() Q_PROPERTY(QColor viewBackgroundColor READ viewBackgroundColor WRITE setViewBackgroundColor) public: - explicit ctkVTKDiscretizableColorTransferWidget(QWidget* parent_ = CTK_NULLPTR); + explicit ctkVTKDiscretizableColorTransferWidget(QWidget* parent_ = nullptr); virtual ~ctkVTKDiscretizableColorTransferWidget(); enum ResetVisibleRange diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKScalarsToColorsComboBox.cpp b/Libs/Visualization/VTK/Widgets/ctkVTKScalarsToColorsComboBox.cpp index 74f0fbb03d..f25636b84e 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKScalarsToColorsComboBox.cpp +++ b/Libs/Visualization/VTK/Widgets/ctkVTKScalarsToColorsComboBox.cpp @@ -93,9 +93,9 @@ int ctkVTKScalarsToColorsComboBox::addScalarsToColors( vtkScalarsToColors* scFunction, const QString& name) { QImage img; - if (scFunction != CTK_NULLPTR) + if (scFunction != nullptr) { - scFunction->Register(CTK_NULLPTR); + scFunction->Register(nullptr); img = ctk::scalarsToColorsImage(scFunction, this->iconSize()); } else @@ -116,7 +116,7 @@ vtkScalarsToColors* ctkVTKScalarsToColorsComboBox::getScalarsToColors( QVariant data = itemData(index); if (!data.isValid()) { - return CTK_NULLPTR; + return nullptr; } vtkScalarsToColors* ctf = @@ -167,7 +167,7 @@ void ctkVTKScalarsToColorsComboBox::onRowsAboutToBeRemoved( for (int i = first; i <= last; ++i) { vtkScalarsToColors* scFunction = this->getScalarsToColors(i); - if (scFunction != CTK_NULLPTR) + if (scFunction != nullptr) { scFunction->Delete(); } From b9e250d98d8b26d230a6ea245fc89caddabd1965 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 19 Jul 2023 20:04:11 -0400 Subject: [PATCH 093/115] STYLE: Remove obsolete CTK_OVERRIDE macro not needed with C++ >= 11 This commit replaces occurrences of the CTK_OVERRIDE macro with override. This one-liner was used to perform the update: git grep -l "CTK_OVERRIDE" | fgrep -v CMakeLists.txt | fgrep -v .cmake | xargs sed -i '' -e "s/CTK_OVERRIDE/override/g" Adapted from Slicer/Slier@c33381e85 (STYLE: Replace ITK_OVERRIDE with override) --- Libs/Core/ctkCompilerDetections_p.h | 10 ---------- .../ctkDICOMDisplayedFieldGeneratorDefaultRule.h | 12 ++++++------ ...tkDICOMDisplayedFieldGeneratorLastStudyDateRule.h | 12 ++++++------ ...splayedFieldGeneratorPatientNumberOfStudiesRule.h | 12 ++++++------ ...FieldGeneratorRadiotherapySeriesDescriptionRule.h | 12 ++++++------ .../ctkDICOMDisplayedFieldGeneratorRuleFactory.h | 2 +- ...ICOMDisplayedFieldGeneratorSeriesImageCountRule.h | 12 ++++++------ ...MDisplayedFieldGeneratorStudyNumberOfSeriesRule.h | 12 ++++++------ Libs/Scripting/Python/Widgets/ctkPythonConsole.h | 4 ++-- Libs/Widgets/ctkCheckablePushButton.h | 8 ++++---- Libs/Widgets/ctkPathLineEdit.cpp | 2 +- 11 files changed, 44 insertions(+), 54 deletions(-) diff --git a/Libs/Core/ctkCompilerDetections_p.h b/Libs/Core/ctkCompilerDetections_p.h index 94947d3519..9b1cf34a87 100644 --- a/Libs/Core/ctkCompilerDetections_p.h +++ b/Libs/Core/ctkCompilerDetections_p.h @@ -29,14 +29,4 @@ // We mean it. // -/* - * C++11 keywords and expressions - */ - -#if (__cplusplus >= 201103L) || ( defined(_MSC_VER) && _MSC_VER >= 1700 ) -# define CTK_OVERRIDE override -#else -# define CTK_OVERRIDE -#endif - #endif diff --git a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorDefaultRule.h b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorDefaultRule.h index 85dbe4795a..13596f579c 100644 --- a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorDefaultRule.h +++ b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorDefaultRule.h @@ -35,31 +35,31 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMDisplayedFieldGeneratorDefaultRule : public { public: /// Get name of rule - QString name()const CTK_OVERRIDE; + QString name()const override; /// Clone displayed field generator rule. Override to return a new instance of the rule sub-class - ctkDICOMDisplayedFieldGeneratorAbstractRule* clone() CTK_OVERRIDE; + ctkDICOMDisplayedFieldGeneratorAbstractRule* clone() override; /// Specify list of DICOM tags required by the rule. These tags will be included in the tag cache - QStringList getRequiredDICOMTags() CTK_OVERRIDE; + QStringList getRequiredDICOMTags() override; /// Register placeholder strings that still mean that a given field can be considered empty. /// Used when merging the original database content with the displayed fields generated by the rules. /// Example: SeriesDescription -> Unnamed Series - void registerEmptyFieldNames(QMap emptyFieldsSeries, QMap emptyFieldstudies, QMap emptyFieldsPatients) CTK_OVERRIDE; + void registerEmptyFieldNames(QMap emptyFieldsSeries, QMap emptyFieldstudies, QMap emptyFieldsPatients) override; /// Generate displayed fields for a certain instance based on its cached tags /// The way these generated fields will be used is defined by \sa mergeDisplayedFieldsForInstance void getDisplayedFieldsForInstance( const QMap &cachedTagsForInstance, QMap &displayedFieldsForCurrentSeries, - QMap &displayedFieldsForCurrentStudy, QMap &displayedFieldsForCurrentPatient ) CTK_OVERRIDE; + QMap &displayedFieldsForCurrentStudy, QMap &displayedFieldsForCurrentPatient ) override; /// Define rules of merging initial database values with new values generated by the rule plugins void mergeDisplayedFieldsForInstance( const QMap &initialFieldsSeries, const QMap &initialFieldsStudy, const QMap &initialFieldsPatient, const QMap &newFieldsSeries, const QMap &newFieldsStudy, const QMap &newFieldsPatient, QMap &mergedFieldsSeries, QMap &mergedFieldsStudy, QMap &mergedFieldsPatient, - const QMap &emptyFieldsSeries, const QMap &emptyFieldsStudy, const QMap &emptyFieldsPatient ) CTK_OVERRIDE; + const QMap &emptyFieldsSeries, const QMap &emptyFieldsStudy, const QMap &emptyFieldsPatient ) override; protected: QString humanReadablePatientName(QString dicomPatientName); diff --git a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorLastStudyDateRule.h b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorLastStudyDateRule.h index 6bf837f4a0..ad38e6b57a 100644 --- a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorLastStudyDateRule.h +++ b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorLastStudyDateRule.h @@ -37,29 +37,29 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMDisplayedFieldGeneratorLastStudyDateRule : p explicit ctkDICOMDisplayedFieldGeneratorLastStudyDateRule(); /// Get name of rule - QString name()const CTK_OVERRIDE; + QString name()const override; /// Clone displayed field generator rule. Override to return a new instance of the rule sub-class - ctkDICOMDisplayedFieldGeneratorAbstractRule* clone() CTK_OVERRIDE; + ctkDICOMDisplayedFieldGeneratorAbstractRule* clone() override; /// Specify list of DICOM tags required by the rule. These tags will be included in the tag cache - QStringList getRequiredDICOMTags() CTK_OVERRIDE; + QStringList getRequiredDICOMTags() override; /// Generate displayed fields for a certain instance based on its cached tags /// The way these generated fields will be used is defined by \sa mergeDisplayedFieldsForInstance void getDisplayedFieldsForInstance( const QMap &cachedTagsForInstance, QMap &displayedFieldsForCurrentSeries, - QMap &displayedFieldsForCurrentStudy, QMap &displayedFieldsForCurrentPatient ) CTK_OVERRIDE; + QMap &displayedFieldsForCurrentStudy, QMap &displayedFieldsForCurrentPatient ) override; /// Start updating displayed fields (reset counters, etc.). No-op by default. - void startUpdate() CTK_OVERRIDE; + void startUpdate() override; /// End updating displayed fields (accumulate stored variables, compute final result, etc.). No-op by default. /// Has a chance to update any field in the series, study, or patient field maps, based on /// the maps themselves or the database. void endUpdate(QMap > &displayedFieldsMapSeries, QMap > &displayedFieldsMapStudy, - QMap > &displayedFieldsMapPatient) CTK_OVERRIDE; + QMap > &displayedFieldsMapPatient) override; protected: /// Composite IDs (containing PatientID, PatientName, PatientBirthDate) of patients that contain instances of which displayed fields are updated in this run. diff --git a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorPatientNumberOfStudiesRule.h b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorPatientNumberOfStudiesRule.h index 5a9b29969b..98ac47480d 100644 --- a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorPatientNumberOfStudiesRule.h +++ b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorPatientNumberOfStudiesRule.h @@ -37,29 +37,29 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMDisplayedFieldGeneratorPatientNumberOfStudie explicit ctkDICOMDisplayedFieldGeneratorPatientNumberOfStudiesRule(); /// Get name of rule - QString name()const CTK_OVERRIDE; + QString name()const override; /// Clone displayed field generator rule. Override to return a new instance of the rule sub-class - ctkDICOMDisplayedFieldGeneratorAbstractRule* clone() CTK_OVERRIDE; + ctkDICOMDisplayedFieldGeneratorAbstractRule* clone() override; /// Specify list of DICOM tags required by the rule. These tags will be included in the tag cache - QStringList getRequiredDICOMTags() CTK_OVERRIDE; + QStringList getRequiredDICOMTags() override; /// Generate displayed fields for a certain instance based on its cached tags /// The way these generated fields will be used is defined by \sa mergeDisplayedFieldsForInstance void getDisplayedFieldsForInstance( const QMap &cachedTagsForInstance, QMap &displayedFieldsForCurrentSeries, - QMap &displayedFieldsForCurrentStudy, QMap &displayedFieldsForCurrentPatient ) CTK_OVERRIDE; + QMap &displayedFieldsForCurrentStudy, QMap &displayedFieldsForCurrentPatient ) override; /// Start updating displayed fields (reset counters, etc.). No-op by default. - void startUpdate() CTK_OVERRIDE; + void startUpdate() override; /// End updating displayed fields (accumulate stored variables, compute final result, etc.). No-op by default. /// Has a chance to update any field in the series, study, or patient field maps, based on /// the maps themselves or the database. void endUpdate(QMap > &displayedFieldsMapSeries, QMap > &displayedFieldsMapStudy, - QMap > &displayedFieldsMapPatient) CTK_OVERRIDE; + QMap > &displayedFieldsMapPatient) override; protected: /// Composite IDs (containing PatientID, PatientName, PatientBirthDate) of patients that contain instances of which displayed fields are updated in this run. diff --git a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRadiotherapySeriesDescriptionRule.h b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRadiotherapySeriesDescriptionRule.h index 4a74bb7605..e8e6a35453 100644 --- a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRadiotherapySeriesDescriptionRule.h +++ b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRadiotherapySeriesDescriptionRule.h @@ -39,31 +39,31 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMDisplayedFieldGeneratorRadiotherapySeriesDes explicit ctkDICOMDisplayedFieldGeneratorRadiotherapySeriesDescriptionRule(); /// Get name of rule - QString name()const CTK_OVERRIDE; + QString name()const override; /// Clone displayed field generator rule. Override to return a new instance of the rule sub-class - ctkDICOMDisplayedFieldGeneratorAbstractRule* clone() CTK_OVERRIDE; + ctkDICOMDisplayedFieldGeneratorAbstractRule* clone() override; /// Specify list of DICOM tags required by the rule. These tags will be included in the tag cache - QStringList getRequiredDICOMTags() CTK_OVERRIDE; + QStringList getRequiredDICOMTags() override; /// Register placeholder strings that still mean that a given field can be considered empty. /// Used when merging the original database content with the displayed fields generated by the rules. /// Example: SeriesDescription -> Unnamed Series - void registerEmptyFieldNames(QMap emptyFieldsSeries, QMap emptyFieldsStudies, QMap emptyFieldsPatients) CTK_OVERRIDE; + void registerEmptyFieldNames(QMap emptyFieldsSeries, QMap emptyFieldsStudies, QMap emptyFieldsPatients) override; /// Generate displayed fields for a certain instance based on its cached tags /// The way these generated fields will be used is defined by \sa mergeDisplayedFieldsForInstance void getDisplayedFieldsForInstance( const QMap &cachedTagsForInstance, QMap &displayedFieldsForCurrentSeries, - QMap &displayedFieldsForCurrentStudy, QMap &displayedFieldsForCurrentPatient ) CTK_OVERRIDE; + QMap &displayedFieldsForCurrentStudy, QMap &displayedFieldsForCurrentPatient ) override; /// Define rules of merging initial database values with new values generated by the rule plugins void mergeDisplayedFieldsForInstance( const QMap &initialFieldsSeries, const QMap &initialFieldsStudy, const QMap &initialFieldsPatient, const QMap &newFieldsSeries, const QMap &newFieldsStudy, const QMap &newFieldsPatient, QMap &mergedFieldsSeries, QMap &mergedFieldsStudy, QMap &mergedFieldsPatient, - const QMap &emptyFieldsSeries, const QMap &emptyFieldsStudy, const QMap &emptyFieldsPatient ) CTK_OVERRIDE; + const QMap &emptyFieldsSeries, const QMap &emptyFieldsStudy, const QMap &emptyFieldsPatient ) override; protected: const QString EmptySeriesDescriptionRtPlan; diff --git a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.h b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.h index e20f6ecdf8..971bca8d81 100644 --- a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.h +++ b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorRuleFactory.h @@ -70,7 +70,7 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMDisplayedFieldGeneratorRuleFactory : public private: ctkDICOMDisplayedFieldGeneratorRuleFactory(QObject* parent=nullptr); - ~ctkDICOMDisplayedFieldGeneratorRuleFactory() CTK_OVERRIDE; + ~ctkDICOMDisplayedFieldGeneratorRuleFactory() override; Q_DISABLE_COPY(ctkDICOMDisplayedFieldGeneratorRuleFactory); friend class ctkDICOMDisplayedFieldGeneratorRuleFactoryCleanup; diff --git a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorSeriesImageCountRule.h b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorSeriesImageCountRule.h index fd38dec96a..a4628c3cfe 100644 --- a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorSeriesImageCountRule.h +++ b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorSeriesImageCountRule.h @@ -37,29 +37,29 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMDisplayedFieldGeneratorSeriesImageCountRule explicit ctkDICOMDisplayedFieldGeneratorSeriesImageCountRule(); /// Get name of rule - QString name()const CTK_OVERRIDE; + QString name()const override; /// Clone displayed field generator rule. Override to return a new instance of the rule sub-class - ctkDICOMDisplayedFieldGeneratorAbstractRule* clone() CTK_OVERRIDE; + ctkDICOMDisplayedFieldGeneratorAbstractRule* clone() override; /// Specify list of DICOM tags required by the rule. These tags will be included in the tag cache - QStringList getRequiredDICOMTags() CTK_OVERRIDE; + QStringList getRequiredDICOMTags() override; /// Generate displayed fields for a certain instance based on its cached tags /// The way these generated fields will be used is defined by \sa mergeDisplayedFieldsForInstance void getDisplayedFieldsForInstance( const QMap &cachedTagsForInstance, QMap &displayedFieldsForCurrentSeries, - QMap &displayedFieldsForCurrentStudy, QMap &displayedFieldsForCurrentPatient ) CTK_OVERRIDE; + QMap &displayedFieldsForCurrentStudy, QMap &displayedFieldsForCurrentPatient ) override; /// Start updating displayed fields (reset counters, etc.). No-op by default. - void startUpdate() CTK_OVERRIDE; + void startUpdate() override; /// End updating displayed fields (accumulate stored variables, compute final result, etc.). No-op by default. /// Has a chance to update any field in the series, study, or patient field maps, based on /// the maps themselves or the database. void endUpdate(QMap > &displayedFieldsMapSeries, QMap > &displayedFieldsMapStudy, - QMap > &displayedFieldsMapPatient) CTK_OVERRIDE; + QMap > &displayedFieldsMapPatient) override; protected: /// Identifiers of the series that contain instances of which displayed fields are updated in this run. diff --git a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorStudyNumberOfSeriesRule.h b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorStudyNumberOfSeriesRule.h index 2c2de56ef1..2edde43af3 100644 --- a/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorStudyNumberOfSeriesRule.h +++ b/Libs/DICOM/Core/ctkDICOMDisplayedFieldGeneratorStudyNumberOfSeriesRule.h @@ -37,29 +37,29 @@ class CTK_DICOM_CORE_EXPORT ctkDICOMDisplayedFieldGeneratorStudyNumberOfSeriesRu explicit ctkDICOMDisplayedFieldGeneratorStudyNumberOfSeriesRule(); /// Get name of rule - QString name()const CTK_OVERRIDE; + QString name()const override; /// Clone displayed field generator rule. Override to return a new instance of the rule sub-class - ctkDICOMDisplayedFieldGeneratorAbstractRule* clone() CTK_OVERRIDE; + ctkDICOMDisplayedFieldGeneratorAbstractRule* clone() override; /// Specify list of DICOM tags required by the rule. These tags will be included in the tag cache - QStringList getRequiredDICOMTags() CTK_OVERRIDE; + QStringList getRequiredDICOMTags() override; /// Generate displayed fields for a certain instance based on its cached tags /// The way these generated fields will be used is defined by \sa mergeDisplayedFieldsForInstance void getDisplayedFieldsForInstance( const QMap &cachedTagsForInstance, QMap &displayedFieldsForCurrentSeries, - QMap &displayedFieldsForCurrentStudy, QMap &displayedFieldsForCurrentPatient ) CTK_OVERRIDE; + QMap &displayedFieldsForCurrentStudy, QMap &displayedFieldsForCurrentPatient ) override; /// Start updating displayed fields (reset counters, etc.). No-op by default. - void startUpdate() CTK_OVERRIDE; + void startUpdate() override; /// End updating displayed fields (accumulate stored variables, compute final result, etc.). No-op by default. /// Has a chance to update any field in the series, study, or patient field maps, based on /// the maps themselves or the database. void endUpdate(QMap > &displayedFieldsMapSeries, QMap > &displayedFieldsMapStudy, - QMap > &displayedFieldsMapPatient) CTK_OVERRIDE; + QMap > &displayedFieldsMapPatient) override; protected: /// Identifier of studies that contain instances of which displayed fields are updated in this run. diff --git a/Libs/Scripting/Python/Widgets/ctkPythonConsole.h b/Libs/Scripting/Python/Widgets/ctkPythonConsole.h index 569de5b69a..c04b61664a 100644 --- a/Libs/Scripting/Python/Widgets/ctkPythonConsole.h +++ b/Libs/Scripting/Python/Widgets/ctkPythonConsole.h @@ -128,8 +128,8 @@ class CTK_SCRIPTING_PYTHON_WIDGETS_EXPORT ctkPythonConsoleCompleter : public ctk ctkPythonConsoleCompleter(ctkAbstractPythonManager& pythonManager); virtual ~ctkPythonConsoleCompleter(); - int cursorOffset(const QString& completion) CTK_OVERRIDE; - void updateCompletionModel(const QString& completion) CTK_OVERRIDE; + int cursorOffset(const QString& completion) override; + void updateCompletionModel(const QString& completion) override; protected: QScopedPointer d_ptr; diff --git a/Libs/Widgets/ctkCheckablePushButton.h b/Libs/Widgets/ctkCheckablePushButton.h index a755c329dd..ac4d022462 100644 --- a/Libs/Widgets/ctkCheckablePushButton.h +++ b/Libs/Widgets/ctkCheckablePushButton.h @@ -93,13 +93,13 @@ class CTK_WIDGETS_EXPORT ctkCheckablePushButton : public ctkPushButton protected: /// Reimplemented for internal reasons - void mousePressEvent(QMouseEvent* event) CTK_OVERRIDE; + void mousePressEvent(QMouseEvent* event) override; /// Reimplemented for internal reasons - bool hitButton(const QPoint & pos) const CTK_OVERRIDE; + bool hitButton(const QPoint & pos) const override; /// Reimplemented for internal reasons - void checkStateSet() CTK_OVERRIDE; + void checkStateSet() override; /// Reimplemented for internal reasons - void nextCheckState() CTK_OVERRIDE; + void nextCheckState() override; private: Q_DECLARE_PRIVATE(ctkCheckablePushButton); Q_DISABLE_COPY(ctkCheckablePushButton); diff --git a/Libs/Widgets/ctkPathLineEdit.cpp b/Libs/Widgets/ctkPathLineEdit.cpp index 661a609f5a..245fdf2d8b 100644 --- a/Libs/Widgets/ctkPathLineEdit.cpp +++ b/Libs/Widgets/ctkPathLineEdit.cpp @@ -93,7 +93,7 @@ class ctkFileCompleter : public QCompleter ctkFileCompleter(QObject* o, bool showFiles); // Ensure auto-completed file always uses forward-slash as separator - QString pathFromIndex(const QModelIndex& idx) const CTK_OVERRIDE; + QString pathFromIndex(const QModelIndex& idx) const override; // Helper function for getting the current model casted to QFileSystemModel QFileSystemModel* fileSystemModel() const; From e1d60f50065ce4f9ba27579a9cbdc287eccb4a44 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 19 Jul 2023 20:27:13 -0400 Subject: [PATCH 094/115] STYLE: Remove use of obsolete HAVE_QT5 macro Also partially revert 299825292 (COMP: Update ctkDICOMQueryRetrieveWidget to fix build against Qt4/C++98). --- Libs/Core/Testing/Cpp/ctkDummyPlugin.h | 2 -- .../Widgets/Plugins/ctkDICOMWidgetsPlugins.h | 6 ----- .../Widgets/ctkDICOMQueryRetrieveWidget.cpp | 24 ------------------- .../app_test/ctkTestAppActivator_p.h | 2 -- .../pluginA1_test/ctkTestPluginAActivator_p.h | 2 -- .../ctkTestPluginA2Activator_p.h | 2 -- .../pluginA_test/ctkTestPluginAActivator_p.h | 2 -- .../pluginSL1_test/ctkActivatorSL1_p.h | 2 -- .../pluginSL3_test/ctkActivatorSL3_p.h | 2 -- .../pluginSL4_test/ctkActivator_p.h | 2 -- .../pluginS_test/ctkTestPluginSActivator_p.h | 2 -- .../ctkTestPluginMTAttrPwdActivator_p.h | 2 -- .../ctkConfigAdminTestActivator_p.h | 2 -- .../ctkEventAdminTestPerfActivator_p.h | 2 -- .../ctkEventAdminTestActivator_p.h | 2 -- .../ctkMetaTypeTestActivator_p.h | 2 -- .../ctkPluginFrameworkTestPerfActivator_p.h | 2 -- .../ctkPluginFrameworkTestActivator_p.h | 2 -- .../ctkScriptingPythonWidgetsPlugins.h | 6 ----- .../Widgets/Plugins/ctkVTKWidgetsPlugins.h | 6 ----- Libs/Widgets/Plugins/ctkWidgetsPlugins.h | 6 ----- .../ctkConfigurationAdminActivator_p.h | 2 -- .../ctkCommandLineModuleAppPlugin_p.h | 2 -- .../ctkDicomAppHostingCorePlugin_p.h | 2 -- .../ctkExampleDicomAppPlugin_p.h | 2 -- .../ctkExampleDicomHostPlugin_p.h | 2 -- .../ctkDicomHostPlugin_p.h | 2 -- .../ctkDicomAppPlugin_p.h | 2 -- .../ctkEventAdminActivator_p.h | 2 -- Plugins/org.commontk.log/ctkLogPlugin_p.h | 2 -- .../ctkMetaTypeActivator_p.h | 2 -- .../ctkPluginGeneratorCorePlugin_p.h | 2 -- .../ctkPluginGeneratorUiPlugin_p.h | 2 -- 33 files changed, 104 deletions(-) diff --git a/Libs/Core/Testing/Cpp/ctkDummyPlugin.h b/Libs/Core/Testing/Cpp/ctkDummyPlugin.h index 87c086035e..f0a2d0a33d 100644 --- a/Libs/Core/Testing/Cpp/ctkDummyPlugin.h +++ b/Libs/Core/Testing/Cpp/ctkDummyPlugin.h @@ -34,9 +34,7 @@ class CTK_DUMMY_EXPORT ctkDummyPlugin: public QObject//, public ctkDummyInterfac { Q_OBJECT // Q_INTERFACES(ctkDummyInterface) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "org.commontk.DummyPlugin") -#endif public: ctkDummyPlugin(QObject* parent = 0); ~ctkDummyPlugin(); diff --git a/Libs/DICOM/Widgets/Plugins/ctkDICOMWidgetsPlugins.h b/Libs/DICOM/Widgets/Plugins/ctkDICOMWidgetsPlugins.h index b0c1f58b79..60bc85014a 100644 --- a/Libs/DICOM/Widgets/Plugins/ctkDICOMWidgetsPlugins.h +++ b/Libs/DICOM/Widgets/Plugins/ctkDICOMWidgetsPlugins.h @@ -23,11 +23,7 @@ // Qt includes #include -#ifndef HAVE_QT5 -#include -#else #include -#endif // CTK includes #include "ctkDICOMWidgetsPluginsExport.h" @@ -41,9 +37,7 @@ class CTK_DICOM_WIDGETS_PLUGINS_EXPORT ctkDICOMWidgetsPlugins , public QDesignerCustomWidgetCollectionInterface { Q_OBJECT -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "org.commontk.DICOM") -#endif Q_INTERFACES(QDesignerCustomWidgetCollectionInterface); public: diff --git a/Libs/DICOM/Widgets/ctkDICOMQueryRetrieveWidget.cpp b/Libs/DICOM/Widgets/ctkDICOMQueryRetrieveWidget.cpp index 1329530557..b57205c643 100644 --- a/Libs/DICOM/Widgets/ctkDICOMQueryRetrieveWidget.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMQueryRetrieveWidget.cpp @@ -266,12 +266,7 @@ void ctkDICOMQueryRetrieveWidget::query() d->QueriesByServer[d->CurrentServer] = query; -#ifdef HAVE_QT5 for (const auto & StudyAndSeriesInstanceUIDPair : query->studyAndSeriesInstanceUIDQueried() ) -#else - typedef QPair StudyAndSeriesInstanceUIDPairType; - Q_FOREACH(const StudyAndSeriesInstanceUIDPairType & StudyAndSeriesInstanceUIDPair, query->studyAndSeriesInstanceUIDQueried()) -#endif { d->QueriesByStudyUID[StudyAndSeriesInstanceUIDPair.first] = query; d->StudyAndSeriesInstanceUIDPairList.push_back(qMakePair( StudyAndSeriesInstanceUIDPair.first, StudyAndSeriesInstanceUIDPair.second )); @@ -297,19 +292,6 @@ void ctkDICOMQueryRetrieveWidget::query() d->CurrentQuery = 0; } -//---------------------------------------------------------------------------- -#ifndef HAVE_QT5 -namespace { - struct FindBySeriesUID { - QString seriesUID; - FindBySeriesUID(const QString& uid) : seriesUID(uid) {} - bool operator () (const QPair& element) const { - return element.second == seriesUID; - } - }; -} -#endif - //---------------------------------------------------------------------------- void ctkDICOMQueryRetrieveWidget::retrieve() { @@ -363,14 +345,8 @@ void ctkDICOMQueryRetrieveWidget::retrieve() } // Get the study UID of the current series to be retrieved -#ifdef HAVE_QT5 auto currentStudyAndSeriesUIDPair = std::find_if( d->StudyAndSeriesInstanceUIDPairList.begin(), d->StudyAndSeriesInstanceUIDPairList.end(), [&seriesUID]( const QPair& element ) { return element.second == seriesUID; } ); -#else - typedef QList< QPair > StudyAndSeriesInstanceUIDPairList; - StudyAndSeriesInstanceUIDPairList::iterator currentStudyAndSeriesUIDPair = - std::find_if(d->StudyAndSeriesInstanceUIDPairList.begin(), d->StudyAndSeriesInstanceUIDPairList.end(), FindBySeriesUID(seriesUID)); -#endif QString studyUID = currentStudyAndSeriesUIDPair->first; // Get information which server we want to get the study from and prepare request accordingly diff --git a/Libs/PluginFramework/Testing/FrameworkTestPlugins/app_test/ctkTestAppActivator_p.h b/Libs/PluginFramework/Testing/FrameworkTestPlugins/app_test/ctkTestAppActivator_p.h index 565535580b..3589df669c 100644 --- a/Libs/PluginFramework/Testing/FrameworkTestPlugins/app_test/ctkTestAppActivator_p.h +++ b/Libs/PluginFramework/Testing/FrameworkTestPlugins/app_test/ctkTestAppActivator_p.h @@ -33,9 +33,7 @@ class ctkTestAppActivator : public QObject, { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "app_test") -#endif public: diff --git a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginA1_test/ctkTestPluginAActivator_p.h b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginA1_test/ctkTestPluginAActivator_p.h index f13eaa1695..d1721d8212 100644 --- a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginA1_test/ctkTestPluginAActivator_p.h +++ b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginA1_test/ctkTestPluginAActivator_p.h @@ -32,9 +32,7 @@ class ctkTestPluginAActivator : public QObject, { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "pluginA1_test") -#endif public: diff --git a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginA2_test/ctkTestPluginA2Activator_p.h b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginA2_test/ctkTestPluginA2Activator_p.h index 39e1685211..104a0b13b5 100644 --- a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginA2_test/ctkTestPluginA2Activator_p.h +++ b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginA2_test/ctkTestPluginA2Activator_p.h @@ -33,9 +33,7 @@ class ctkTestPluginA2Activator : public QObject, { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "pluginA2_test") -#endif public: diff --git a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginA_test/ctkTestPluginAActivator_p.h b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginA_test/ctkTestPluginAActivator_p.h index eee03b66af..58e8c93dd2 100644 --- a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginA_test/ctkTestPluginAActivator_p.h +++ b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginA_test/ctkTestPluginAActivator_p.h @@ -32,9 +32,7 @@ class ctkTestPluginAActivator : public QObject, { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "pluginA_test") -#endif public: diff --git a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginSL1_test/ctkActivatorSL1_p.h b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginSL1_test/ctkActivatorSL1_p.h index cae1604dc1..cec5c2cf34 100644 --- a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginSL1_test/ctkActivatorSL1_p.h +++ b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginSL1_test/ctkActivatorSL1_p.h @@ -36,9 +36,7 @@ class ctkActivatorSL1 : { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "pluginSL1_test") -#endif Q_PROPERTY(bool serviceAdded READ serviceAdded) Q_PROPERTY(bool serviceRemoved READ serviceRemoved) diff --git a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginSL3_test/ctkActivatorSL3_p.h b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginSL3_test/ctkActivatorSL3_p.h index eb0698981b..da75ae0ca7 100644 --- a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginSL3_test/ctkActivatorSL3_p.h +++ b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginSL3_test/ctkActivatorSL3_p.h @@ -37,9 +37,7 @@ class ctkActivatorSL3 : { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "pluginSL3_test") -#endif Q_PROPERTY(bool serviceAdded READ serviceAdded) Q_PROPERTY(bool serviceRemoved READ serviceRemoved) diff --git a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginSL4_test/ctkActivator_p.h b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginSL4_test/ctkActivator_p.h index 2b170024b6..6bfaec6d03 100644 --- a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginSL4_test/ctkActivator_p.h +++ b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginSL4_test/ctkActivator_p.h @@ -31,9 +31,7 @@ class ctkActivator : { Q_OBJECT Q_INTERFACES(ctkPluginActivator ctkFooService) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "pluginSL4_test") -#endif public: diff --git a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginS_test/ctkTestPluginSActivator_p.h b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginS_test/ctkTestPluginSActivator_p.h index a8b1159ea2..d2ecfc7dbf 100644 --- a/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginS_test/ctkTestPluginSActivator_p.h +++ b/Libs/PluginFramework/Testing/FrameworkTestPlugins/pluginS_test/ctkTestPluginSActivator_p.h @@ -33,9 +33,7 @@ class ctkTestPluginSActivator : public QObject, { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "pluginS_test") -#endif public: diff --git a/Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/ctkTestPluginMTAttrPwdActivator_p.h b/Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/ctkTestPluginMTAttrPwdActivator_p.h index a4c75bae46..c70f72ed4f 100644 --- a/Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/ctkTestPluginMTAttrPwdActivator_p.h +++ b/Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/ctkTestPluginMTAttrPwdActivator_p.h @@ -30,9 +30,7 @@ class ctkTestPluginMTAttrPwdActivator : { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "pluginAttrPwd_test") -#endif public: diff --git a/Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigAdminTestActivator_p.h b/Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigAdminTestActivator_p.h index 686ccf1b41..60d430b11e 100644 --- a/Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigAdminTestActivator_p.h +++ b/Libs/PluginFramework/Testing/org.commontk.configadmintest/ctkConfigAdminTestActivator_p.h @@ -31,9 +31,7 @@ class ctkConfigAdminTestActivator : public QObject, { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "org_commontk_configadmintest") -#endif public: diff --git a/Libs/PluginFramework/Testing/org.commontk.eventadmintest.perf/ctkEventAdminTestPerfActivator_p.h b/Libs/PluginFramework/Testing/org.commontk.eventadmintest.perf/ctkEventAdminTestPerfActivator_p.h index f44fd32fca..3f110530df 100644 --- a/Libs/PluginFramework/Testing/org.commontk.eventadmintest.perf/ctkEventAdminTestPerfActivator_p.h +++ b/Libs/PluginFramework/Testing/org.commontk.eventadmintest.perf/ctkEventAdminTestPerfActivator_p.h @@ -31,9 +31,7 @@ class ctkEventAdminTestPerfActivator : public QObject, { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "org_commontk_eventadmintest_perf") -#endif public: diff --git a/Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEventAdminTestActivator_p.h b/Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEventAdminTestActivator_p.h index 905076f428..eb2492af44 100644 --- a/Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEventAdminTestActivator_p.h +++ b/Libs/PluginFramework/Testing/org.commontk.eventadmintest/ctkEventAdminTestActivator_p.h @@ -31,9 +31,7 @@ class ctkEventAdminTestActivator : public QObject, { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "org_commontk_eventadmintest") -#endif public: diff --git a/Libs/PluginFramework/Testing/org.commontk.metatypetest/ctkMetaTypeTestActivator_p.h b/Libs/PluginFramework/Testing/org.commontk.metatypetest/ctkMetaTypeTestActivator_p.h index e0af140411..8600250d18 100644 --- a/Libs/PluginFramework/Testing/org.commontk.metatypetest/ctkMetaTypeTestActivator_p.h +++ b/Libs/PluginFramework/Testing/org.commontk.metatypetest/ctkMetaTypeTestActivator_p.h @@ -31,9 +31,7 @@ class ctkMetaTypeTestActivator : public QObject, { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "org_commontk_metatypetest") -#endif public: diff --git a/Libs/PluginFramework/Testing/org.commontk.pluginfwtest.perf/ctkPluginFrameworkTestPerfActivator_p.h b/Libs/PluginFramework/Testing/org.commontk.pluginfwtest.perf/ctkPluginFrameworkTestPerfActivator_p.h index f0b1751a78..c767603c28 100644 --- a/Libs/PluginFramework/Testing/org.commontk.pluginfwtest.perf/ctkPluginFrameworkTestPerfActivator_p.h +++ b/Libs/PluginFramework/Testing/org.commontk.pluginfwtest.perf/ctkPluginFrameworkTestPerfActivator_p.h @@ -31,9 +31,7 @@ class ctkPluginFrameworkTestPerfActivator : public QObject, { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "org_commontk_pluginfwtest_perf") -#endif public: diff --git a/Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkPluginFrameworkTestActivator_p.h b/Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkPluginFrameworkTestActivator_p.h index c2d34c86cb..c2d797b6f0 100644 --- a/Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkPluginFrameworkTestActivator_p.h +++ b/Libs/PluginFramework/Testing/org.commontk.pluginfwtest/ctkPluginFrameworkTestActivator_p.h @@ -31,9 +31,7 @@ class ctkPluginFrameworkTestActivator : public QObject, { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "org_commontk_pluginfwtest") -#endif public: diff --git a/Libs/Scripting/Python/Widgets/Plugins/ctkScriptingPythonWidgetsPlugins.h b/Libs/Scripting/Python/Widgets/Plugins/ctkScriptingPythonWidgetsPlugins.h index 1b9af2c924..2f52654406 100644 --- a/Libs/Scripting/Python/Widgets/Plugins/ctkScriptingPythonWidgetsPlugins.h +++ b/Libs/Scripting/Python/Widgets/Plugins/ctkScriptingPythonWidgetsPlugins.h @@ -23,11 +23,7 @@ // Qt includes #include -#ifndef HAVE_QT5 -#include -#else #include -#endif // CTK includes #include "ctkScriptingPythonWidgetsPluginsExport.h" @@ -39,9 +35,7 @@ class CTK_SCRIPTING_PYTHON_WIDGETS_PLUGINS_EXPORT ctkScriptingPythonWidgetsPlugi , public QDesignerCustomWidgetCollectionInterface { Q_OBJECT -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "org.commontk.Python") -#endif Q_INTERFACES(QDesignerCustomWidgetCollectionInterface); public: diff --git a/Libs/Visualization/VTK/Widgets/Plugins/ctkVTKWidgetsPlugins.h b/Libs/Visualization/VTK/Widgets/Plugins/ctkVTKWidgetsPlugins.h index 53e1fb853a..6b768b48de 100644 --- a/Libs/Visualization/VTK/Widgets/Plugins/ctkVTKWidgetsPlugins.h +++ b/Libs/Visualization/VTK/Widgets/Plugins/ctkVTKWidgetsPlugins.h @@ -23,11 +23,7 @@ // Qt includes #include -#ifndef HAVE_QT5 -#include -#else #include -#endif // CTK includes #include "ctkVisualizationVTKWidgetsPluginsExport.h" @@ -53,9 +49,7 @@ class CTK_VISUALIZATION_VTK_WIDGETS_PLUGINS_EXPORT ctkVTKWidgetsPlugins , public QDesignerCustomWidgetCollectionInterface { Q_OBJECT -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "org.commontk.VTKWidgets") -#endif Q_INTERFACES(QDesignerCustomWidgetCollectionInterface); public: diff --git a/Libs/Widgets/Plugins/ctkWidgetsPlugins.h b/Libs/Widgets/Plugins/ctkWidgetsPlugins.h index de893fdce6..4dbe0990c8 100644 --- a/Libs/Widgets/Plugins/ctkWidgetsPlugins.h +++ b/Libs/Widgets/Plugins/ctkWidgetsPlugins.h @@ -23,11 +23,7 @@ // Qt includes #include -#ifndef HAVE_QT5 -#include -#else #include -#endif // CTK includes #include "ctkWidgetsPluginsExport.h" @@ -81,9 +77,7 @@ class CTK_WIDGETS_PLUGINS_EXPORT ctkWidgetsPlugins { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetCollectionInterface) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "org.commontk.Widgets") -#endif public: QList customWidgets() const { diff --git a/Plugins/org.commontk.configadmin/ctkConfigurationAdminActivator_p.h b/Plugins/org.commontk.configadmin/ctkConfigurationAdminActivator_p.h index 354e1748e9..037c2eaa82 100644 --- a/Plugins/org.commontk.configadmin/ctkConfigurationAdminActivator_p.h +++ b/Plugins/org.commontk.configadmin/ctkConfigurationAdminActivator_p.h @@ -41,9 +41,7 @@ class ctkConfigurationAdminActivator : { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "org_commontk_configadmin") -#endif public: diff --git a/Plugins/org.commontk.dah.cmdlinemoduleapp/ctkCommandLineModuleAppPlugin_p.h b/Plugins/org.commontk.dah.cmdlinemoduleapp/ctkCommandLineModuleAppPlugin_p.h index a63c0814d6..dce3ee857b 100644 --- a/Plugins/org.commontk.dah.cmdlinemoduleapp/ctkCommandLineModuleAppPlugin_p.h +++ b/Plugins/org.commontk.dah.cmdlinemoduleapp/ctkCommandLineModuleAppPlugin_p.h @@ -32,9 +32,7 @@ class ctkCommandLineModuleAppPlugin : { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "org_commontk_dah_cmdlinemoduleapp") -#endif public: diff --git a/Plugins/org.commontk.dah.core/ctkDicomAppHostingCorePlugin_p.h b/Plugins/org.commontk.dah.core/ctkDicomAppHostingCorePlugin_p.h index 65e6b09215..83e84dfab3 100644 --- a/Plugins/org.commontk.dah.core/ctkDicomAppHostingCorePlugin_p.h +++ b/Plugins/org.commontk.dah.core/ctkDicomAppHostingCorePlugin_p.h @@ -30,9 +30,7 @@ class ctkDicomAppHostingCorePlugin : { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "org_commontk_dah_core") -#endif public: diff --git a/Plugins/org.commontk.dah.exampleapp/ctkExampleDicomAppPlugin_p.h b/Plugins/org.commontk.dah.exampleapp/ctkExampleDicomAppPlugin_p.h index 5fac83242d..832adbb560 100644 --- a/Plugins/org.commontk.dah.exampleapp/ctkExampleDicomAppPlugin_p.h +++ b/Plugins/org.commontk.dah.exampleapp/ctkExampleDicomAppPlugin_p.h @@ -32,9 +32,7 @@ class ctkExampleDicomAppPlugin : { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "org_commontk_example_dicomapp") -#endif public: diff --git a/Plugins/org.commontk.dah.examplehost/ctkExampleDicomHostPlugin_p.h b/Plugins/org.commontk.dah.examplehost/ctkExampleDicomHostPlugin_p.h index 1bc1d20476..320ef6d54b 100644 --- a/Plugins/org.commontk.dah.examplehost/ctkExampleDicomHostPlugin_p.h +++ b/Plugins/org.commontk.dah.examplehost/ctkExampleDicomHostPlugin_p.h @@ -30,9 +30,7 @@ class ctkExampleDicomHostPlugin : { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "org_commontk_dah_examplehost") -#endif public: diff --git a/Plugins/org.commontk.dah.host/ctkDicomHostPlugin_p.h b/Plugins/org.commontk.dah.host/ctkDicomHostPlugin_p.h index 2d100afb15..858a3631c2 100644 --- a/Plugins/org.commontk.dah.host/ctkDicomHostPlugin_p.h +++ b/Plugins/org.commontk.dah.host/ctkDicomHostPlugin_p.h @@ -30,9 +30,7 @@ class ctkDicomHostPlugin : { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "org_commontk_dah_host") -#endif public: diff --git a/Plugins/org.commontk.dah.hostedapp/ctkDicomAppPlugin_p.h b/Plugins/org.commontk.dah.hostedapp/ctkDicomAppPlugin_p.h index cca5b3f7fc..c3b843e24b 100644 --- a/Plugins/org.commontk.dah.hostedapp/ctkDicomAppPlugin_p.h +++ b/Plugins/org.commontk.dah.hostedapp/ctkDicomAppPlugin_p.h @@ -33,9 +33,7 @@ class ctkDicomAppPlugin : { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "org_commontk_dah_hostedapp") -#endif public: diff --git a/Plugins/org.commontk.eventadmin/ctkEventAdminActivator_p.h b/Plugins/org.commontk.eventadmin/ctkEventAdminActivator_p.h index 78c88120f0..abb6f8a803 100644 --- a/Plugins/org.commontk.eventadmin/ctkEventAdminActivator_p.h +++ b/Plugins/org.commontk.eventadmin/ctkEventAdminActivator_p.h @@ -35,9 +35,7 @@ class ctkEventAdminActivator : public QObject, { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "org_commontk_eventadmin") -#endif public: diff --git a/Plugins/org.commontk.log/ctkLogPlugin_p.h b/Plugins/org.commontk.log/ctkLogPlugin_p.h index 695995d4b4..6692acf35a 100644 --- a/Plugins/org.commontk.log/ctkLogPlugin_p.h +++ b/Plugins/org.commontk.log/ctkLogPlugin_p.h @@ -32,9 +32,7 @@ class ctkLogPlugin : { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "org_commontk_log") -#endif public: diff --git a/Plugins/org.commontk.metatype/ctkMetaTypeActivator_p.h b/Plugins/org.commontk.metatype/ctkMetaTypeActivator_p.h index 49657038fb..1a37f9a819 100644 --- a/Plugins/org.commontk.metatype/ctkMetaTypeActivator_p.h +++ b/Plugins/org.commontk.metatype/ctkMetaTypeActivator_p.h @@ -36,9 +36,7 @@ class ctkMetaTypeActivator : { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "org_commontk_metatype") -#endif private: diff --git a/Plugins/org.commontk.plugingenerator.core/ctkPluginGeneratorCorePlugin_p.h b/Plugins/org.commontk.plugingenerator.core/ctkPluginGeneratorCorePlugin_p.h index d281d6c324..3795a09eed 100644 --- a/Plugins/org.commontk.plugingenerator.core/ctkPluginGeneratorCorePlugin_p.h +++ b/Plugins/org.commontk.plugingenerator.core/ctkPluginGeneratorCorePlugin_p.h @@ -32,9 +32,7 @@ class ctkPluginGeneratorCorePlugin : public QObject, { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "org_commontk_plugingenerator_core") -#endif public: diff --git a/Plugins/org.commontk.plugingenerator.ui/ctkPluginGeneratorUiPlugin_p.h b/Plugins/org.commontk.plugingenerator.ui/ctkPluginGeneratorUiPlugin_p.h index e1e4acacd4..e39a53be43 100644 --- a/Plugins/org.commontk.plugingenerator.ui/ctkPluginGeneratorUiPlugin_p.h +++ b/Plugins/org.commontk.plugingenerator.ui/ctkPluginGeneratorUiPlugin_p.h @@ -32,9 +32,7 @@ class ctkPluginGeneratorUiPlugin : public QObject, { Q_OBJECT Q_INTERFACES(ctkPluginActivator) -#ifdef HAVE_QT5 Q_PLUGIN_METADATA(IID "org_commontk_plugingenerator_ui") -#endif public: From 49539dc1514412b734303253818acffd34a2af14 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 19 Jul 2023 21:01:01 -0400 Subject: [PATCH 095/115] STYLE: Simplify ctkWrapPythonQt script removing use of obsolete CTK_NULLPTR This commit reverts e51d3b7ee (COMP: Update ctkWrapPythonQt script to consider CTK_NULLPTR) --- CMake/ctkWrapPythonQt.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMake/ctkWrapPythonQt.py b/CMake/ctkWrapPythonQt.py index 21a44c08a3..37c43a78a2 100644 --- a/CMake/ctkWrapPythonQt.py +++ b/CMake/ctkWrapPythonQt.py @@ -103,7 +103,7 @@ def ctk_wrap_pythonqt(target, namespace, output_dir, input_files, extra_verbose) # my_class(QObject* newParent ...) # my_class(QWidget* newParent ...) # Constructor with either QWidget or QObject as first parameter - regex = r"[^~]%s[\s\n]*\([\s\n]*((QObject|QWidget)[\s\n]*\*[\s\n]*\w+[\s\n]*(\=[\s\n]*(0|NULL|nullptr|CTK\_NULLPTR)|,.*\=.*\)|\)|\)))" % className + regex = r"[^~]%s[\s\n]*\([\s\n]*((QObject|QWidget)[\s\n]*\*[\s\n]*\w+[\s\n]*(\=[\s\n]*(0|NULL|nullptr)|,.*\=.*\)|\)|\)))" % className res = re.search(regex, content, re.MULTILINE) if res is None: if extra_verbose: @@ -112,7 +112,7 @@ def ctk_wrap_pythonqt(target, namespace, output_dir, input_files, extra_verbose) # Skip wrapping if object has a virtual pure method # "x3b" is the unicode for semicolon - regex = r"virtual[\w\n\s\*\(\)]+\=[\s\n]*(0|NULL|nullptr|CTK\_NULLPTR)[\s\n]*\x3b" + regex = r"virtual[\w\n\s\*\(\)]+\=[\s\n]*(0|NULL|nullptr)[\s\n]*\x3b" res = re.search(regex, content, re.MULTILINE) if res is not None: if extra_verbose: @@ -131,7 +131,7 @@ def ctk_wrap_pythonqt(target, namespace, output_dir, input_files, extra_verbose) if parentClassName is None: # Does constructor signature is of the form: myclass(QObject * parent ...) - regex = r"%s[\s\n]*\([\s\n]*QObject[\s\n]*\*[\s\n]*\w+[\s\n]*(\=[\s\n]*(0|NULL|nullptr|CTK\_NULLPTR)|,.*\=.*\)|\))" % className + regex = r"%s[\s\n]*\([\s\n]*QObject[\s\n]*\*[\s\n]*\w+[\s\n]*(\=[\s\n]*(0|NULL|nullptr)|,.*\=.*\)|\))" % className res = re.search(regex, content, re.MULTILINE) if res is not None: parentClassName = "QObject" @@ -140,7 +140,7 @@ def ctk_wrap_pythonqt(target, namespace, output_dir, input_files, extra_verbose) if parentClassName is None: # Does constructor signature is of the form: myclass(QWidget * parent ...) - regex = r"%s[\s\n]*\([\s\n]*QWidget[\s\n]*\*[\s\n]*\w+[\s\n]*(\=[\s\n]*(0|NULL|nullptr|CTK\_NULLPTR)|,.*\=.*\)|\))" % className + regex = r"%s[\s\n]*\([\s\n]*QWidget[\s\n]*\*[\s\n]*\w+[\s\n]*(\=[\s\n]*(0|NULL|nullptr)|,.*\=.*\)|\))" % className res = re.search(regex, content, re.MULTILINE) if res is not None: parentClassName = "QWidget" From 9856b3fcf2ec896a92062118246463f4810287c5 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 19 Jul 2023 21:01:50 -0400 Subject: [PATCH 096/115] BUG: Fix ctkDICOMIndexer reverting back to functor signal/slot This commit reverts 7bb0d9fdb (COMP: Fix Qt4/C++98 ctkDICOMIndexerPrivate build using literal signal/slot) This addresses the following error reported when running ctkDICOMIndexerTest1: QObject::connect: No such signal QThread::"finished()" QObject::connect: No such signal ctkDICOMIndexerPrivate::"startWorker()" QObject::connect: No such signal ctkDICOMIndexerPrivateWorker::"progress(int)" QObject::connect: No such signal ctkDICOMIndexerPrivateWorker::"progressDetail(QString)" QObject::connect: No such signal ctkDICOMIndexerPrivateWorker::"progressStep(QString)" QObject::connect: No such signal ctkDICOMIndexerPrivateWorker::"updatingDatabase(bool)" QObject::connect: No such signal ctkDICOMIndexerPrivateWorker::"indexingComplete(int,int,int,int)" QObject::connect: No such signal ctkDICOMIndexer::"indexingComplete(int,int,int,int)" For reference, the functor-based connection was introduced in 7f2f24a051 (ENH: DICOM browser rework). --- Libs/DICOM/Core/ctkDICOMIndexer.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Libs/DICOM/Core/ctkDICOMIndexer.cpp b/Libs/DICOM/Core/ctkDICOMIndexer.cpp index 6581fb9072..7304150b32 100644 --- a/Libs/DICOM/Core/ctkDICOMIndexer.cpp +++ b/Libs/DICOM/Core/ctkDICOMIndexer.cpp @@ -297,15 +297,15 @@ ctkDICOMIndexerPrivate::ctkDICOMIndexerPrivate(ctkDICOMIndexer& o) ctkDICOMIndexerPrivateWorker* worker = new ctkDICOMIndexerPrivateWorker(&this->RequestQueue); worker->moveToThread(&this->WorkerThread); - connect(&this->WorkerThread, SIGNAL("finished()"), worker, SLOT("deleteLater()")); - connect(this, SIGNAL("startWorker()"), worker, SLOT("start()")); + connect(&this->WorkerThread, &QThread::finished, worker, &QObject::deleteLater); + connect(this, &ctkDICOMIndexerPrivate::startWorker, worker, &ctkDICOMIndexerPrivateWorker::start); // Progress report - connect(worker, SIGNAL("progress(int)"), q_ptr, SLOT("progress(int)")); - connect(worker, SIGNAL("progressDetail(QString)"), q_ptr, SLOT("progressDetail(QString)")); - connect(worker, SIGNAL("progressStep(QString)"), q_ptr, SLOT("progressStep(QString)")); - connect(worker, SIGNAL("updatingDatabase(bool)"), q_ptr, SLOT("updatingDatabase(bool)")); - connect(worker, SIGNAL("indexingComplete(int,int,int,int)"), q_ptr, SLOT("indexingComplete(int,int,int,int)")); + connect(worker, &ctkDICOMIndexerPrivateWorker::progress, q_ptr, &ctkDICOMIndexer::progress); + connect(worker, &ctkDICOMIndexerPrivateWorker::progressDetail, q_ptr, &ctkDICOMIndexer::progressDetail); + connect(worker, &ctkDICOMIndexerPrivateWorker::progressStep, q_ptr, &ctkDICOMIndexer::progressStep); + connect(worker, &ctkDICOMIndexerPrivateWorker::updatingDatabase, q_ptr, &ctkDICOMIndexer::updatingDatabase); + connect(worker, &ctkDICOMIndexerPrivateWorker::indexingComplete, q_ptr, &ctkDICOMIndexer::indexingComplete); this->WorkerThread.start(); } @@ -653,10 +653,10 @@ void ctkDICOMIndexer::waitForImportFinished(int msecTimeout /*=-1*/) QTimer timer; timer.setSingleShot(true); QEventLoop loop; - connect(this, SIGNAL("indexingComplete(int,int,int,int)"), &loop, SLOT("quit()")); + connect(this, &ctkDICOMIndexer::indexingComplete, &loop, &QEventLoop::quit); if (msecTimeout >= 0) { - connect(&timer, SIGNAL("timeout()"), &loop, SLOT("quit()")); + connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit); timer.start(msecTimeout); } if (!this->isImporting()) From 1feb4981c4aa113237b2696800c63f61932cae21 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 19 Jul 2023 22:50:00 -0400 Subject: [PATCH 097/115] BUG: Fix ctkFlowLayout regression related to minimum size computation This commit fixes a regression introduced in e66324212 (COMP: Fix deprecated warning related to QWidget::getContentsMargins()). Since functions QWidget::contentsRect() and QWidget::contentsMargins() are not equivalent, the logic associated with ctkFlowLayout::minimumSize() and ctkFlowLayout::sizeHint() was incorrect. Fixes https://github.com/Slicer/Slicer/issues/7108 Reported-by: Csaba Pinter Co-authored-by: Andras Lasso --- Libs/Widgets/ctkFlowLayout.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Libs/Widgets/ctkFlowLayout.cpp b/Libs/Widgets/ctkFlowLayout.cpp index 628ce28ed4..25d27b6a1f 100644 --- a/Libs/Widgets/ctkFlowLayout.cpp +++ b/Libs/Widgets/ctkFlowLayout.cpp @@ -414,7 +414,12 @@ QSize ctkFlowLayout::minimumSize() const } size = size.expandedTo(item->minimumSize()); } - size += this->contentsRect().size(); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) + size = size.grownBy(this->contentsMargins()); +#else + QMargins margins = this->contentsMargins(); + size += QSize(margins.left() + margins.right(), margins.top() + margins.bottom()); +#endif return size; } @@ -475,7 +480,12 @@ QSize ctkFlowLayout::sizeHint() const size += QSize((countX-1) * this->horizontalSpacing(), (countY-1) * this->verticalSpacing()); // Add margins - size += this->contentsRect().size(); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) + size = size.grownBy(this->contentsMargins()); +#else + QMargins margins = this->contentsMargins(); + size += QSize(margins.left() + margins.right(), margins.top() + margins.bottom()); +#endif return size; } From 23680779aedcac2cd0034b0b597f1db842e4a88c Mon Sep 17 00:00:00 2001 From: James Butler Date: Fri, 21 Jul 2023 09:13:57 -0400 Subject: [PATCH 098/115] STYLE: Trim whitespace --- Libs/Widgets/ctkRangeSlider.cpp | 110 ++++++++++++++++---------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/Libs/Widgets/ctkRangeSlider.cpp b/Libs/Widgets/ctkRangeSlider.cpp index 89261f785a..556500805f 100644 --- a/Libs/Widgets/ctkRangeSlider.cpp +++ b/Libs/Widgets/ctkRangeSlider.cpp @@ -62,7 +62,7 @@ class ctkRangeSliderPrivate /// Draw the bottom and top sliders. void drawMinimumSlider( QStylePainter* painter ) const; void drawMaximumSlider( QStylePainter* painter ) const; - + /// End points of the range on the Model int m_MaximumValue; int m_MinimumValue; @@ -75,14 +75,14 @@ class ctkRangeSliderPrivate QStyle::SubControl m_MinimumSliderSelected; QStyle::SubControl m_MaximumSliderSelected; - /// See QSliderPrivate::clickOffset. + /// See QSliderPrivate::clickOffset. /// Overrides this ivar int m_SubclassClickOffset; - + /// See QSliderPrivate::position /// Overrides this ivar. int m_SubclassPosition; - + /// Original width between the 2 bounds before any moves float m_SubclassWidth; @@ -137,7 +137,7 @@ ctkRangeSliderPrivate::Handle ctkRangeSliderPrivate::handleAtPos(const QPoint& p // The functinos hitTestComplexControl only know about 1 handle. As we have // 2, we change the position of the handle and test if the pos correspond to // any of the 2 positions. - + // Test the MinimumHandle option.sliderPosition = this->m_MinimumPosition; option.sliderValue = this->m_MinimumValue; @@ -147,7 +147,7 @@ ctkRangeSliderPrivate::Handle ctkRangeSliderPrivate::handleAtPos(const QPoint& p QRect minimumHandleRect = q->style()->subControlRect( QStyle::CC_Slider, &option, QStyle::SC_SliderHandle, q); - // Test if the pos is under the Maximum handle + // Test if the pos is under the Maximum handle option.sliderPosition = this->m_MaximumPosition; option.sliderValue = this->m_MaximumValue; @@ -165,12 +165,12 @@ ctkRangeSliderPrivate::Handle ctkRangeSliderPrivate::handleAtPos(const QPoint& p if (q->orientation() == Qt::Horizontal) { minDist = pos.x() - minimumHandleRect.left(); - maxDist = maximumHandleRect.right() - pos.x(); + maxDist = maximumHandleRect.right() - pos.x(); } else //if (q->orientation() == Qt::Vertical) { minDist = minimumHandleRect.bottom() - pos.y(); - maxDist = pos.y() - maximumHandleRect.top(); + maxDist = pos.y() - maximumHandleRect.top(); } Q_ASSERT( minDist >= 0 && maxDist >= 0); minimumControl = minDist < maxDist ? minimumControl : QStyle::SC_None; @@ -199,16 +199,16 @@ int ctkRangeSliderPrivate::pixelPosToRangeValue( int pos ) const QStyleOptionSlider option; q->initStyleOption( &option ); - QRect gr = q->style()->subControlRect( QStyle::CC_Slider, - &option, - QStyle::SC_SliderGroove, + QRect gr = q->style()->subControlRect( QStyle::CC_Slider, + &option, + QStyle::SC_SliderGroove, q ); - QRect sr = q->style()->subControlRect( QStyle::CC_Slider, - &option, - QStyle::SC_SliderHandle, + QRect sr = q->style()->subControlRect( QStyle::CC_Slider, + &option, + QStyle::SC_SliderHandle, q ); int sliderMin, sliderMax, sliderLength; - if (option.orientation == Qt::Horizontal) + if (option.orientation == Qt::Horizontal) { sliderLength = sr.width(); sliderMin = gr.x(); @@ -221,10 +221,10 @@ int ctkRangeSliderPrivate::pixelPosToRangeValue( int pos ) const sliderMax = gr.bottom() - sliderLength + 1; } - return QStyle::sliderValueFromPosition( q->minimum(), - q->maximum(), + return QStyle::sliderValueFromPosition( q->minimum(), + q->maximum(), pos - sliderMin, - sliderMax - sliderMin, + sliderMax - sliderMin, option.upsideDown ); } @@ -235,16 +235,16 @@ int ctkRangeSliderPrivate::pixelPosFromRangeValue( int val ) const QStyleOptionSlider option; q->initStyleOption( &option ); - QRect gr = q->style()->subControlRect( QStyle::CC_Slider, - &option, - QStyle::SC_SliderGroove, + QRect gr = q->style()->subControlRect( QStyle::CC_Slider, + &option, + QStyle::SC_SliderGroove, q ); - QRect sr = q->style()->subControlRect( QStyle::CC_Slider, - &option, - QStyle::SC_SliderHandle, + QRect sr = q->style()->subControlRect( QStyle::CC_Slider, + &option, + QStyle::SC_SliderHandle, q ); int sliderMin, sliderMax, sliderLength; - if (option.orientation == Qt::Horizontal) + if (option.orientation == Qt::Horizontal) { sliderLength = sr.width(); sliderMin = gr.x(); @@ -257,10 +257,10 @@ int ctkRangeSliderPrivate::pixelPosFromRangeValue( int val ) const sliderMax = gr.bottom() - sliderLength + 1; } - return QStyle::sliderPositionFromValue( q->minimum(), - q->maximum(), + return QStyle::sliderPositionFromValue( q->minimum(), + q->maximum(), val, - sliderMax - sliderMin, + sliderMax - sliderMin, option.upsideDown ) + sliderMin; } @@ -389,23 +389,23 @@ void ctkRangeSlider::setMaximumValue( int max ) void ctkRangeSlider::setValues(int l, int u) { Q_D(ctkRangeSlider); - const int minValue = + const int minValue = qBound(this->minimum(), qMin(l,u), this->maximum()); - const int maxValue = + const int maxValue = qBound(this->minimum(), qMax(l,u), this->maximum()); bool emitMinValChanged = (minValue != d->m_MinimumValue); bool emitMaxValChanged = (maxValue != d->m_MaximumValue); - + d->m_MinimumValue = minValue; d->m_MaximumValue = maxValue; - - bool emitMinPosChanged = + + bool emitMinPosChanged = (minValue != d->m_MinimumPosition); - bool emitMaxPosChanged = + bool emitMaxPosChanged = (maxValue != d->m_MaximumPosition); d->m_MinimumPosition = minValue; d->m_MaximumPosition = maxValue; - + if (isSliderDown()) { if (emitMinPosChanged || emitMaxPosChanged) @@ -423,7 +423,7 @@ void ctkRangeSlider::setValues(int l, int u) } if (emitMinValChanged || emitMaxValChanged) { - emit valuesChanged(d->m_MinimumValue, + emit valuesChanged(d->m_MinimumValue, d->m_MaximumValue); } if (emitMinValChanged) @@ -434,7 +434,7 @@ void ctkRangeSlider::setValues(int l, int u) { emit maximumValueChanged(d->m_MaximumValue); } - if (emitMinPosChanged || emitMaxPosChanged || + if (emitMinPosChanged || emitMaxPosChanged || emitMinValChanged || emitMaxValChanged) { this->update(); @@ -473,14 +473,14 @@ void ctkRangeSlider::setMaximumPosition(int u) void ctkRangeSlider::setPositions(int min, int max) { Q_D(ctkRangeSlider); - const int minPosition = + const int minPosition = qBound(this->minimum(), qMin(min, max), this->maximum()); - const int maxPosition = + const int maxPosition = qBound(this->minimum(), qMax(min, max), this->maximum()); bool emitMinPosChanged = (minPosition != d->m_MinimumPosition); bool emitMaxPosChanged = (maxPosition != d->m_MaximumPosition); - + if (!emitMinPosChanged && !emitMaxPosChanged) { return; @@ -556,20 +556,20 @@ void ctkRangeSlider::paintEvent( QPaintEvent* ) painter.drawComplexControl(QStyle::CC_Slider, option); option.sliderPosition = d->m_MinimumPosition; - const QRect lr = style()->subControlRect( QStyle::CC_Slider, - &option, - QStyle::SC_SliderHandle, + const QRect lr = style()->subControlRect( QStyle::CC_Slider, + &option, + QStyle::SC_SliderHandle, this); option.sliderPosition = d->m_MaximumPosition; - const QRect ur = style()->subControlRect( QStyle::CC_Slider, - &option, - QStyle::SC_SliderHandle, + const QRect ur = style()->subControlRect( QStyle::CC_Slider, + &option, + QStyle::SC_SliderHandle, this); - QRect sr = style()->subControlRect( QStyle::CC_Slider, - &option, - QStyle::SC_SliderGroove, + QRect sr = style()->subControlRect( QStyle::CC_Slider, + &option, + QStyle::SC_SliderGroove, this); QRect rangeBox; if (option.orientation == Qt::Horizontal) @@ -588,9 +588,9 @@ void ctkRangeSlider::paintEvent( QPaintEvent* ) // ----------------------------- // Render the range // - QRect groove = this->style()->subControlRect( QStyle::CC_Slider, - &option, - QStyle::SC_SliderGroove, + QRect groove = this->style()->subControlRect( QStyle::CC_Slider, + &option, + QStyle::SC_SliderGroove, this ); groove.adjust(0, 0, -1, 0); @@ -681,7 +681,7 @@ void ctkRangeSlider::mousePressEvent(QMouseEvent* mouseEvent) // if we are here, no handles have been pressed // Check if we pressed on the groove between the 2 handles - + QStyle::SubControl control = this->style()->hitTestComplexControl( QStyle::CC_Slider, &option, mouseEvent->pos(), this); QRect sr = style()->subControlRect( @@ -701,8 +701,8 @@ void ctkRangeSlider::mousePressEvent(QMouseEvent* mouseEvent) this->setSliderDown(true); if (!this->isMinimumSliderDown() || !this->isMaximumSliderDown()) { - d->m_SelectedHandles = - QFlags(ctkRangeSliderPrivate::MinimumHandle) | + d->m_SelectedHandles = + QFlags(ctkRangeSliderPrivate::MinimumHandle) | QFlags(ctkRangeSliderPrivate::MaximumHandle); this->update(handleRect.united(sr)); } From 2b16f9dff6ce6a1ddf5589eea4878e3cad0fc951 Mon Sep 17 00:00:00 2001 From: James Butler Date: Fri, 21 Jul 2023 09:17:39 -0400 Subject: [PATCH 099/115] BUG: Fix inability to customize ctkRangeSlider filled color Previously, when specifying the below customization at the QApplication level stylesheet, the ctkRangeSlider filled color would not change. QSlider:disabled { selection-background-color: #767676; } --- Libs/Widgets/ctkRangeSlider.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Libs/Widgets/ctkRangeSlider.cpp b/Libs/Widgets/ctkRangeSlider.cpp index 556500805f..93ad6b68d9 100644 --- a/Libs/Widgets/ctkRangeSlider.cpp +++ b/Libs/Widgets/ctkRangeSlider.cpp @@ -596,7 +596,7 @@ void ctkRangeSlider::paintEvent( QPaintEvent* ) // Create default colors based on the transfer function. // - QColor highlight = this->palette().color(QPalette::Normal, QPalette::Highlight); + QColor highlight = this->palette().color(QPalette::Highlight); QLinearGradient gradient; if (option.orientation == Qt::Horizontal) { @@ -613,6 +613,7 @@ void ctkRangeSlider::paintEvent( QPaintEvent* ) //QColor l = Qt::darkGray; //QColor u = Qt::black; + // Like Fusion Style to match QSlider gradient.setColorAt(0, highlight.darker(120)); gradient.setColorAt(1, highlight.lighter(160)); From 7b3859c192b74df787973cdde434c04c3085be3d Mon Sep 17 00:00:00 2001 From: James Butler Date: Mon, 24 Jul 2023 19:08:08 -0400 Subject: [PATCH 100/115] COMP: Update C++ source files removing code specific to Qt 4 This is a follow-up to https://github.com/commontk/CTK/commit/b86197b7ca9fd79c93702a114d87321de7229e7a expand-down.png and expand-up.png are being removed as they were only used in ctkCollapsibleGroupBox built with Qt < 4.6 --- .../Core/ctkCmdLineModuleRunException.h | 4 -- Libs/Core/ctkAbstractLibraryFactory.h | 6 +- Libs/Core/ctkErrorLogQtMessageHandler.h | 6 -- .../ctkPluginFramework_global.h | 9 --- .../Cpp/ctkAbstractPythonManagerTest.cpp | 3 - Libs/Testing/ctkTest.h | 6 +- Libs/Widgets/Resources/Icons/expand-down.png | Bin 190 -> 0 bytes Libs/Widgets/Resources/Icons/expand-up.png | Bin 181 -> 0 bytes Libs/Widgets/Resources/ctkWidgets.qrc | 2 - .../Testing/Cpp/ctkCheckableComboBoxTest1.cpp | 9 --- .../Cpp/ctkCheckableHeaderViewTest1.cpp | 18 ----- .../Cpp/ctkCheckableHeaderViewTest2.cpp | 9 --- .../Testing/Cpp/ctkColorDialogTest1.cpp | 4 -- Libs/Widgets/Testing/Cpp/ctkConsoleTest.cpp | 4 -- .../Testing/Cpp/ctkDoubleRangeSliderTest.cpp | 4 -- .../Testing/Cpp/ctkDoubleSliderTest.cpp | 4 -- .../Testing/Cpp/ctkDoubleSpinBoxTest.cpp | 4 -- .../Testing/Cpp/ctkExpandableWidgetTest1.cpp | 7 -- .../Testing/Cpp/ctkFlatProxyModelTest.cpp | 4 -- .../Testing/Cpp/ctkMatrixWidgetTest.cpp | 8 --- .../Cpp/ctkPathListWidgetWithButtonsTest.cpp | 4 -- .../Widgets/Testing/Cpp/ctkPushButtonTest.cpp | 12 ---- .../Testing/Cpp/ctkRangeSliderTest.cpp | 17 ----- .../Testing/Cpp/ctkRangeWidgetTest.cpp | 4 -- Libs/Widgets/Testing/Cpp/ctkSearchBoxTest.cpp | 4 -- .../Testing/Cpp/ctkSliderWidgetTest.cpp | 12 ---- Libs/Widgets/ctkCollapsibleGroupBox.cpp | 63 +----------------- Libs/Widgets/ctkCollapsibleGroupBox.h | 8 +-- Libs/Widgets/ctkPixmapIconEngine.h | 12 ---- Libs/Widgets/ctkSearchBox.h | 9 --- .../ctkSimpleSoapServer.cpp | 4 -- .../ctkSimpleSoapServer.h | 4 -- 32 files changed, 6 insertions(+), 258 deletions(-) delete mode 100644 Libs/Widgets/Resources/Icons/expand-down.png delete mode 100644 Libs/Widgets/Resources/Icons/expand-up.png diff --git a/Libs/CommandLineModules/Core/ctkCmdLineModuleRunException.h b/Libs/CommandLineModules/Core/ctkCmdLineModuleRunException.h index 38d9df6106..b9f7f533a2 100644 --- a/Libs/CommandLineModules/Core/ctkCmdLineModuleRunException.h +++ b/Libs/CommandLineModules/Core/ctkCmdLineModuleRunException.h @@ -26,11 +26,7 @@ #include -#if (QT_VERSION < 0x50000) -#include -#else #include -#endif /** diff --git a/Libs/Core/ctkAbstractLibraryFactory.h b/Libs/Core/ctkAbstractLibraryFactory.h index ec9ce4a85b..c75fde14ed 100644 --- a/Libs/Core/ctkAbstractLibraryFactory.h +++ b/Libs/Core/ctkAbstractLibraryFactory.h @@ -37,11 +37,7 @@ class ctkFactoryLibraryItem : public ctkAbstractFactoryFileBasedItem::const_iterator ConstIterator; @@ -49,7 +45,7 @@ class ctkFactoryLibraryItem : public ctkAbstractFactoryFileBasedItem= 0x50000 #include -#endif //------------------------------------------------------------------------------ /// \ingroup Core @@ -46,11 +44,7 @@ class CTK_CORE_EXPORT ctkErrorLogQtMessageHandler : public ctkErrorLogAbstractMe virtual QString handlerName()const; virtual void setEnabledInternal(bool value); -#if QT_VERSION >= 0x50000 QtMessageHandler SavedQtMessageHandler; -#else - QtMsgHandler SavedQtMessageHandler; -#endif }; #endif diff --git a/Libs/PluginFramework/ctkPluginFramework_global.h b/Libs/PluginFramework/ctkPluginFramework_global.h index c87c444774..ca4393fcac 100644 --- a/Libs/PluginFramework/ctkPluginFramework_global.h +++ b/Libs/PluginFramework/ctkPluginFramework_global.h @@ -34,15 +34,6 @@ typedef QHash ctkProperties; typedef ctkProperties ctkDictionary; -#if QT_VERSION < 0x040700 -#include -template -inline uint qHash(const QSharedPointer& ptr) -{ - return qHash(ptr.data()); -} -#endif - //---------------------------------------------------------------------------- template QStringList getIIDs() diff --git a/Libs/Scripting/Python/Core/Testing/Cpp/ctkAbstractPythonManagerTest.cpp b/Libs/Scripting/Python/Core/Testing/Cpp/ctkAbstractPythonManagerTest.cpp index 75d48da010..1bc76c925a 100644 --- a/Libs/Scripting/Python/Core/Testing/Cpp/ctkAbstractPythonManagerTest.cpp +++ b/Libs/Scripting/Python/Core/Testing/Cpp/ctkAbstractPythonManagerTest.cpp @@ -15,9 +15,6 @@ #include //----------------------------------------------------------------------------- -#if QT_VERSION < 0x040700 - Q_DECLARE_METATYPE(QVariant) -#endif //----------------------------------------------------------------------------- class ctkAbstractPythonManagerTester: public QObject diff --git a/Libs/Testing/ctkTest.h b/Libs/Testing/ctkTest.h index b41b006f60..08effbc257 100644 --- a/Libs/Testing/ctkTest.h +++ b/Libs/Testing/ctkTest.h @@ -34,7 +34,7 @@ int TestObject(int argc, char *argv[]) \ return QTest::qExec(&tc, argc, argv); \ } -#if (QT_VERSION < 0x50000 && QT_GUI_LIB) || (QT_VERSION >= 0x50000 && QT_WIDGETS_LIB) +#if (QT_WIDGETS_LIB) //----------------------------------------------------------------------------- #define CTK_TEST_MAIN(TestObject) \ @@ -62,7 +62,7 @@ int TestObject(int argc, char *argv[]) \ namespace ctkTest { -#if (QT_VERSION < 0x50000 && QT_GUI_LIB) || (QT_VERSION >= 0x50000 && QT_WIDGETS_LIB) +#if (QT_WIDGETS_LIB) // ---------------------------------------------------------------------------- static void mouseEvent(QTest::MouseAction action, QWidget *widget, Qt::MouseButton button, @@ -103,7 +103,7 @@ static void mouseEvent(QTest::MouseAction action, QWidget *widget, Qt::MouseButt #endif -#if (QT_VERSION < 0x50000 && QT_GUI_LIB) || (QT_VERSION >= 0x50000 && QT_WIDGETS_LIB) +#if (QT_WIDGETS_LIB) // ---------------------------------------------------------------------------- inline void mouseMove(QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = Qt::KeyboardModifiers(), diff --git a/Libs/Widgets/Resources/Icons/expand-down.png b/Libs/Widgets/Resources/Icons/expand-down.png deleted file mode 100644 index 859cb5acbbc396d77a44f1f55fe20020c92ae483..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 190 zcmeAS@N?(olHy`uVBq!ia0vp^96-#%!3HEZpRM}<;-owJIx;YR|DNig)WpGT%PfAtr%uP&B4N6T+sVqF1Y6Dah;OXKRQgJIOB_ZJiTavtjSb_tq zd_x7d1B2n8|NrHW%;Y_?zVU~-Nb`-&jztWNEMW|xCh{Hkoj=yhumGxYQa#u(ablrW i2U}O_p(6}TJPhnU%H<&$j~@cfX7F_Nb6Mw<&;$VPpF5ub diff --git a/Libs/Widgets/Resources/Icons/expand-up.png b/Libs/Widgets/Resources/Icons/expand-up.png deleted file mode 100644 index 64f4d24407153cf8376cae2c9f576a16c006fdfe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 181 zcmeAS@N?(olHy`uVBq!ia0vp^96-#%!3HEZpRM}<;-owJIx;YR|DNig)WpGT%PfAtr%uP&B4N6T+sVqF1Y6Dc{?&;zfQgJKk*Z=?a%sk8oO9b4+ zm^l|#Fm(u?IKh@AuOOD-z$)KR!R^q% Z$gs;-fBG$NZ)>2D44$rjF6*2UngHD@Hr)UK diff --git a/Libs/Widgets/Resources/ctkWidgets.qrc b/Libs/Widgets/Resources/ctkWidgets.qrc index 830c7a1918..be1d311eb7 100644 --- a/Libs/Widgets/Resources/ctkWidgets.qrc +++ b/Libs/Widgets/Resources/ctkWidgets.qrc @@ -5,8 +5,6 @@ Icons/unlock.png Icons/minus.png Icons/plus.png - Icons/expand-down.png - Icons/expand-up.png Icons/search.svg Icons/clear2.svg Icons/Languages/ad.png diff --git a/Libs/Widgets/Testing/Cpp/ctkCheckableComboBoxTest1.cpp b/Libs/Widgets/Testing/Cpp/ctkCheckableComboBoxTest1.cpp index f8be02aba7..cdb2a9899d 100644 --- a/Libs/Widgets/Testing/Cpp/ctkCheckableComboBoxTest1.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkCheckableComboBoxTest1.cpp @@ -23,10 +23,6 @@ #include #include -#if (QT_VERSION < 0x50000) -#include -#endif - // CTK includes #include @@ -37,11 +33,6 @@ //----------------------------------------------------------------------------- int ctkCheckableComboBoxTest1(int argc, char * argv [] ) { - // QCleanlooksStyle is the only style that doesn't show the checkboxes by - // default. Test it with it -#if (QT_VERSION < 0x50000) - QApplication::setStyle(new QCleanlooksStyle); -#endif QApplication app(argc, argv); ctkCheckableComboBox comboBox; diff --git a/Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewTest1.cpp b/Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewTest1.cpp index 3ab3a54988..6a09b2233b 100644 --- a/Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewTest1.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewTest1.cpp @@ -76,21 +76,12 @@ int ctkCheckableHeaderViewTest1(int argc, char * argv [] ) model.setHeaderData(0, Qt::Horizontal, static_cast(Qt::Checked), Qt::CheckStateRole); QHeaderView* previousHeaderView = table.horizontalHeader(); -#if (QT_VERSION >= 0x50000) bool oldClickable = previousHeaderView->sectionsClickable(); -#else - bool oldClickable = previousHeaderView->isClickable(); -#endif ctkCheckableHeaderView* headerView = new ctkCheckableHeaderView(Qt::Horizontal, &table); -#if (QT_VERSION >= 0x50000) headerView->setSectionsClickable(oldClickable); headerView->setSectionsMovable(previousHeaderView->sectionsMovable()); -#else - headerView->setClickable(oldClickable); - headerView->setMovable(previousHeaderView->isMovable()); -#endif headerView->setHighlightSections(previousHeaderView->highlightSections()); // propagatetoitems is true by default //headerView->setPropagateToItems(true); @@ -98,21 +89,12 @@ int ctkCheckableHeaderViewTest1(int argc, char * argv [] ) // sets the model to the headerview table.setHorizontalHeader(headerView); -#if (QT_VERSION >= 0x50000) if (headerView->sectionsClickable() != oldClickable) { std::cerr << "ctkCheckableHeaderView::setSectionClickable() failed: " << headerView->sectionsClickable() << std::endl; return EXIT_FAILURE; } -#else - if (headerView->isClickable() != oldClickable) - { - std::cerr << "ctkCheckableHeaderView::setClickable() failed: " - << headerView->isClickable() << std::endl; - return EXIT_FAILURE; - } -#endif // As propagateToItems is true, once the model is set to the headerview, // the checkable header is updated from the check state of all the items // all the items are unchecked by default, so the header becomes unchecked diff --git a/Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewTest2.cpp b/Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewTest2.cpp index 0b4ea1597d..f266d6f9c5 100644 --- a/Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewTest2.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkCheckableHeaderViewTest2.cpp @@ -65,20 +65,11 @@ int ctkCheckableHeaderViewTest2(int argc, char * argv [] ) model.setHeaderData(0, Qt::Horizontal, static_cast(Qt::Checked), Qt::CheckStateRole); QHeaderView* previousHeaderView = view.header(); -#if (QT_VERSION >= 0x50000) bool oldClickable = previousHeaderView->sectionsClickable(); -#else - bool oldClickable = previousHeaderView->isClickable(); -#endif ctkCheckableHeaderView* headerView = new ctkCheckableHeaderView(Qt::Horizontal, &view); -#if (QT_VERSION >= 0x50000) headerView->setSectionsClickable(oldClickable); headerView->setSectionsMovable(previousHeaderView->sectionsMovable()); -#else - headerView->setClickable(oldClickable); - headerView->setMovable(previousHeaderView->isMovable()); -#endif headerView->setHighlightSections(previousHeaderView->highlightSections()); headerView->checkableModelHelper()->setPropagateDepth(-1); headerView->checkableModelHelper()->setForceCheckability(true); diff --git a/Libs/Widgets/Testing/Cpp/ctkColorDialogTest1.cpp b/Libs/Widgets/Testing/Cpp/ctkColorDialogTest1.cpp index 7758bbc20d..527c0acc5b 100644 --- a/Libs/Widgets/Testing/Cpp/ctkColorDialogTest1.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkColorDialogTest1.cpp @@ -90,12 +90,8 @@ int ctkColorDialogTest1(int argc, char * argv [] ) // the following is only in interactive mode if (argc < 2 || QString(argv[1]) != "-I" ) { -#if (QT_VERSION >= 0x50000) bool result = QTest::qWaitForWindowActive(&colorDialog); Q_UNUSED(result); -#else - QTest::qWaitForWindowShown(&colorDialog); -#endif colorDialog.accept(); return EXIT_SUCCESS; } diff --git a/Libs/Widgets/Testing/Cpp/ctkConsoleTest.cpp b/Libs/Widgets/Testing/Cpp/ctkConsoleTest.cpp index 6299291dfe..774ac80a43 100644 --- a/Libs/Widgets/Testing/Cpp/ctkConsoleTest.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkConsoleTest.cpp @@ -44,12 +44,8 @@ void ctkConsoleTester::testShow() { ctkConsole console; console.show(); -#if (QT_VERSION >= 0x50000) bool result = QTest::qWaitForWindowActive(&console); Q_UNUSED(result); -#else - QTest::qWaitForWindowShown(&console); -#endif } // ---------------------------------------------------------------------------- diff --git a/Libs/Widgets/Testing/Cpp/ctkDoubleRangeSliderTest.cpp b/Libs/Widgets/Testing/Cpp/ctkDoubleRangeSliderTest.cpp index c12da3cb0a..db097bbb43 100644 --- a/Libs/Widgets/Testing/Cpp/ctkDoubleRangeSliderTest.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkDoubleRangeSliderTest.cpp @@ -45,12 +45,8 @@ void ctkDoubleRangeSliderTester::testUI() { ctkDoubleRangeSlider slider; slider.show(); -#if (QT_VERSION >= 0x50000) bool result = QTest::qWaitForWindowActive(&slider); Q_UNUSED(result); -#else - QTest::qWaitForWindowShown(&slider); -#endif // qApp->exec(); } diff --git a/Libs/Widgets/Testing/Cpp/ctkDoubleSliderTest.cpp b/Libs/Widgets/Testing/Cpp/ctkDoubleSliderTest.cpp index bd6522e541..d4cf45f878 100644 --- a/Libs/Widgets/Testing/Cpp/ctkDoubleSliderTest.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkDoubleSliderTest.cpp @@ -45,12 +45,8 @@ void ctkDoubleSliderTester::testUI() { ctkDoubleSlider slider; slider.show(); -#if (QT_VERSION >= 0x50000) bool result = QTest::qWaitForWindowActive(&slider); Q_UNUSED(result); -#else - QTest::qWaitForWindowShown(&slider); -#endif // qApp->exec(); } diff --git a/Libs/Widgets/Testing/Cpp/ctkDoubleSpinBoxTest.cpp b/Libs/Widgets/Testing/Cpp/ctkDoubleSpinBoxTest.cpp index 23880226d7..5c69e6304c 100644 --- a/Libs/Widgets/Testing/Cpp/ctkDoubleSpinBoxTest.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkDoubleSpinBoxTest.cpp @@ -84,12 +84,8 @@ void ctkDoubleSpinBoxTester::testUI() spinBox.setPrefix("A: "); spinBox.setSetMode(ctkDoubleSpinBox::SetAlways); spinBox.show(); -#if (QT_VERSION >= 0x50000) bool result = QTest::qWaitForWindowActive(&spinBox); Q_UNUSED(result); -#else - QTest::qWaitForWindowShown(&spinBox); -#endif QObject::connect(&spinBox, SIGNAL(valueChanged(double)), &spinBox, SLOT(setValue(double)), Qt::QueuedConnection); diff --git a/Libs/Widgets/Testing/Cpp/ctkExpandableWidgetTest1.cpp b/Libs/Widgets/Testing/Cpp/ctkExpandableWidgetTest1.cpp index 7ce58332dc..0fb3b68f4d 100644 --- a/Libs/Widgets/Testing/Cpp/ctkExpandableWidgetTest1.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkExpandableWidgetTest1.cpp @@ -30,10 +30,6 @@ #include #include -#if (QT_VERSION < 0x50000) -#include -#endif - // CTK includes #include "ctkExpandableWidget.h" @@ -44,9 +40,6 @@ //----------------------------------------------------------------------------- int ctkExpandableWidgetTest1(int argc, char * argv [] ) { -#if (QT_VERSION < 0x50000) - QApplication::setStyle(new QPlastiqueStyle); -#endif QApplication app(argc, argv); QWidget topLevel; diff --git a/Libs/Widgets/Testing/Cpp/ctkFlatProxyModelTest.cpp b/Libs/Widgets/Testing/Cpp/ctkFlatProxyModelTest.cpp index 4b470a17f9..ba88fce29e 100644 --- a/Libs/Widgets/Testing/Cpp/ctkFlatProxyModelTest.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkFlatProxyModelTest.cpp @@ -32,10 +32,6 @@ #include "ctkModelTester.h" #include "ctkTest.h" -#if QT_VERSION < 0x040700 -Q_DECLARE_METATYPE(QVariant) -#endif - // ---------------------------------------------------------------------------- class ctkFlatProxyModelTester: public QObject { diff --git a/Libs/Widgets/Testing/Cpp/ctkMatrixWidgetTest.cpp b/Libs/Widgets/Testing/Cpp/ctkMatrixWidgetTest.cpp index 8cab3224aa..7fc856e799 100644 --- a/Libs/Widgets/Testing/Cpp/ctkMatrixWidgetTest.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkMatrixWidgetTest.cpp @@ -45,12 +45,8 @@ void ctkMatrixWidgetTester::testUI() matrix.setMaximum(100.); matrix.show(); -#if (QT_VERSION >= 0x50000) bool result = QTest::qWaitForWindowActive(&matrix); Q_UNUSED(result); -#else - QTest::qWaitForWindowShown(&matrix); -#endif //qApp->exec(); } @@ -65,12 +61,8 @@ void ctkMatrixWidgetTester::testDecimals() matrix.show(); -#if (QT_VERSION >= 0x50000) bool result = QTest::qWaitForWindowActive(&matrix); Q_UNUSED(result); -#else - QTest::qWaitForWindowShown(&matrix); -#endif //qApp->exec(); QCOMPARE(matrix.value(0, 0), 1.000000001); diff --git a/Libs/Widgets/Testing/Cpp/ctkPathListWidgetWithButtonsTest.cpp b/Libs/Widgets/Testing/Cpp/ctkPathListWidgetWithButtonsTest.cpp index b28a9597f8..1fde8908d8 100644 --- a/Libs/Widgets/Testing/Cpp/ctkPathListWidgetWithButtonsTest.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkPathListWidgetWithButtonsTest.cpp @@ -67,12 +67,8 @@ void ctkPathListWidgetWithButtonsTester::testButtons() topLevel.layout()->addWidget(&pathListButtons); topLevel.show(); -#if (QT_VERSION >= 0x50000) bool result = QTest::qWaitForWindowActive(&topLevel); Q_UNUSED(result); -#else - QTest::qWaitForWindowShown(&topLevel); -#endif struct CloseModalDialog : public QRunnable { diff --git a/Libs/Widgets/Testing/Cpp/ctkPushButtonTest.cpp b/Libs/Widgets/Testing/Cpp/ctkPushButtonTest.cpp index 82ff21d131..8ba3072e35 100644 --- a/Libs/Widgets/Testing/Cpp/ctkPushButtonTest.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkPushButtonTest.cpp @@ -25,10 +25,6 @@ #include #include -#if (QT_VERSION < 0x50000) -#include -#endif - // CTK includes #include "ctkPushButton.h" #include "ctkTest.h" @@ -125,22 +121,14 @@ public slots: // ---------------------------------------------------------------------------- void ctkPushButtonTester::testDefaults() { -#if (QT_VERSION < 0x50000) - QApplication::setStyle( new QCleanlooksStyle ); -#endif - ctkPushButton button("This is a long text. Click to to see more alignment modes."); QCOMPARE(button.buttonTextAlignment(), Qt::AlignHCenter | Qt::AlignVCenter); QCOMPARE(button.iconAlignment(), Qt::AlignLeft|Qt::AlignVCenter); button.show(); -#if (QT_VERSION >= 0x50000) bool result = QTest::qWaitForWindowActive(&button); Q_UNUSED(result); -#else - QTest::qWaitForWindowShown(&button); -#endif button.setElideMode(Qt::ElideMiddle); diff --git a/Libs/Widgets/Testing/Cpp/ctkRangeSliderTest.cpp b/Libs/Widgets/Testing/Cpp/ctkRangeSliderTest.cpp index 62c2253fef..9ec4643797 100644 --- a/Libs/Widgets/Testing/Cpp/ctkRangeSliderTest.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkRangeSliderTest.cpp @@ -20,9 +20,6 @@ // Qt includes #include -#if (QT_VERSION < 0x50000) -#include -#endif #include #include #include @@ -37,7 +34,6 @@ class ctkRangeSliderTester: public QObject { Q_OBJECT private slots: - void initTestCase(); void testGUIEvents(); void testTooltips(); @@ -50,15 +46,6 @@ private slots: void testGrooveMouseEvents_data(); }; -// ---------------------------------------------------------------------------- -void ctkRangeSliderTester::initTestCase() -{ - // Mouse position on handles does not with with gtk style. -#if (QT_VERSION < 0x50000) - QApplication::setStyle(new QCleanlooksStyle()); -#endif -} - // ---------------------------------------------------------------------------- void ctkRangeSliderTester::testGUIEvents() { @@ -163,12 +150,8 @@ void ctkRangeSliderTester::testHandleMouseEvents() rangeSlider.resize(100 + sliderHandleSize.width(), 20); rangeSlider.show(); -#if (QT_VERSION >= 0x50000) bool result = QTest::qWaitForWindowActive(&rangeSlider); Q_UNUSED(result); -#else - QTest::qWaitForWindowShown(&rangeSlider); -#endif QFETCH(bool, minHandle); QFETCH(bool, symmetricMoves); diff --git a/Libs/Widgets/Testing/Cpp/ctkRangeWidgetTest.cpp b/Libs/Widgets/Testing/Cpp/ctkRangeWidgetTest.cpp index 751424ba03..7c494e5121 100644 --- a/Libs/Widgets/Testing/Cpp/ctkRangeWidgetTest.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkRangeWidgetTest.cpp @@ -58,12 +58,8 @@ void ctkRangeWidgetTester::testUI() { ctkRangeWidget rangeWidget; rangeWidget.show(); -#if (QT_VERSION >= 0x50000) bool result = QTest::qWaitForWindowActive(&rangeWidget); Q_UNUSED(result); -#else - QTest::qWaitForWindowShown(&rangeWidget); -#endif //qApp->exec(); } diff --git a/Libs/Widgets/Testing/Cpp/ctkSearchBoxTest.cpp b/Libs/Widgets/Testing/Cpp/ctkSearchBoxTest.cpp index e94f18e023..3571e75f82 100644 --- a/Libs/Widgets/Testing/Cpp/ctkSearchBoxTest.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkSearchBoxTest.cpp @@ -41,12 +41,8 @@ void ctkSearchBoxTester::testSignals() { ctkSearchBox searchBox; searchBox.show(); -#if (QT_VERSION >= 0x50000) bool result = QTest::qWaitForWindowActive(&searchBox); Q_UNUSED(result); -#else - QTest::qWaitForWindowShown(&searchBox); -#endif QSignalSpy textEditedSpy(&searchBox, SIGNAL(textEdited(QString))); QSignalSpy textChangedSpy(&searchBox, SIGNAL(textChanged(QString))); diff --git a/Libs/Widgets/Testing/Cpp/ctkSliderWidgetTest.cpp b/Libs/Widgets/Testing/Cpp/ctkSliderWidgetTest.cpp index b93d8baee4..4a825b3dd9 100644 --- a/Libs/Widgets/Testing/Cpp/ctkSliderWidgetTest.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkSliderWidgetTest.cpp @@ -66,12 +66,8 @@ void ctkSliderWidgetTester::testUI() slider.setValue(26.2110001); slider.setPrefix("A: "); slider.show(); -#if (QT_VERSION >= 0x50000) bool result = QTest::qWaitForWindowActive(&slider); Q_UNUSED(result); -#else - QTest::qWaitForWindowShown(&slider); -#endif QObject::connect(&slider, SIGNAL(valueChanged(double)), &slider, SLOT(setValue(double)), Qt::QueuedConnection); @@ -165,12 +161,8 @@ void ctkSliderWidgetTester::testDecimalsByShortcuts() slider.setValue( -2.145195007324205 ); slider.show(); -#if (QT_VERSION >= 0x50000) bool result = QTest::qWaitForWindowActive(&slider); Q_UNUSED(result); -#else - QTest::qWaitForWindowShown(&slider); -#endif //qApp->exec(); //QSignalSpy spy(&slider, SIGNAL(decimalsChanged(int))); @@ -191,12 +183,8 @@ void ctkSliderWidgetTester::testValueChangedWithNoTracking() slider.setValue((slider.maximum() + slider.minimum()) / 2); slider.show(); -#if (QT_VERSION >= 0x50000) bool result = QTest::qWaitForWindowActive(&slider); Q_UNUSED(result); -#else - QTest::qWaitForWindowShown(&slider); -#endif slider.setTracking(false); QSignalSpy spy(&slider, SIGNAL(valueChanged(double))); diff --git a/Libs/Widgets/ctkCollapsibleGroupBox.cpp b/Libs/Widgets/ctkCollapsibleGroupBox.cpp index 148e809a68..a82a7635b9 100644 --- a/Libs/Widgets/ctkCollapsibleGroupBox.cpp +++ b/Libs/Widgets/ctkCollapsibleGroupBox.cpp @@ -30,7 +30,6 @@ // CTK includes #include "ctkCollapsibleGroupBox.h" -#if QT_VERSION >= 0x040600 #include "ctkProxyStyle.h" //----------------------------------------------------------------------------- @@ -68,7 +67,6 @@ class ctkCollapsibleGroupBoxStyle:public ctkProxyStyle return this->Superclass::pixelMetric(metric, option, widget); } }; -#endif //----------------------------------------------------------------------------- class ctkCollapsibleGroupBoxPrivate @@ -97,10 +95,8 @@ class ctkCollapsibleGroupBoxPrivate /// setVisible, we track its created state with the variable bool IsStateCreated; -#if QT_VERSION >= 0x040600 /// Pointer to keep track of the proxy style ctkCollapsibleGroupBoxStyle* GroupBoxStyle; -#endif }; //----------------------------------------------------------------------------- @@ -112,9 +108,7 @@ ctkCollapsibleGroupBoxPrivate::ctkCollapsibleGroupBoxPrivate( this->IsStateCreated = false; this->MaxHeight = 0; this->CollapsedHeight = 14; -#if QT_VERSION >= 0x040600 this->GroupBoxStyle = 0; -#endif } //----------------------------------------------------------------------------- @@ -125,19 +119,11 @@ void ctkCollapsibleGroupBoxPrivate::init() QObject::connect(q, SIGNAL(toggled(bool)), q, SLOT(expand(bool))); this->MaxHeight = q->maximumHeight(); -#if QT_VERSION >= 0x040600 QWidget* parent = q->parentWidget(); QStyle* parentStyle = (parent) ? parent->style() : qApp->style(); this->GroupBoxStyle = new ctkCollapsibleGroupBoxStyle(parentStyle, qApp); q->setStyle(this->GroupBoxStyle); this->GroupBoxStyle->ensureBaseStyle(); -#else - this->setStyleSheet( - "ctkCollapsibleGroupBox::indicator:checked{" - "image: url(:/Icons/expand-up.png);}" - "ctkCollapsibleGroupBox::indicator:unchecked{" - "image: url(:/Icons/expand-down.png);}"); -#endif } //----------------------------------------------------------------------------- void ctkCollapsibleGroupBoxPrivate::setChildVisibility(QWidget* childWidget) @@ -238,7 +224,7 @@ void ctkCollapsibleGroupBox::expand(bool _expand) d->setChildVisibility(qobject_cast(childObject)); } } - + if (_expand) { this->setMaximumHeight(d->MaxHeight); @@ -255,53 +241,6 @@ void ctkCollapsibleGroupBox::expand(bool _expand) } } -#if QT_VERSION < 0x040600 -//----------------------------------------------------------------------------- -void ctkCollapsibleGroupBox::paintEvent(QPaintEvent* e) -{ - this->QGroupBox::paintEvent(e); - - QStylePainter paint(this); - QStyleOptionGroupBox option; - initStyleOption(&option); - option.activeSubControls &= ~QStyle::SC_GroupBoxCheckBox; - paint.drawComplexControl(QStyle::CC_GroupBox, option); - -} - -//----------------------------------------------------------------------------- -void ctkCollapsibleGroupBox::mousePressEvent(QMouseEvent *event) -{ - if (event->button() != Qt::LeftButton) { - event->ignore(); - return; - } - // no animation -} - -//----------------------------------------------------------------------------- -void ctkCollapsibleGroupBox::mouseReleaseEvent(QMouseEvent *event) -{ - if (event->button() != Qt::LeftButton) { - event->ignore(); - return; - } - - QStyleOptionGroupBox box; - initStyleOption(&box); - box.activeSubControls &= !QStyle::SC_GroupBoxCheckBox; - QStyle::SubControl released = style()->hitTestComplexControl(QStyle::CC_GroupBox, &box, - event->pos(), this); - bool toggle = this->isCheckable() && (released == QStyle::SC_GroupBoxLabel - || released == QStyle::SC_GroupBoxCheckBox); - if (toggle) - { - this->setChecked(!this->isChecked()); - } -} - -#endif - //----------------------------------------------------------------------------- void ctkCollapsibleGroupBox::childEvent(QChildEvent* c) { diff --git a/Libs/Widgets/ctkCollapsibleGroupBox.h b/Libs/Widgets/ctkCollapsibleGroupBox.h index f5ca80b8cb..3ac0e5092b 100644 --- a/Libs/Widgets/ctkCollapsibleGroupBox.h +++ b/Libs/Widgets/ctkCollapsibleGroupBox.h @@ -48,7 +48,7 @@ class CTK_WIDGETS_EXPORT ctkCollapsibleGroupBox : public QGroupBox ctkCollapsibleGroupBox(QWidget* parent = 0); ctkCollapsibleGroupBox(const QString& title, QWidget* parent = 0); virtual ~ctkCollapsibleGroupBox(); - + /// Utility function to collapse the groupbox /// Collapse(close) the group box if collapse is true, expand(open) /// it otherwise. @@ -79,12 +79,6 @@ protected Q_SLOTS: /// reimplemented for internal reasons virtual void childEvent(QChildEvent*); -#if QT_VERSION < 0x040600 - virtual void paintEvent(QPaintEvent*); - virtual void mousePressEvent(QMouseEvent*); - virtual void mouseReleaseEvent(QMouseEvent*); -#endif - private: Q_DECLARE_PRIVATE(ctkCollapsibleGroupBox); Q_DISABLE_COPY(ctkCollapsibleGroupBox); diff --git a/Libs/Widgets/ctkPixmapIconEngine.h b/Libs/Widgets/ctkPixmapIconEngine.h index 7e47d00cba..dfc816604f 100644 --- a/Libs/Widgets/ctkPixmapIconEngine.h +++ b/Libs/Widgets/ctkPixmapIconEngine.h @@ -24,11 +24,7 @@ #include -#if QT_VERSION >= 0x050000 # include -#else -# include -#endif #include #include @@ -53,11 +49,7 @@ struct ctkPixmapIconEngineEntry /// \ingroup Widgets class CTK_WIDGETS_EXPORT ctkPixmapIconEngine -#if QT_VERSION >= 0x050000 : public QIconEngine -#else - : public QIconEngineV2 -#endif { public: ctkPixmapIconEngine(); @@ -72,11 +64,7 @@ class CTK_WIDGETS_EXPORT ctkPixmapIconEngine // v2 functions QString key() const; -#if QT_VERSION >= 0x050000 QIconEngine *clone() const; -#else - QIconEngineV2 *clone() const; -#endif bool read(QDataStream &in); bool write(QDataStream &out) const; void virtual_hook(int id, void *data); diff --git a/Libs/Widgets/ctkSearchBox.h b/Libs/Widgets/ctkSearchBox.h index 77d8253793..2d0078c01d 100644 --- a/Libs/Widgets/ctkSearchBox.h +++ b/Libs/Widgets/ctkSearchBox.h @@ -47,11 +47,6 @@ class ctkSearchBoxPrivate; class CTK_WIDGETS_EXPORT ctkSearchBox : public QLineEdit { Q_OBJECT -#if QT_VERSION < 0x040700 - /// Qt < 4.7 don't have a placeholderText property, as we need it, we define it - /// manually. - Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText) -#endif /// Show an icon at left side of the line edit, indicating that the text /// field is used to search/filter something. The default is false. Q_PROPERTY(bool showSearchIcon READ showSearchIcon WRITE setShowSearchIcon) @@ -70,10 +65,6 @@ class CTK_WIDGETS_EXPORT ctkSearchBox : public QLineEdit ctkSearchBox(QWidget *parent = 0); virtual ~ctkSearchBox(); -#if QT_VERSION < 0x040700 - QString placeholderText()const; - void setPlaceholderText(const QString& defaultText); -#endif /// False by default void setShowSearchIcon(bool show); bool showSearchIcon()const; diff --git a/Plugins/org.commontk.dah.core/ctkSimpleSoapServer.cpp b/Plugins/org.commontk.dah.core/ctkSimpleSoapServer.cpp index e1ce5c02f7..fdc6659263 100644 --- a/Plugins/org.commontk.dah.core/ctkSimpleSoapServer.cpp +++ b/Plugins/org.commontk.dah.core/ctkSimpleSoapServer.cpp @@ -32,11 +32,7 @@ ctkSimpleSoapServer::ctkSimpleSoapServer(QObject *parent) : } //---------------------------------------------------------------------------- -#if (QT_VERSION < 0x50000) -void ctkSimpleSoapServer::incomingConnection(int socketDescriptor) -#else void ctkSimpleSoapServer::incomingConnection(qintptr socketDescriptor) -#endif { qDebug() << "New incoming connection"; ctkSoapConnectionRunnable* runnable = new ctkSoapConnectionRunnable(socketDescriptor); diff --git a/Plugins/org.commontk.dah.core/ctkSimpleSoapServer.h b/Plugins/org.commontk.dah.core/ctkSimpleSoapServer.h index 3ab34744e8..0b1880aee9 100644 --- a/Plugins/org.commontk.dah.core/ctkSimpleSoapServer.h +++ b/Plugins/org.commontk.dah.core/ctkSimpleSoapServer.h @@ -50,11 +50,7 @@ public Q_SLOTS: protected: -#if (QT_VERSION < 0x50000) - virtual void incomingConnection(int socketDescriptor); -#else virtual void incomingConnection(qintptr socketDescriptor); -#endif }; From 720deca2337f089282a95f2b5ff2e86580213a74 Mon Sep 17 00:00:00 2001 From: James Butler Date: Tue, 25 Jul 2023 21:08:21 -0400 Subject: [PATCH 101/115] ENH: Remove custom CTK Dialog options Qt versions prior to 4.7.0 didn't expose QFileDialog::Options in the public API. CTK began to remove Qt4 support in C++ source files in https://github.com/commontk/CTK/commit/b86197b7ca9fd79c93702a114d87321de7229e7a. --- .../Testing/Cpp/ctkDirectoryButtonTest1.cpp | 12 +----- .../Testing/Cpp/ctkPathLineEditTest1.cpp | 2 +- Libs/Widgets/ctkDirectoryButton.cpp | 20 ---------- Libs/Widgets/ctkDirectoryButton.h | 38 +------------------ Libs/Widgets/ctkPathLineEdit.cpp | 24 ------------ Libs/Widgets/ctkPathLineEdit.h | 32 +--------------- 6 files changed, 6 insertions(+), 122 deletions(-) diff --git a/Libs/Widgets/Testing/Cpp/ctkDirectoryButtonTest1.cpp b/Libs/Widgets/Testing/Cpp/ctkDirectoryButtonTest1.cpp index e08f171603..4c9a0f391e 100644 --- a/Libs/Widgets/Testing/Cpp/ctkDirectoryButtonTest1.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkDirectoryButtonTest1.cpp @@ -55,7 +55,7 @@ int ctkDirectoryButtonTest1(int argc, char * argv [] ) ctkDirectoryButton button4; button4.setElideMode(elideMode); button4.setAcceptMode(QFileDialog::AcceptSave); - button4.setOptions(button4.options() | ctkDirectoryButton::DontUseNativeDialog); + button4.setOptions(button4.options() | QFileDialog::DontUseNativeDialog); QFormLayout* layout = new QFormLayout; @@ -101,17 +101,9 @@ int ctkDirectoryButtonTest1(int argc, char * argv [] ) return EXIT_FAILURE; } -#ifdef USE_QFILEDIALOG_OPTIONS button.setOptions(QFileDialog::ShowDirsOnly | QFileDialog::ReadOnly); if (button.options() != (QFileDialog::ShowDirsOnly | QFileDialog::ReadOnly)) -#else - button.setOptions(ctkDirectoryButton::ShowDirsOnly | - ctkDirectoryButton::ReadOnly); - - if (button.options() != (ctkDirectoryButton::ShowDirsOnly | - ctkDirectoryButton::ReadOnly)) -#endif { std::cerr<< "ctkDirectoryButton::setOptions failed" << std::endl; return EXIT_FAILURE; @@ -152,7 +144,7 @@ int ctkDirectoryButtonTest1(int argc, char * argv [] ) // If Qt uses the default native dialog, a nested event loop won't // be created and app.quit() will have no effect (as it solely quits // event loops). - button.setOptions(button.options() | ctkDirectoryButton::DontUseNativeDialog); + button.setOptions(button.options() | QFileDialog::DontUseNativeDialog); QTimer::singleShot(100, &button, SLOT(browse())); return app.exec(); diff --git a/Libs/Widgets/Testing/Cpp/ctkPathLineEditTest1.cpp b/Libs/Widgets/Testing/Cpp/ctkPathLineEditTest1.cpp index fb06855413..44ec5eb445 100644 --- a/Libs/Widgets/Testing/Cpp/ctkPathLineEditTest1.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkPathLineEditTest1.cpp @@ -113,7 +113,7 @@ int ctkPathLineEditTest1(int argc, char * argv [] ) QTimer::singleShot(100, &button, SLOT(retrieveHistory())); QTimer::singleShot(115, &button2, SLOT(addCurrentPathToHistory())); // The open dialog blocks QTimers (to quit the app). - button3.setOptions(button3.options() | ctkPathLineEdit::DontUseNativeDialog); + button3.setOptions(button3.options() | QFileDialog::DontUseNativeDialog); QTimer::singleShot(120, &button3, SLOT(browse())); return app.exec(); diff --git a/Libs/Widgets/ctkDirectoryButton.cpp b/Libs/Widgets/ctkDirectoryButton.cpp index 85ebc1135b..87ffcae3c3 100644 --- a/Libs/Widgets/ctkDirectoryButton.cpp +++ b/Libs/Widgets/ctkDirectoryButton.cpp @@ -47,11 +47,7 @@ class ctkDirectoryButtonPrivate ctkPushButton* PushButton; QString DialogCaption; QString DisplayText; -#ifdef USE_QFILEDIALOG_OPTIONS QFileDialog::Options DialogOptions; -#else - ctkDirectoryButton::Options DialogOptions; -#endif // TODO expose DisplayAbsolutePath into the API bool DisplayAbsolutePath; QFileDialog::AcceptMode AcceptMode; @@ -61,11 +57,7 @@ class ctkDirectoryButtonPrivate ctkDirectoryButtonPrivate::ctkDirectoryButtonPrivate(ctkDirectoryButton& object) :q_ptr(&object) { -#if USE_QFILEDIALOG_OPTIONS this->DialogOptions = QFileDialog::ShowDirsOnly; -#else - this->DialogOptions = ctkDirectoryButton::ShowDirsOnly; -#endif this->DisplayAbsolutePath = true; this->AcceptMode = QFileDialog::AcceptOpen; } @@ -214,22 +206,14 @@ QIcon ctkDirectoryButton::icon()const } //----------------------------------------------------------------------------- -#ifdef USE_QFILEDIALOG_OPTIONS void ctkDirectoryButton::setOptions(const QFileDialog::Options& dialogOptions) -#else -void ctkDirectoryButton::setOptions(const Options& dialogOptions) -#endif { Q_D(ctkDirectoryButton); d->DialogOptions = dialogOptions; } //----------------------------------------------------------------------------- -#ifdef USE_QFILEDIALOG_OPTIONS const QFileDialog::Options& ctkDirectoryButton::options()const -#else -const ctkDirectoryButton::Options& ctkDirectoryButton::options()const -#endif { Q_D(const ctkDirectoryButton); return d->DialogOptions; @@ -282,11 +266,7 @@ void ctkDirectoryButton::browse() QScopedPointer fileDialog( new ctkFileDialog(this, d->DialogCaption.isEmpty() ? this->toolTip() : d->DialogCaption, d->Directory.path())); - #ifdef USE_QFILEDIALOG_OPTIONS fileDialog->setOptions(d->DialogOptions); - #else - fileDialog->setOptions(QFlags(int(d->DialogOptions))); - #endif fileDialog->setAcceptMode(d->AcceptMode); fileDialog->setFileMode(QFileDialog::Directory); fileDialog->setOption(QFileDialog::ShowDirsOnly, true); diff --git a/Libs/Widgets/ctkDirectoryButton.h b/Libs/Widgets/ctkDirectoryButton.h index ae53a0f03e..bcf99d442a 100644 --- a/Libs/Widgets/ctkDirectoryButton.h +++ b/Libs/Widgets/ctkDirectoryButton.h @@ -31,10 +31,6 @@ #include "ctkWidgetsExport.h" class ctkDirectoryButtonPrivate; -// QFileDialog::Options can be used since Qt 4.7.0 (QT_VERSION >= 0x040700) -// it is disabled to support older Qt versions -//#define USE_QFILEDIALOG_OPTIONS 1 - /// \ingroup Widgets /// ctkDirectoryButton is a QPushButton to select a directory path. /// The absolute path is displayed on the button. When clicked, a @@ -74,32 +70,11 @@ class CTK_WIDGETS_EXPORT ctkDirectoryButton: public QWidget /// requiring lot of horizontal space. Q_PROPERTY(Qt::TextElideMode elideMode READ elideMode WRITE setElideMode) - /// Qt versions prior to 4.7.0 didn't expose QFileDialog::Options in the - /// public API. We need to create a custom property that will be used when + /// This property will be used when /// instantiating a QFileDialog in ctkDirectoryButton::browse() -#ifdef USE_QFILEDIALOG_OPTIONS Q_PROPERTY(QFileDialog::Options options READ options WRITE setOptions) -#else - Q_PROPERTY(Options options READ options WRITE setOptions) - Q_FLAGS(Option Options); -#endif public: -#ifndef USE_QFILEDIALOG_OPTIONS - // Same options than QFileDialog::Options - enum Option - { - ShowDirsOnly = 0x00000001, - DontResolveSymlinks = 0x00000002, - DontConfirmOverwrite = 0x00000004, - DontUseSheet = 0x00000008, - DontUseNativeDialog = 0x00000010, - ReadOnly = 0x00000020, - HideNameFilterDetails = 0x00000040 - }; - Q_DECLARE_FLAGS(Options, Option) -#endif - /// Constructor /// Creates a default ctkDirectoryButton that points to the application /// current directory. @@ -141,13 +116,8 @@ class CTK_WIDGETS_EXPORT ctkDirectoryButton: public QWidget /// Options of the file dialog pop up. /// \sa QFileDialog::getExistingDirectory -#ifdef USE_QFILEDIALOG_OPTIONS void setOptions(const QFileDialog::Options& options); const QFileDialog::Options& options()const; -#else - void setOptions(const Options& options); - const Options& options()const; -#endif /// \sa setAcceptMode QFileDialog::AcceptMode QFileDialog::AcceptMode acceptMode() const; @@ -161,7 +131,7 @@ class CTK_WIDGETS_EXPORT ctkDirectoryButton: public QWidget /// set horizontal policy to QSizePolicy::Ignored and set elideMode to /// Qt::ElideMiddle (or anything else than Qt::ElideNone). void setElideMode(Qt::TextElideMode newMode); - Qt::TextElideMode elideMode()const; + Qt::TextElideMode elideMode()const; public Q_SLOTS: /// browse() opens a pop up where the user can select a new directory for the @@ -190,8 +160,4 @@ public Q_SLOTS: Q_DISABLE_COPY(ctkDirectoryButton); }; -#ifndef USE_QFILEDIALOG_OPTIONS -Q_DECLARE_OPERATORS_FOR_FLAGS(ctkDirectoryButton::Options); -#endif - #endif diff --git a/Libs/Widgets/ctkPathLineEdit.cpp b/Libs/Widgets/ctkPathLineEdit.cpp index 245fdf2d8b..64e6bafe2a 100644 --- a/Libs/Widgets/ctkPathLineEdit.cpp +++ b/Libs/Widgets/ctkPathLineEdit.cpp @@ -277,11 +277,7 @@ class ctkPathLineEditPrivate QString Label; //!< used in file dialogs QStringList NameFilters; //!< Regular expression (in wildcard mode) used to help the user to complete the line QDir::Filters Filters; //!< Type of path (file, dir...) -#ifdef USE_QFILEDIALOG_OPTIONS QFileDialog::Options DialogOptions; -#else - ctkPathLineEdit::Options DialogOptions; -#endif bool HasValidInput; //!< boolean that stores the old state of valid input QString SettingKey; @@ -611,22 +607,14 @@ ctkPathLineEdit::Filters ctkPathLineEdit::filters()const } //----------------------------------------------------------------------------- -#ifdef USE_QFILEDIALOG_OPTIONS void ctkPathLineEdit::setOptions(const QFileDialog::Options& dialogOptions) -#else -void ctkPathLineEdit::setOptions(const Options& dialogOptions) -#endif { Q_D(ctkPathLineEdit); d->DialogOptions = dialogOptions; } //----------------------------------------------------------------------------- -#ifdef USE_QFILEDIALOG_OPTIONS const QFileDialog::Options& ctkPathLineEdit::options()const -#else -const ctkPathLineEdit::Options& ctkPathLineEdit::options()const -#endif { Q_D(const ctkPathLineEdit); return d->DialogOptions; @@ -648,11 +636,7 @@ void ctkPathLineEdit::browse() this->currentPath(), d->NameFilters.join(";;"), 0, -#ifdef USE_QFILEDIALOG_OPTIONS d->DialogOptions); -#else - QFlags(int(d->DialogOptions))); -#endif } else { @@ -663,11 +647,7 @@ void ctkPathLineEdit::browse() this->currentPath(), d->NameFilters.join(";;"), 0, -#ifdef USE_QFILEDIALOG_OPTIONS d->DialogOptions); -#else - QFlags(int(d->DialogOptions))); -#endif } } else //directory @@ -677,11 +657,7 @@ void ctkPathLineEdit::browse() tr("Select a directory..."), this->currentPath().isEmpty() ? ctkPathLineEditPrivate::sCurrentDirectory : this->currentPath(), -#ifdef USE_QFILEDIALOG_OPTIONS d->DialogOptions); -#else - QFlags(int(d->DialogOptions))); -#endif } if (path.isEmpty()) { diff --git a/Libs/Widgets/ctkPathLineEdit.h b/Libs/Widgets/ctkPathLineEdit.h index e51d1d5c47..4590f2aa51 100644 --- a/Libs/Widgets/ctkPathLineEdit.h +++ b/Libs/Widgets/ctkPathLineEdit.h @@ -47,6 +47,7 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. // Qt includes #include +#include #include class QComboBox; @@ -69,15 +70,7 @@ class CTK_WIDGETS_EXPORT ctkPathLineEdit: public QWidget Q_PROPERTY(QString currentPath READ currentPath WRITE setCurrentPath USER true) - /// Qt versions prior to 4.7.0 didn't expose QFileDialog::Options in the - /// public API. We need to create a custom property that will be used when - /// instantiating a QFileDialog in ctkPathLineEdit::browse() -#ifdef USE_QFILEDIALOG_OPTIONS Q_PROPERTY(QFileDialog::Options options READ options WRITE setOptions) -#else - Q_PROPERTY(Options options READ options WRITE setOptions) - Q_FLAGS(Option Options) -#endif /// This property controls the key used to search the settings for recorded /// paths. @@ -143,21 +136,6 @@ class CTK_WIDGETS_EXPORT ctkPathLineEdit: public QWidget }; Q_DECLARE_FLAGS(Filters, Filter) -#ifndef USE_QFILEDIALOG_OPTIONS - // Same options than QFileDialog::Options - enum Option - { - ShowDirsOnly = 0x00000001, - DontResolveSymlinks = 0x00000002, - DontConfirmOverwrite = 0x00000004, - DontUseSheet = 0x00000008, - DontUseNativeDialog = 0x00000010, - ReadOnly = 0x00000020, - HideNameFilterDetails = 0x00000040 - }; - Q_DECLARE_FLAGS(Options, Option) -#endif - enum SizeAdjustPolicy { /// The path line edit will always adjust to the contents. @@ -197,13 +175,8 @@ class CTK_WIDGETS_EXPORT ctkPathLineEdit: public QWidget /// Options of the file dialog pop up. /// \sa QFileDialog::getExistingDirectory -#ifdef USE_QFILEDIALOG_OPTIONS void setOptions(const QFileDialog::Options& options); const QFileDialog::Options& options()const; -#else - void setOptions(const Options& options); - const Options& options()const; -#endif /// Change the current extension of the edit line. /// If there is no extension yet, set it @@ -287,8 +260,5 @@ protected Q_SLOTS: }; Q_DECLARE_OPERATORS_FOR_FLAGS(ctkPathLineEdit::Filters) -#ifndef USE_QFILEDIALOG_OPTIONS -Q_DECLARE_OPERATORS_FOR_FLAGS(ctkPathLineEdit::Options); -#endif #endif // __ctkPathLineEdit_h From ee5508d6eeec882eb39358346c1823b6c0bbe825 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 26 Jul 2023 00:30:52 -0400 Subject: [PATCH 102/115] COMP: Revert removal of custom CTK Dialog options This reverts commit 720deca2337f089282a95f2b5ff2e86580213a74. Considering that ctkDirectoryButton and ctkPathLineEdit both derive from QWidget and user code may use reference to option like ctkPathLineEdit::ShowDirsOnly (instead of QFileDialog::ShowDirsOnly), this reverts the commit. --- .../Testing/Cpp/ctkDirectoryButtonTest1.cpp | 12 +++++- .../Testing/Cpp/ctkPathLineEditTest1.cpp | 2 +- Libs/Widgets/ctkDirectoryButton.cpp | 20 ++++++++++ Libs/Widgets/ctkDirectoryButton.h | 38 ++++++++++++++++++- Libs/Widgets/ctkPathLineEdit.cpp | 24 ++++++++++++ Libs/Widgets/ctkPathLineEdit.h | 32 +++++++++++++++- 6 files changed, 122 insertions(+), 6 deletions(-) diff --git a/Libs/Widgets/Testing/Cpp/ctkDirectoryButtonTest1.cpp b/Libs/Widgets/Testing/Cpp/ctkDirectoryButtonTest1.cpp index 4c9a0f391e..e08f171603 100644 --- a/Libs/Widgets/Testing/Cpp/ctkDirectoryButtonTest1.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkDirectoryButtonTest1.cpp @@ -55,7 +55,7 @@ int ctkDirectoryButtonTest1(int argc, char * argv [] ) ctkDirectoryButton button4; button4.setElideMode(elideMode); button4.setAcceptMode(QFileDialog::AcceptSave); - button4.setOptions(button4.options() | QFileDialog::DontUseNativeDialog); + button4.setOptions(button4.options() | ctkDirectoryButton::DontUseNativeDialog); QFormLayout* layout = new QFormLayout; @@ -101,9 +101,17 @@ int ctkDirectoryButtonTest1(int argc, char * argv [] ) return EXIT_FAILURE; } +#ifdef USE_QFILEDIALOG_OPTIONS button.setOptions(QFileDialog::ShowDirsOnly | QFileDialog::ReadOnly); if (button.options() != (QFileDialog::ShowDirsOnly | QFileDialog::ReadOnly)) +#else + button.setOptions(ctkDirectoryButton::ShowDirsOnly | + ctkDirectoryButton::ReadOnly); + + if (button.options() != (ctkDirectoryButton::ShowDirsOnly | + ctkDirectoryButton::ReadOnly)) +#endif { std::cerr<< "ctkDirectoryButton::setOptions failed" << std::endl; return EXIT_FAILURE; @@ -144,7 +152,7 @@ int ctkDirectoryButtonTest1(int argc, char * argv [] ) // If Qt uses the default native dialog, a nested event loop won't // be created and app.quit() will have no effect (as it solely quits // event loops). - button.setOptions(button.options() | QFileDialog::DontUseNativeDialog); + button.setOptions(button.options() | ctkDirectoryButton::DontUseNativeDialog); QTimer::singleShot(100, &button, SLOT(browse())); return app.exec(); diff --git a/Libs/Widgets/Testing/Cpp/ctkPathLineEditTest1.cpp b/Libs/Widgets/Testing/Cpp/ctkPathLineEditTest1.cpp index 44ec5eb445..fb06855413 100644 --- a/Libs/Widgets/Testing/Cpp/ctkPathLineEditTest1.cpp +++ b/Libs/Widgets/Testing/Cpp/ctkPathLineEditTest1.cpp @@ -113,7 +113,7 @@ int ctkPathLineEditTest1(int argc, char * argv [] ) QTimer::singleShot(100, &button, SLOT(retrieveHistory())); QTimer::singleShot(115, &button2, SLOT(addCurrentPathToHistory())); // The open dialog blocks QTimers (to quit the app). - button3.setOptions(button3.options() | QFileDialog::DontUseNativeDialog); + button3.setOptions(button3.options() | ctkPathLineEdit::DontUseNativeDialog); QTimer::singleShot(120, &button3, SLOT(browse())); return app.exec(); diff --git a/Libs/Widgets/ctkDirectoryButton.cpp b/Libs/Widgets/ctkDirectoryButton.cpp index 87ffcae3c3..85ebc1135b 100644 --- a/Libs/Widgets/ctkDirectoryButton.cpp +++ b/Libs/Widgets/ctkDirectoryButton.cpp @@ -47,7 +47,11 @@ class ctkDirectoryButtonPrivate ctkPushButton* PushButton; QString DialogCaption; QString DisplayText; +#ifdef USE_QFILEDIALOG_OPTIONS QFileDialog::Options DialogOptions; +#else + ctkDirectoryButton::Options DialogOptions; +#endif // TODO expose DisplayAbsolutePath into the API bool DisplayAbsolutePath; QFileDialog::AcceptMode AcceptMode; @@ -57,7 +61,11 @@ class ctkDirectoryButtonPrivate ctkDirectoryButtonPrivate::ctkDirectoryButtonPrivate(ctkDirectoryButton& object) :q_ptr(&object) { +#if USE_QFILEDIALOG_OPTIONS this->DialogOptions = QFileDialog::ShowDirsOnly; +#else + this->DialogOptions = ctkDirectoryButton::ShowDirsOnly; +#endif this->DisplayAbsolutePath = true; this->AcceptMode = QFileDialog::AcceptOpen; } @@ -206,14 +214,22 @@ QIcon ctkDirectoryButton::icon()const } //----------------------------------------------------------------------------- +#ifdef USE_QFILEDIALOG_OPTIONS void ctkDirectoryButton::setOptions(const QFileDialog::Options& dialogOptions) +#else +void ctkDirectoryButton::setOptions(const Options& dialogOptions) +#endif { Q_D(ctkDirectoryButton); d->DialogOptions = dialogOptions; } //----------------------------------------------------------------------------- +#ifdef USE_QFILEDIALOG_OPTIONS const QFileDialog::Options& ctkDirectoryButton::options()const +#else +const ctkDirectoryButton::Options& ctkDirectoryButton::options()const +#endif { Q_D(const ctkDirectoryButton); return d->DialogOptions; @@ -266,7 +282,11 @@ void ctkDirectoryButton::browse() QScopedPointer fileDialog( new ctkFileDialog(this, d->DialogCaption.isEmpty() ? this->toolTip() : d->DialogCaption, d->Directory.path())); + #ifdef USE_QFILEDIALOG_OPTIONS fileDialog->setOptions(d->DialogOptions); + #else + fileDialog->setOptions(QFlags(int(d->DialogOptions))); + #endif fileDialog->setAcceptMode(d->AcceptMode); fileDialog->setFileMode(QFileDialog::Directory); fileDialog->setOption(QFileDialog::ShowDirsOnly, true); diff --git a/Libs/Widgets/ctkDirectoryButton.h b/Libs/Widgets/ctkDirectoryButton.h index bcf99d442a..ae53a0f03e 100644 --- a/Libs/Widgets/ctkDirectoryButton.h +++ b/Libs/Widgets/ctkDirectoryButton.h @@ -31,6 +31,10 @@ #include "ctkWidgetsExport.h" class ctkDirectoryButtonPrivate; +// QFileDialog::Options can be used since Qt 4.7.0 (QT_VERSION >= 0x040700) +// it is disabled to support older Qt versions +//#define USE_QFILEDIALOG_OPTIONS 1 + /// \ingroup Widgets /// ctkDirectoryButton is a QPushButton to select a directory path. /// The absolute path is displayed on the button. When clicked, a @@ -70,11 +74,32 @@ class CTK_WIDGETS_EXPORT ctkDirectoryButton: public QWidget /// requiring lot of horizontal space. Q_PROPERTY(Qt::TextElideMode elideMode READ elideMode WRITE setElideMode) - /// This property will be used when + /// Qt versions prior to 4.7.0 didn't expose QFileDialog::Options in the + /// public API. We need to create a custom property that will be used when /// instantiating a QFileDialog in ctkDirectoryButton::browse() +#ifdef USE_QFILEDIALOG_OPTIONS Q_PROPERTY(QFileDialog::Options options READ options WRITE setOptions) +#else + Q_PROPERTY(Options options READ options WRITE setOptions) + Q_FLAGS(Option Options); +#endif public: +#ifndef USE_QFILEDIALOG_OPTIONS + // Same options than QFileDialog::Options + enum Option + { + ShowDirsOnly = 0x00000001, + DontResolveSymlinks = 0x00000002, + DontConfirmOverwrite = 0x00000004, + DontUseSheet = 0x00000008, + DontUseNativeDialog = 0x00000010, + ReadOnly = 0x00000020, + HideNameFilterDetails = 0x00000040 + }; + Q_DECLARE_FLAGS(Options, Option) +#endif + /// Constructor /// Creates a default ctkDirectoryButton that points to the application /// current directory. @@ -116,8 +141,13 @@ class CTK_WIDGETS_EXPORT ctkDirectoryButton: public QWidget /// Options of the file dialog pop up. /// \sa QFileDialog::getExistingDirectory +#ifdef USE_QFILEDIALOG_OPTIONS void setOptions(const QFileDialog::Options& options); const QFileDialog::Options& options()const; +#else + void setOptions(const Options& options); + const Options& options()const; +#endif /// \sa setAcceptMode QFileDialog::AcceptMode QFileDialog::AcceptMode acceptMode() const; @@ -131,7 +161,7 @@ class CTK_WIDGETS_EXPORT ctkDirectoryButton: public QWidget /// set horizontal policy to QSizePolicy::Ignored and set elideMode to /// Qt::ElideMiddle (or anything else than Qt::ElideNone). void setElideMode(Qt::TextElideMode newMode); - Qt::TextElideMode elideMode()const; + Qt::TextElideMode elideMode()const; public Q_SLOTS: /// browse() opens a pop up where the user can select a new directory for the @@ -160,4 +190,8 @@ public Q_SLOTS: Q_DISABLE_COPY(ctkDirectoryButton); }; +#ifndef USE_QFILEDIALOG_OPTIONS +Q_DECLARE_OPERATORS_FOR_FLAGS(ctkDirectoryButton::Options); +#endif + #endif diff --git a/Libs/Widgets/ctkPathLineEdit.cpp b/Libs/Widgets/ctkPathLineEdit.cpp index 64e6bafe2a..245fdf2d8b 100644 --- a/Libs/Widgets/ctkPathLineEdit.cpp +++ b/Libs/Widgets/ctkPathLineEdit.cpp @@ -277,7 +277,11 @@ class ctkPathLineEditPrivate QString Label; //!< used in file dialogs QStringList NameFilters; //!< Regular expression (in wildcard mode) used to help the user to complete the line QDir::Filters Filters; //!< Type of path (file, dir...) +#ifdef USE_QFILEDIALOG_OPTIONS QFileDialog::Options DialogOptions; +#else + ctkPathLineEdit::Options DialogOptions; +#endif bool HasValidInput; //!< boolean that stores the old state of valid input QString SettingKey; @@ -607,14 +611,22 @@ ctkPathLineEdit::Filters ctkPathLineEdit::filters()const } //----------------------------------------------------------------------------- +#ifdef USE_QFILEDIALOG_OPTIONS void ctkPathLineEdit::setOptions(const QFileDialog::Options& dialogOptions) +#else +void ctkPathLineEdit::setOptions(const Options& dialogOptions) +#endif { Q_D(ctkPathLineEdit); d->DialogOptions = dialogOptions; } //----------------------------------------------------------------------------- +#ifdef USE_QFILEDIALOG_OPTIONS const QFileDialog::Options& ctkPathLineEdit::options()const +#else +const ctkPathLineEdit::Options& ctkPathLineEdit::options()const +#endif { Q_D(const ctkPathLineEdit); return d->DialogOptions; @@ -636,7 +648,11 @@ void ctkPathLineEdit::browse() this->currentPath(), d->NameFilters.join(";;"), 0, +#ifdef USE_QFILEDIALOG_OPTIONS d->DialogOptions); +#else + QFlags(int(d->DialogOptions))); +#endif } else { @@ -647,7 +663,11 @@ void ctkPathLineEdit::browse() this->currentPath(), d->NameFilters.join(";;"), 0, +#ifdef USE_QFILEDIALOG_OPTIONS d->DialogOptions); +#else + QFlags(int(d->DialogOptions))); +#endif } } else //directory @@ -657,7 +677,11 @@ void ctkPathLineEdit::browse() tr("Select a directory..."), this->currentPath().isEmpty() ? ctkPathLineEditPrivate::sCurrentDirectory : this->currentPath(), +#ifdef USE_QFILEDIALOG_OPTIONS d->DialogOptions); +#else + QFlags(int(d->DialogOptions))); +#endif } if (path.isEmpty()) { diff --git a/Libs/Widgets/ctkPathLineEdit.h b/Libs/Widgets/ctkPathLineEdit.h index 4590f2aa51..e51d1d5c47 100644 --- a/Libs/Widgets/ctkPathLineEdit.h +++ b/Libs/Widgets/ctkPathLineEdit.h @@ -47,7 +47,6 @@ MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. // Qt includes #include -#include #include class QComboBox; @@ -70,7 +69,15 @@ class CTK_WIDGETS_EXPORT ctkPathLineEdit: public QWidget Q_PROPERTY(QString currentPath READ currentPath WRITE setCurrentPath USER true) + /// Qt versions prior to 4.7.0 didn't expose QFileDialog::Options in the + /// public API. We need to create a custom property that will be used when + /// instantiating a QFileDialog in ctkPathLineEdit::browse() +#ifdef USE_QFILEDIALOG_OPTIONS Q_PROPERTY(QFileDialog::Options options READ options WRITE setOptions) +#else + Q_PROPERTY(Options options READ options WRITE setOptions) + Q_FLAGS(Option Options) +#endif /// This property controls the key used to search the settings for recorded /// paths. @@ -136,6 +143,21 @@ class CTK_WIDGETS_EXPORT ctkPathLineEdit: public QWidget }; Q_DECLARE_FLAGS(Filters, Filter) +#ifndef USE_QFILEDIALOG_OPTIONS + // Same options than QFileDialog::Options + enum Option + { + ShowDirsOnly = 0x00000001, + DontResolveSymlinks = 0x00000002, + DontConfirmOverwrite = 0x00000004, + DontUseSheet = 0x00000008, + DontUseNativeDialog = 0x00000010, + ReadOnly = 0x00000020, + HideNameFilterDetails = 0x00000040 + }; + Q_DECLARE_FLAGS(Options, Option) +#endif + enum SizeAdjustPolicy { /// The path line edit will always adjust to the contents. @@ -175,8 +197,13 @@ class CTK_WIDGETS_EXPORT ctkPathLineEdit: public QWidget /// Options of the file dialog pop up. /// \sa QFileDialog::getExistingDirectory +#ifdef USE_QFILEDIALOG_OPTIONS void setOptions(const QFileDialog::Options& options); const QFileDialog::Options& options()const; +#else + void setOptions(const Options& options); + const Options& options()const; +#endif /// Change the current extension of the edit line. /// If there is no extension yet, set it @@ -260,5 +287,8 @@ protected Q_SLOTS: }; Q_DECLARE_OPERATORS_FOR_FLAGS(ctkPathLineEdit::Filters) +#ifndef USE_QFILEDIALOG_OPTIONS +Q_DECLARE_OPERATORS_FOR_FLAGS(ctkPathLineEdit::Options); +#endif #endif // __ctkPathLineEdit_h From 9d289be602d36150a680898794890a11fa6946d8 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 27 Jul 2023 02:43:09 -0400 Subject: [PATCH 103/115] COMP: Update ctk_list_to_string to use CMake join implentation if available This addresses the following warning: CMake Deprecation Warning at CMake/ctkListToString.cmake:24 (cmake_policy): The OLD behavior for policy CMP0007 will be removed from a future version of CMake. The cmake-policies(7) manual explains that the OLD behaviors of all policies are deprecated and that a policy should be set to OLD only under specific short-term circumstances. Projects should be ported to the NEW behavior and not rely on setting a policy to OLD. Call Stack (most recent call first): CMake/ctkMacroSetupQt.cmake:158 (ctk_list_to_string) CMakeLists.txt:421 (ctkMacroSetupQt) The `string(JOIN ...)` sub-command was introduced in CMake 3.12. See https://cmake.org/cmake/help/v3.27/command/string.html#join --- CMake/ctkListToString.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMake/ctkListToString.cmake b/CMake/ctkListToString.cmake index c78728cf06..53c6edcf87 100644 --- a/CMake/ctkListToString.cmake +++ b/CMake/ctkListToString.cmake @@ -19,6 +19,11 @@ ########################################################################### function(ctk_list_to_string separator input_list output_string_var) + if(${CMAKE_VERSION} VERSION_EQUAL "3.12" OR ${CMAKE_VERSION} VERSION_GREATER "3.12") + string(JOIN "${separator}" _string ${input_list}) + set(${output_string_var} ${_string} PARENT_SCOPE) + return() + endif() set(_string "") cmake_policy(PUSH) cmake_policy(SET CMP0007 OLD) From 097e00da84f79b55514094b96f9abe5a33ca250c Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 27 Jul 2023 02:44:05 -0400 Subject: [PATCH 104/115] ENH: Display Qt version and Qt components used to configure CTK For example: [...] -- Configuring CTK with Qt 5.15.2 (using modules: Core, Xml, XmlPatterns, Concurrent, Sql, Test, Multimedia, Widgets, OpenGL, UiTools, WebEngineWidgets, Script) [...] --- CMake/ctkMacroSetupQt.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMake/ctkMacroSetupQt.cmake b/CMake/ctkMacroSetupQt.cmake index 37550596d2..4d7c7f1a7e 100644 --- a/CMake/ctkMacroSetupQt.cmake +++ b/CMake/ctkMacroSetupQt.cmake @@ -55,6 +55,13 @@ macro(ctkMacroSetupQt) mark_as_superbuild(CMAKE_PREFIX_PATH) # Qt 5 endif() + set(_major ${Qt5_VERSION_MAJOR}) + set(_minor ${Qt5_VERSION_MINOR}) + set(_patch ${Qt5_VERSION_PATCH}) + + ctk_list_to_string(", " "${CTK_QT5_COMPONENTS}" comma_separated_module_list) + message(STATUS "Configuring CTK with Qt ${_major}.${_minor}.${_patch} (using modules: ${comma_separated_module_list})") + else() message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() From 6d193a41f0ff1046b797d29fb195a571c0909594 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 27 Jul 2023 01:09:50 -0400 Subject: [PATCH 105/115] ENH: Simplify setting of CTK_QT5_COMPONENTS ensuring all CTK variables are set This commit moves the call to "ctkMacroSetupQt()" after all CTK variables have been set based on enabled options. --- CMake/ctkMacroSetupQt.cmake | 6 +++--- CMakeLists.txt | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CMake/ctkMacroSetupQt.cmake b/CMake/ctkMacroSetupQt.cmake index 4d7c7f1a7e..8f9078dfe7 100644 --- a/CMake/ctkMacroSetupQt.cmake +++ b/CMake/ctkMacroSetupQt.cmake @@ -33,17 +33,17 @@ macro(ctkMacroSetupQt) cmake_minimum_required(VERSION 2.8.12) find_package(Qt5 COMPONENTS Core) set(CTK_QT5_COMPONENTS Core Xml XmlPatterns Concurrent Sql Test Multimedia) - if(CTK_ENABLE_Widgets OR CTK_LIB_Widgets OR CTK_LIB_CommandLineModules/Frontend/QtGui OR CTK_BUILD_ALL OR CTK_BUILD_ALL_LIBRARIES) + if(CTK_ENABLE_Widgets OR CTK_LIB_Widgets OR CTK_LIB_CommandLineModules/Frontend/QtGui) list(APPEND CTK_QT5_COMPONENTS Widgets OpenGL UiTools) endif() - if(CTK_LIB_CommandLineModules/Frontend/QtWebKit OR CTK_BUILD_ALL OR CTK_BUILD_ALL_LIBRARIES) + if(CTK_LIB_CommandLineModules/Frontend/QtWebKit) if(TARGET Qt5::WebKitWidgets) list(APPEND CTK_QT5_COMPONENTS WebKitWidgets) else() list(APPEND CTK_QT5_COMPONENTS WebEngineWidgets) endif() endif() - if(CTK_LIB_XNAT/Core OR CTK_BUILD_ALL OR CTK_BUILD_ALL_LIBRARIES) + if(CTK_LIB_XNAT/Core) list(APPEND CTK_QT5_COMPONENTS Script) endif() find_package(Qt5 COMPONENTS ${CTK_QT5_COMPONENTS} REQUIRED) diff --git a/CMakeLists.txt b/CMakeLists.txt index e98c20b37a..6ba2e9c52b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -415,11 +415,6 @@ if(UNIX AND NOT APPLE) endif() endif() -#----------------------------------------------------------------------------- -# QT -# -ctkMacroSetupQt() - #----------------------------------------------------------------------------- # To make options show up in both CTK-SuperBuild and CTK regular build, let's add them # before the SuperBuild script is included @@ -958,6 +953,12 @@ if(CTK_USE_CONTRIBUTED_PLUGINS) endforeach() endif() +#----------------------------------------------------------------------------- +# QT +# +ctkMacroSetupQt() + +#----------------------------------------------------------------------------- include(CMake/ctkBlockCheckDependencies.cmake) #----------------------------------------------------------------------------- From c0c8e41db1318ffab37ffd42aac48bdb72cd8014 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 27 Jul 2023 04:18:56 -0400 Subject: [PATCH 106/115] ENH: Improve setting of CTK_QT5_COMPONENTS based on actual requirements This update was done based on the output of the process documented on the CTK wiki page "Maintenance / Updates of Required Qt Components". See https://github.com/commontk/CTK/wiki/Maintenance#updates-of-required-qt-components See before/after when configuration CTK with default options Before: -- Configuring CTK with Qt 5.15.2 (using modules: Core, Xml, XmlPatterns, Concurrent, Sql, Test, Multimedia) After: -- Configuring CTK with Qt 5.15.2 (using modules: Core, Test) --- CMake/ctkMacroSetupQt.cmake | 81 +++++++++++++++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 4 deletions(-) diff --git a/CMake/ctkMacroSetupQt.cmake b/CMake/ctkMacroSetupQt.cmake index 8f9078dfe7..b7e53fed50 100644 --- a/CMake/ctkMacroSetupQt.cmake +++ b/CMake/ctkMacroSetupQt.cmake @@ -32,20 +32,93 @@ macro(ctkMacroSetupQt) if(CTK_QT_VERSION VERSION_EQUAL "5") cmake_minimum_required(VERSION 2.8.12) find_package(Qt5 COMPONENTS Core) - set(CTK_QT5_COMPONENTS Core Xml XmlPatterns Concurrent Sql Test Multimedia) - if(CTK_ENABLE_Widgets OR CTK_LIB_Widgets OR CTK_LIB_CommandLineModules/Frontend/QtGui) - list(APPEND CTK_QT5_COMPONENTS Widgets OpenGL UiTools) + + set(CTK_QT5_COMPONENTS Core) + + # See https://github.com/commontk/CTK/wiki/Maintenance#updates-of-required-qt-components + + if(CTK_LIB_Widgets + OR CTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTXML + ) + list(APPEND CTK_QT5_COMPONENTS Xml) + endif() + + if(CTK_APP_ctkCommandLineModuleExplorer + OR CTK_LIB_CommandLineModules/Core + OR CTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTXMLPATTERNS + ) + list(APPEND CTK_QT5_COMPONENTS XmlPatterns) + endif() + + if(CTK_APP_ctkCommandLineModuleExplorer + OR CTK_LIB_CommandLineModules/Core + OR CTK_LIB_PluginFramework + OR CTK_PLUGIN_org.commontk.eventadmin + ) + list(APPEND CTK_QT5_COMPONENTS Concurrent) + endif() + + if(CTK_LIB_DICOM/Core + OR CTK_LIB_DICOM/Widgets + OR Libs/PluginFramework + ) + list(APPEND CTK_QT5_COMPONENTS Sql) + endif() + + if(BUILD_TESTING) + list(APPEND CTK_QT5_COMPONENTS Test) + endif() + + if(CTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTMULTIMEDIA) + list(APPEND CTK_QT5_COMPONENTS Multimedia) endif() - if(CTK_LIB_CommandLineModules/Frontend/QtWebKit) + + if(CTK_ENABLE_Widgets + OR CTK_LIB_Widgets + OR CTK_LIB_CommandLineModules/Frontend/QtGui + OR CTK_LIB_QtTesting + ) + list(APPEND CTK_QT5_COMPONENTS Widgets) + endif() + + if(CTK_LIB_Widgets) + list(APPEND CTK_QT5_COMPONENTS OpenGL) + endif() + + if(CTK_APP_ctkCommandLineModuleExplorer + OR CTK_LIB_CommandLineModules/Frontend/QtGui + OR CTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTUITOOLS + ) + list(APPEND CTK_QT5_COMPONENTS UiTools) + endif() + + if(CTK_LIB_CommandLineModules/Frontend/QtWebKit + OR CTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTWEBKIT + OR CTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTWEBKITWIDGETS + ) if(TARGET Qt5::WebKitWidgets) list(APPEND CTK_QT5_COMPONENTS WebKitWidgets) else() list(APPEND CTK_QT5_COMPONENTS WebEngineWidgets) endif() endif() + if(CTK_LIB_XNAT/Core) list(APPEND CTK_QT5_COMPONENTS Script) endif() + + if(CTK_BUILD_QTDESIGNER_PLUGINS) + list(APPEND CTK_QT5_COMPONENTS Designer) + endif() + + if(CTK_LIB_XNAT/Core + OR CTK_PLUGIN_org.commontk.dah.core + OR CTK_PLUGIN_org.commontk.dah.host + OR CTK_PLUGIN_org.commontk.dah.hostedapp + ) + list(APPEND CTK_QT5_COMPONENTS Network) + endif() + find_package(Qt5 COMPONENTS ${CTK_QT5_COMPONENTS} REQUIRED) mark_as_superbuild(Qt5_DIR) # Qt 5 From dc0d7eb5591e03f8da38085d285b580d59112791 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 27 Jul 2023 22:58:40 -0400 Subject: [PATCH 107/115] COMP: Fix CTK QtTesting library build This commit fixes a regression introduced in c0c8e41db (ENH: Improve setting of CTK_QT5_COMPONENTS based on actual requirements) adding XmlPatterns as a requirement if CTK_LIB_QtTesting is enabled. --- CMake/ctkMacroSetupQt.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/CMake/ctkMacroSetupQt.cmake b/CMake/ctkMacroSetupQt.cmake index b7e53fed50..3ee9035651 100644 --- a/CMake/ctkMacroSetupQt.cmake +++ b/CMake/ctkMacroSetupQt.cmake @@ -44,6 +44,7 @@ macro(ctkMacroSetupQt) endif() if(CTK_APP_ctkCommandLineModuleExplorer + OR CTK_LIB_QtTesting OR CTK_LIB_CommandLineModules/Core OR CTK_LIB_Scripting/Python/Core_PYTHONQT_WRAP_QTXMLPATTERNS ) From 5657c58a72c2db3e9fcc04f88211859eccd21067 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Mon, 31 Jul 2023 09:10:29 -0400 Subject: [PATCH 108/115] ENH: Update ExternalProjectDependency based on commontk/Artichoke@dff357a List of changes: $ git shortlog ea920eb..dff357a --no-merges Jean-Christophe Fillion-Robin (5): ci: Add GitHub Actions based workflow ci: Exclude "IncludeDependencies-DifferentGenerator-Test" with CMake 2.8.x DOC: Update README adding GitHub Actions badge ci: cancel in-progress GitHub Actions workflow on repeated pushes ExternalProjectDependency: Set DOWNLOAD_EXTRACT_TIMESTAMP to 1 if CMake >= 3.24 --- CMake/ctkMacroCheckExternalProjectDependency.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMake/ctkMacroCheckExternalProjectDependency.cmake b/CMake/ctkMacroCheckExternalProjectDependency.cmake index 73dc01ca92..872ee8490a 100644 --- a/CMake/ctkMacroCheckExternalProjectDependency.cmake +++ b/CMake/ctkMacroCheckExternalProjectDependency.cmake @@ -525,6 +525,10 @@ function(_sb_get_external_project_arguments proj varname) ) endforeach() endif() + if(CMAKE_VERSION VERSION_EQUAL "3.24" OR CMAKE_VERSION VERSION_GREATER "3.24") + # See https://cmake.org/cmake/help/latest/policy/CMP0135.html + list(APPEND _ep_arguments DOWNLOAD_EXTRACT_TIMESTAMP 1) + endif() set(${varname} ${_ep_arguments} PARENT_SCOPE) endfunction() From b9ef9b8aa1938676ce0ac105a3deb0e1bfc235a1 Mon Sep 17 00:00:00 2001 From: Csaba Pinter Date: Mon, 18 Sep 2023 20:46:00 +0100 Subject: [PATCH 109/115] BUG: Make sure the delete DICOM object dialog is not too tall When deleting many patients (or studies or series) it can occur that the confirmation dialog that is created with all the deleted object names is taller than the screen height, so the buttons are cut off and not available. This commit ensures that the said dialog cannot be higher than the DICOM browser. Note that the height of one row is calculated from the first row height in the patients table, which may not be the same as the height of a row in the label that shows the deleted item names. This is implemented like this for simplicity, however, since the table row is typically somewhat higher than a line in the label, it is safe. --- Libs/DICOM/Widgets/ctkDICOMBrowser.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp b/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp index 344810e1f7..22dda34897 100644 --- a/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp @@ -1092,10 +1092,29 @@ bool ctkDICOMBrowser::confirmDeleteSelectedUIDs(QStringList uids) ctkMessageBox confirmDeleteDialog; QString message = tr("Do you want to delete the following selected items?"); + // calculate maximum number of rows that fit in the browser widget to have a reasonable limit + // on the items to show in the dialog + int browserHeight = this->geometry().height(); + int patientsTableRowHeight = d->dicomTableManager->patientsTable()->tableView()->rowHeight(0); + int maxNumberOfPatientsToShow = browserHeight / patientsTableRowHeight - 3; // subtract 3 due to the checkbox, buttons, and header + if (maxNumberOfPatientsToShow < 3) + { + // make sure there are a meaningful number of items shown + maxNumberOfPatientsToShow = 3; + } + // add the information about the selected UIDs int numUIDs = uids.size(); for (int i = 0; i < numUIDs; ++i) { + if (i >= maxNumberOfPatientsToShow && numUIDs > maxNumberOfPatientsToShow + 1) + { + // displayed when there are additional DICOM items to delete that do not fit on screen + // note: do not show this message if there is only one more to show (the message also takes a line) + message += QString("\n") + tr("(and %1 more)").arg(numUIDs - maxNumberOfPatientsToShow); + break; + } + QString uid = uids.at(i); // try using the given UID to find a descriptive string From 8e536f239ea58a6feb11968002e742684fed0f97 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 25 Oct 2023 14:33:09 -0400 Subject: [PATCH 110/115] COMP: Fix CTK PluginFramework library build Follow-up c0c8e41db (ENH: Improve setting of CTK_QT5_COMPONENTS based on actual requirements) fixing the check adding Sql to the list of components when CTK_ENABLE_PluginFramework Reported-by: XXOO9 <75569891+XXOO9@users.noreply.github.com> --- CMake/ctkMacroSetupQt.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMake/ctkMacroSetupQt.cmake b/CMake/ctkMacroSetupQt.cmake index 3ee9035651..38e4c2f894 100644 --- a/CMake/ctkMacroSetupQt.cmake +++ b/CMake/ctkMacroSetupQt.cmake @@ -61,7 +61,7 @@ macro(ctkMacroSetupQt) if(CTK_LIB_DICOM/Core OR CTK_LIB_DICOM/Widgets - OR Libs/PluginFramework + OR CTK_LIB_PluginFramework ) list(APPEND CTK_QT5_COMPONENTS Sql) endif() From b76c386d34994316f801578a6de108f21df0ee20 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 25 Oct 2023 15:01:45 -0400 Subject: [PATCH 111/115] COMP: Fix configuration without explicitly setting CTK_QT_VERSION Address a regression introduced in a0e74a080 (COMP: Update CMake files removing support for Qt 4.x) by fixing the following error reported when configuring without explicitly setting CTK_QT_VERSION: ``` cmake \ -DQt5_DIR:PATH=$Qt5_DIR \ -DCMAKE_BUILD_TYPE:STRING=Release \ ../CTK [...] -- Checking if --no-as-needed linker flag is required - no -- CTK_LIB_Core_WITH_BFD_SHARED is OFF -- CTK_LIB_Core_WITH_BFD_STATIC is OFF CMake Error at Libs/Visualization/VTK/Widgets/target_libraries.cmake:15 (message): Support for this Qt is not implemented Call Stack (most recent call first): CMake/ctkMacroTargetLibraries.cmake:131 (include) CMake/ctkFunctionGenerateDGraphInput.cmake:78 (ctkFunctionCollectTargetLibraryNames) CMakeLists.txt:844 (ctkFunctionGenerateDGraphInput) [...] ``` --- CMake/ctkMacroSetupQt.cmake | 10 ---------- CMakeLists.txt | 8 ++++++++ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/CMake/ctkMacroSetupQt.cmake b/CMake/ctkMacroSetupQt.cmake index 38e4c2f894..cfd93cf345 100644 --- a/CMake/ctkMacroSetupQt.cmake +++ b/CMake/ctkMacroSetupQt.cmake @@ -20,14 +20,6 @@ #! \ingroup CMakeUtilities macro(ctkMacroSetupQt) - set(CTK_QT_VERSION "5" CACHE STRING "Expected Qt version") - mark_as_advanced(CTK_QT_VERSION) - - set_property(CACHE CTK_QT_VERSION PROPERTY STRINGS 5) - - if(NOT CTK_QT_VERSION VERSION_EQUAL "5") - message(FATAL_ERROR "Expected value for CTK_QT_VERSION is '5'") - endif() if(CTK_QT_VERSION VERSION_EQUAL "5") cmake_minimum_required(VERSION 2.8.12) @@ -139,6 +131,4 @@ macro(ctkMacroSetupQt) else() message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented") endif() - - mark_as_superbuild(CTK_QT_VERSION) endmacro() diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ba2e9c52b..8256a4e873 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,6 +102,14 @@ mark_as_superbuild( option(CTK_SUPERBUILD "Build ${PROJECT_NAME} and the projects it depends on." ON) mark_as_advanced(CTK_SUPERBUILD) +#----------------------------------------------------------------------------- +# Qt version +# +set(CTK_QT_VERSION "5" CACHE STRING "Expected Qt version") +mark_as_advanced(CTK_QT_VERSION) +set_property(CACHE CTK_QT_VERSION PROPERTY STRINGS 5) +mark_as_superbuild(CTK_QT_VERSION) + #----------------------------------------------------------------------------- # Output directories. # From c57612f76b7743b76878be73aaea27936ee1d7c5 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 25 Oct 2023 15:32:17 -0400 Subject: [PATCH 112/115] COMP: Fix CMake 3.26 warning in ctkLinkerAsNeededFlagCheck project Starting with CMake 2.26, a warning is reported if "cmake_minimum_required()" is not called before the "project()" command. See https://cmake.org/cmake/help/v3.26/release/3.26.html#other-changes It fixes the following warning: ``` CMake Warning (dev) at /path/to/CTK/CMake/ctkLinkerAsNeededFlagCheck/CMakeLists.txt:1 (project): cmake_minimum_required() should be called prior to this top-level project() call. Please see the cmake-commands(7) manual for usage documentation of both commands. This warning is for project developers. Use -Wno-dev to suppress it. ``` --- CMake/ctkLinkerAsNeededFlagCheck/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMake/ctkLinkerAsNeededFlagCheck/CMakeLists.txt b/CMake/ctkLinkerAsNeededFlagCheck/CMakeLists.txt index 0191c1cb4b..c9666ad328 100644 --- a/CMake/ctkLinkerAsNeededFlagCheck/CMakeLists.txt +++ b/CMake/ctkLinkerAsNeededFlagCheck/CMakeLists.txt @@ -1,3 +1,4 @@ +cmake_minimum_required(VERSION 3.0 FATAL_ERROR) project(ctkLinkerAsNeededFlagCheck) add_library(A SHARED A.cpp) add_library(B SHARED B.cpp) From 4888deb1d7f2e72b5458182da1a54369e5e52887 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 25 Oct 2023 16:01:04 -0400 Subject: [PATCH 113/115] COMP: Add install rules for PluginFramework CMake modules Co-authored-by: louwei --- CMake/CTKConfig.cmake.in | 8 +++++--- CMakeLists.txt | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/CMake/CTKConfig.cmake.in b/CMake/CTKConfig.cmake.in index 908f241eef..9b51363c3a 100644 --- a/CMake/CTKConfig.cmake.in +++ b/CMake/CTKConfig.cmake.in @@ -63,17 +63,19 @@ include("${CTK_CMAKE_DIR}/ctkMacroTargetLibraries.cmake") # Import multiple macr include("${CTK_CMAKE_DIR}/ctkFunctionExtractOptionNameAndValue.cmake") include("${CTK_CMAKE_DIR}/ctkMacroValidateBuildOptions.cmake") include("${CTK_CMAKE_DIR}/ctkFunctionGenerateDGraphInput.cmake") +include("${CTK_CMAKE_DIR}/ctkFunctionGetIncludeDirs.cmake") +include("${CTK_CMAKE_DIR}/ctkFunctionGetLibraryDirs.cmake") +include("${CTK_CMAKE_DIR}/ctkMacroGenerateMocs.cmake") + +# PluginFramework include("${CTK_CMAKE_DIR}/ctkFunctionGeneratePluginManifest.cmake") include("${CTK_CMAKE_DIR}/ctkFunctionGeneratePluginUseFile.cmake") include("${CTK_CMAKE_DIR}/ctkMacroGeneratePluginResourceFile.cmake") -include("${CTK_CMAKE_DIR}/ctkFunctionGetIncludeDirs.cmake") -include("${CTK_CMAKE_DIR}/ctkFunctionGetLibraryDirs.cmake") include("${CTK_CMAKE_DIR}/ctkFunctionExtractPluginTargets.cmake") include("${CTK_CMAKE_DIR}/ctkFunctionGetAllPluginTargets.cmake") include("${CTK_CMAKE_DIR}/ctkFunctionGetTargetDependencies.cmake") include("${CTK_CMAKE_DIR}/ctkFunctionGetPluginDependencies.cmake") include("${CTK_CMAKE_DIR}/ctkMacroSetupPlugins.cmake") -include("${CTK_CMAKE_DIR}/ctkMacroGenerateMocs.cmake") include(CMakeFindDependencyMacro) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8256a4e873..a2777f6a52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1139,6 +1139,23 @@ endif() # add_subdirectory( Documentation ) +#--------------------------------------------------------------------------- +# Install rules +# +foreach(file + # PluginFramework + CMake/ctkFunctionGeneratePluginManifest.cmake + CMake/ctkFunctionGeneratePluginUseFile.cmake + CMake/ctkMacroGeneratePluginResourceFile.cmake + CMake/ctkFunctionExtractPluginTargets.cmake + CMake/ctkFunctionGetAllPluginTargets.cmake + CMake/ctkFunctionGetTargetDependencies.cmake + CMake/ctkFunctionGetPluginDependencies.cmake + CMake/ctkMacroSetupPlugins.cmake + ) + install(FILES ${file} DESTINATION ${CTK_INSTALL_CMAKE_DIR} COMPONENT Development) +endforeach() + #----------------------------------------------------------------------------- # The commands in this directory are intended to be executed as # the end of the whole configuration process, as a "last step". From d63ebcfc581e4a80ddc7d30e09a1d9495731a6d7 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Sun, 29 Oct 2023 14:05:56 -0400 Subject: [PATCH 114/115] STYLE: Add missing override keyword to ctkVTK(Render|Slice)View classes --- Libs/Visualization/VTK/Widgets/ctkVTKRenderView.h | 2 +- Libs/Visualization/VTK/Widgets/ctkVTKRenderView_p.h | 4 ++-- Libs/Visualization/VTK/Widgets/ctkVTKSliceView.h | 6 +++--- Libs/Visualization/VTK/Widgets/ctkVTKSliceView_p.h | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKRenderView.h b/Libs/Visualization/VTK/Widgets/ctkVTKRenderView.h index 2f2ce2c09e..c82458a930 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKRenderView.h +++ b/Libs/Visualization/VTK/Widgets/ctkVTKRenderView.h @@ -145,7 +145,7 @@ public Q_SLOTS: /// Set window interactor /// Reimplemented to propagate interaction to Orientation widget - virtual void setInteractor(vtkRenderWindowInteractor* interactor); + void setInteractor(vtkRenderWindowInteractor* interactor) override; /// Return pitch, roll or yaw increment (in degree) double pitchRollYawIncrement()const; diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKRenderView_p.h b/Libs/Visualization/VTK/Widgets/ctkVTKRenderView_p.h index bc2695d63f..bda5088ab7 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKRenderView_p.h +++ b/Libs/Visualization/VTK/Widgets/ctkVTKRenderView_p.h @@ -52,8 +52,8 @@ class ctkVTKRenderViewPrivate : public ctkVTKAbstractViewPrivate ctkVTKRenderViewPrivate(ctkVTKRenderView& object); /// Convenient setup methods - virtual void setupCornerAnnotation(); - virtual void setupRendering(); + void setupCornerAnnotation() override; + void setupRendering() override; void zoom(double zoomFactor); diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.h b/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.h index 4d4d85a44f..dff19ce135 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.h +++ b/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.h @@ -71,11 +71,11 @@ class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKSliceView : public ctkVTKAbstra /// Set background color /// \sa vtkLightBoxRendererManager::SetBackgroundColor - virtual void setBackgroundColor(const QColor& newBackgroundColor); + void setBackgroundColor(const QColor& newBackgroundColor) override; /// Get background color /// \sa setBackgroundColor(); - virtual QColor backgroundColor()const; + QColor backgroundColor()const override; /// Get highlightedBox color /// \sa setHighlightedBoxColor(); @@ -133,7 +133,7 @@ public Q_SLOTS: void resized(const QSize& size); protected: - virtual bool eventFilter(QObject *object, QEvent *event); + bool eventFilter(QObject *object, QEvent *event) override; private: Q_DECLARE_PRIVATE(ctkVTKSliceView); diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKSliceView_p.h b/Libs/Visualization/VTK/Widgets/ctkVTKSliceView_p.h index 8f9812b001..c3148e0031 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKSliceView_p.h +++ b/Libs/Visualization/VTK/Widgets/ctkVTKSliceView_p.h @@ -48,8 +48,8 @@ class ctkVTKSliceViewPrivate : public ctkVTKAbstractViewPrivate ctkVTKSliceViewPrivate(ctkVTKSliceView&); /// Convenient setup methods - void setupCornerAnnotation(); - void setupRendering(); + void setupCornerAnnotation() override; + void setupRendering() override; vtkSmartPointer LightBoxRendererManager; bool RenderPending; From f53820a4e6ebfc9649897577a6157d94833e9699 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Sun, 29 Oct 2023 14:42:13 -0400 Subject: [PATCH 115/115] ENH: Ensure virtual functions can be called from derived ctkVTK view pimpl Add protected constructor to ctkVTKRenderView and ctkVTKSliceView for associating a derived pimpl. This is required to have the complete virtual function chain executed when virtual function are called in the pimpl init() function. --- .../VTK/Widgets/ctkVTKAbstractView.cpp | 3 ++ .../VTK/Widgets/ctkVTKAbstractView_p.h | 1 + .../VTK/Widgets/ctkVTKRenderView.cpp | 28 +++++++++++++++---- .../VTK/Widgets/ctkVTKRenderView.h | 3 ++ .../VTK/Widgets/ctkVTKRenderView_p.h | 4 ++- .../VTK/Widgets/ctkVTKSliceView.cpp | 21 +++++++++++++- .../VTK/Widgets/ctkVTKSliceView.h | 1 + .../VTK/Widgets/ctkVTKSliceView_p.h | 6 +++- 8 files changed, 59 insertions(+), 8 deletions(-) diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.cpp b/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.cpp index 965108b671..2a44ce1991 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.cpp +++ b/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.cpp @@ -64,6 +64,9 @@ ctkVTKAbstractViewPrivate::ctkVTKAbstractViewPrivate(ctkVTKAbstractView& object) this->PauseRenderCount = 0; } +// -------------------------------------------------------------------------- +ctkVTKAbstractViewPrivate::~ctkVTKAbstractViewPrivate() = default; + // -------------------------------------------------------------------------- void ctkVTKAbstractViewPrivate::init() { diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView_p.h b/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView_p.h index 76693d7508..e2f9ff863f 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView_p.h +++ b/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView_p.h @@ -52,6 +52,7 @@ class ctkVTKAbstractViewPrivate : public QObject public: ctkVTKAbstractViewPrivate(ctkVTKAbstractView& object); + virtual ~ctkVTKAbstractViewPrivate(); /// Convenient setup methods virtual void init(); diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKRenderView.cpp b/Libs/Visualization/VTK/Widgets/ctkVTKRenderView.cpp index 620bccc95c..0ce88a8f16 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKRenderView.cpp +++ b/Libs/Visualization/VTK/Widgets/ctkVTKRenderView.cpp @@ -60,6 +60,21 @@ ctkVTKRenderViewPrivate::ctkVTKRenderViewPrivate(ctkVTKRenderView& object) this->Orientation->SetOrientationMarker(this->Axes); } +// -------------------------------------------------------------------------- +ctkVTKRenderViewPrivate::~ctkVTKRenderViewPrivate() = default; + +// -------------------------------------------------------------------------- +void ctkVTKRenderViewPrivate::init() +{ + this->ctkVTKAbstractViewPrivate::init(); + + // The interactor in RenderWindow exists after the renderwindow is set to + // the QVTKWidet + this->Orientation->SetInteractor(this->RenderWindow->GetInteractor()); + this->Orientation->SetEnabled(1); + this->Orientation->InteractiveOff(); +} + // -------------------------------------------------------------------------- void ctkVTKRenderViewPrivate::setupCornerAnnotation() { @@ -204,18 +219,21 @@ ctkVTKRenderView::ctkVTKRenderView(QWidget* parentWidget) { Q_D(ctkVTKRenderView); d->init(); +} - // The interactor in RenderWindow exists after the renderwindow is set to - // the QVTKWidet - d->Orientation->SetInteractor(d->RenderWindow->GetInteractor()); - d->Orientation->SetEnabled(1); - d->Orientation->InteractiveOff(); +// -------------------------------------------------------------------------- +ctkVTKRenderView::ctkVTKRenderView(ctkVTKRenderViewPrivate* pimpl, QWidget* parentWidget) + : Superclass(pimpl, parentWidget) +{ + // derived classes must call init manually. Calling init() here may results in + // actions on a derived public class not yet finished to be created } //---------------------------------------------------------------------------- ctkVTKRenderView::~ctkVTKRenderView() { } + //---------------------------------------------------------------------------- void ctkVTKRenderView::setInteractor(vtkRenderWindowInteractor* newInteractor) { diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKRenderView.h b/Libs/Visualization/VTK/Widgets/ctkVTKRenderView.h index c82458a930..73273593a0 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKRenderView.h +++ b/Libs/Visualization/VTK/Widgets/ctkVTKRenderView.h @@ -186,6 +186,9 @@ public Q_SLOTS: /// Return zoom factor double zoomFactor()const; +protected: + ctkVTKRenderView(ctkVTKRenderViewPrivate* pimpl, QWidget* parent); + private: Q_DECLARE_PRIVATE(ctkVTKRenderView); Q_DISABLE_COPY(ctkVTKRenderView); diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKRenderView_p.h b/Libs/Visualization/VTK/Widgets/ctkVTKRenderView_p.h index bda5088ab7..d03b572beb 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKRenderView_p.h +++ b/Libs/Visualization/VTK/Widgets/ctkVTKRenderView_p.h @@ -43,15 +43,17 @@ class vtkRenderWindowInteractor; //----------------------------------------------------------------------------- /// \ingroup Visualization_VTK_Widgets -class ctkVTKRenderViewPrivate : public ctkVTKAbstractViewPrivate +class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKRenderViewPrivate : public ctkVTKAbstractViewPrivate { Q_OBJECT Q_DECLARE_PUBLIC(ctkVTKRenderView); public: ctkVTKRenderViewPrivate(ctkVTKRenderView& object); + virtual ~ctkVTKRenderViewPrivate(); /// Convenient setup methods + void init() override; void setupCornerAnnotation() override; void setupRendering() override; diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.cpp b/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.cpp index eadd1e0706..b1aea4c146 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.cpp +++ b/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.cpp @@ -50,6 +50,18 @@ ctkVTKSliceViewPrivate::ctkVTKSliceViewPrivate(ctkVTKSliceView& object) this->OverlayRenderer = vtkSmartPointer::New(); } +// -------------------------------------------------------------------------- +ctkVTKSliceViewPrivate::~ctkVTKSliceViewPrivate() = default; + +// -------------------------------------------------------------------------- +void ctkVTKSliceViewPrivate::init() +{ + Q_Q(ctkVTKSliceView); + this->ctkVTKAbstractViewPrivate::init(); + + q->VTKWidget()->installEventFilter(q); +} + // -------------------------------------------------------------------------- void ctkVTKSliceViewPrivate::setupCornerAnnotation() { @@ -100,7 +112,14 @@ ctkVTKSliceView::ctkVTKSliceView(QWidget* parentWidget) { Q_D(ctkVTKSliceView); d->init(); - this->VTKWidget()->installEventFilter(this); +} + +// -------------------------------------------------------------------------- +ctkVTKSliceView::ctkVTKSliceView(ctkVTKSliceViewPrivate* pimpl, QWidget* parentWidget) + : Superclass(pimpl, parentWidget) +{ + // derived classes must call init manually. Calling init() here may results in + // actions on a derived public class not yet finished to be created } // -------------------------------------------------------------------------- diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.h b/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.h index dff19ce135..6d5ad29b37 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.h +++ b/Libs/Visualization/VTK/Widgets/ctkVTKSliceView.h @@ -133,6 +133,7 @@ public Q_SLOTS: void resized(const QSize& size); protected: + ctkVTKSliceView(ctkVTKSliceViewPrivate* pimpl, QWidget* parent); bool eventFilter(QObject *object, QEvent *event) override; private: diff --git a/Libs/Visualization/VTK/Widgets/ctkVTKSliceView_p.h b/Libs/Visualization/VTK/Widgets/ctkVTKSliceView_p.h index c3148e0031..6ab2097e5c 100644 --- a/Libs/Visualization/VTK/Widgets/ctkVTKSliceView_p.h +++ b/Libs/Visualization/VTK/Widgets/ctkVTKSliceView_p.h @@ -41,13 +41,17 @@ class vtkRenderWindowInteractor; //----------------------------------------------------------------------------- /// \ingroup Visualization_VTK_Widgets -class ctkVTKSliceViewPrivate : public ctkVTKAbstractViewPrivate +class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKSliceViewPrivate : public ctkVTKAbstractViewPrivate { Q_OBJECT + Q_DECLARE_PUBLIC(ctkVTKSliceView); + public: ctkVTKSliceViewPrivate(ctkVTKSliceView&); + virtual ~ctkVTKSliceViewPrivate(); /// Convenient setup methods + void init() override; void setupCornerAnnotation() override; void setupRendering() override;