Mercurial > hg > orthanc-stone
changeset 320:10d188d6e5cc am-2
compatibility with Qt4
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 12 Oct 2018 14:38:48 +0200 |
parents | daa04d15192c |
children | 56b2e47d3c0c |
files | Applications/Samples/Qt/SampleMainWindow.cpp Applications/Samples/SimpleViewer/Qt/SimpleViewerMainWindow.cpp Resources/CMake/QtConfiguration.cmake |
diffstat | 3 files changed, 36 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/Applications/Samples/Qt/SampleMainWindow.cpp Thu Oct 11 13:16:54 2018 +0200 +++ b/Applications/Samples/Qt/SampleMainWindow.cpp Fri Oct 12 14:38:48 2018 +0200 @@ -40,10 +40,17 @@ ui_->setupUi(this); SetCentralStoneWidget(ui_->cairoCentralWidget); +#if QT_VERSION >= 0x050000 connect(ui_->toolButton1, &QToolButton::clicked, this, &SampleMainWindow::tool1Clicked); connect(ui_->toolButton2, &QToolButton::clicked, this, &SampleMainWindow::tool2Clicked); connect(ui_->pushButton1, &QPushButton::clicked, this, &SampleMainWindow::pushButton1Clicked); connect(ui_->pushButton1, &QPushButton::clicked, this, &SampleMainWindow::pushButton2Clicked); +#else + connect(ui_->toolButton1, SIGNAL(clicked()), this, SLOT(tool1Clicked())); + connect(ui_->toolButton2, SIGNAL(clicked()), this, SLOT(tool2Clicked())); + connect(ui_->pushButton1, SIGNAL(clicked()), this, SLOT(pushButton1Clicked())); + connect(ui_->pushButton1, SIGNAL(clicked()), this, SLOT(pushButton2Clicked())); +#endif std::string pushButton1Name; std::string pushButton2Name;
--- a/Applications/Samples/SimpleViewer/Qt/SimpleViewerMainWindow.cpp Thu Oct 11 13:16:54 2018 +0200 +++ b/Applications/Samples/SimpleViewer/Qt/SimpleViewerMainWindow.cpp Fri Oct 12 14:38:48 2018 +0200 @@ -38,12 +38,21 @@ ui_->setupUi(this); SetCentralStoneWidget(ui_->cairoCentralWidget); +#if QT_VERSION >= 0x050000 connect(ui_->toolButtonCrop, &QToolButton::clicked, this, &SimpleViewerMainWindow::cropClicked); connect(ui_->toolButtonLine, &QToolButton::clicked, this, &SimpleViewerMainWindow::lineClicked); connect(ui_->toolButtonCircle, &QToolButton::clicked, this, &SimpleViewerMainWindow::circleClicked); connect(ui_->toolButtonWindowing, &QToolButton::clicked, this, &SimpleViewerMainWindow::windowingClicked); connect(ui_->pushButtonRotate, &QPushButton::clicked, this, &SimpleViewerMainWindow::rotateClicked); connect(ui_->pushButtonInvert, &QPushButton::clicked, this, &SimpleViewerMainWindow::invertClicked); +#else + connect(ui_->toolButtonCrop, SIGNAL(clicked()), this, SLOT(cropClicked())); + connect(ui_->toolButtonLine, SIGNAL(clicked()), this, SLOT(lineClicked())); + connect(ui_->toolButtonCircle, SIGNAL(clicked()), this, SLOT(circleClicked())); + connect(ui_->toolButtonWindowing, SIGNAL(clicked()), this, SLOT(windowingClicked())); + connect(ui_->pushButtonRotate, SIGNAL(clicked()), this, SLOT(rotateClicked())); + connect(ui_->pushButtonInvert, SIGNAL(clicked()), this, SLOT(invertClicked())); +#endif } SimpleViewerMainWindow::~SimpleViewerMainWindow()
--- a/Resources/CMake/QtConfiguration.cmake Thu Oct 11 13:16:54 2018 +0200 +++ b/Resources/CMake/QtConfiguration.cmake Fri Oct 12 14:38:48 2018 +0200 @@ -23,18 +23,28 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) # Find the QtWidgets library -find_package(Qt5Widgets) -find_package(Qt5Core) +find_package(Qt5Widgets QUIET) + +if (Qt5Widgets_FOUND) + message("Qt5 has been detected") + find_package(Qt5Core REQUIRED) + link_libraries( + Qt5::Widgets + Qt5::Core + ) +else() + message("Qt5 has not been found, trying with Qt4") + find_package(Qt4 REQUIRED QtGui) + link_libraries( + Qt4::QtGui + ) +endif() list(APPEND QT_SOURCES - ${ORTHANC_STONE_ROOT}/Applications/Qt/QCairoWidget.cpp - ${ORTHANC_STONE_ROOT}/Applications/Qt/QtStoneApplicationRunner.cpp - ${ORTHANC_STONE_ROOT}/Applications/Qt/QStoneMainWindow.cpp -) + ${ORTHANC_STONE_ROOT}/Applications/Qt/QCairoWidget.cpp + ${ORTHANC_STONE_ROOT}/Applications/Qt/QtStoneApplicationRunner.cpp + ${ORTHANC_STONE_ROOT}/Applications/Qt/QStoneMainWindow.cpp + ) include_directories(${ORTHANC_STONE_ROOT}/Applications/Qt/) -link_libraries( - Qt5::Widgets - Qt5::Core -)