From 64bd18acf3978b55085ef254f4ec105dac4ac8b0 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Tue, 13 Jun 2023 22:53:48 -0400 Subject: [PATCH 1/9] 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 e4ed0d67467237589c4d6809fdf0f0f464a21f77 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Tue, 13 Jun 2023 22:59:31 -0400 Subject: [PATCH 2/9] 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 ae800b8f0dcb97d061753d5f0e43689d7e36b5d5 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Tue, 13 Jun 2023 23:49:11 -0400 Subject: [PATCH 3/9] 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 a24f509079936262949f2c47756f2d6eecf8ada5 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 14 Jun 2023 00:18:49 -0400 Subject: [PATCH 4/9] 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 0af7a87d8f88e2502d4d955dcb7553b2bed695f1 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Tue, 13 Jun 2023 22:49:22 -0400 Subject: [PATCH 5/9] 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 8bc4483c391df3af872c6f0fb27e22593fb46651 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 14 Jun 2023 01:15:31 -0400 Subject: [PATCH 6/9] 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 8ebac347a732f2353e2f56f20f8adf135ab400ab Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 14 Jun 2023 01:25:39 -0400 Subject: [PATCH 7/9] 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 22bc65149ad360959b324b7274165bd05965ac1b Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 14 Jun 2023 01:28:38 -0400 Subject: [PATCH 8/9] 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 ead9fb90ede368c567fbd2c456573f65bb3c8cb0 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 14 Jun 2023 01:31:01 -0400 Subject: [PATCH 9/9] 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);