From 164da72169134e57b641f1daee0c6cdba41dab81 Mon Sep 17 00:00:00 2001 From: matlabbe Date: Sun, 29 Nov 2015 18:39:20 -0500 Subject: [PATCH] Added Qt5 support ("cmake -DFINDOBJECT_QT_VERSION=5 ..") --- CMakeLists.txt | 50 +++++++++++++++------------- app/CMakeLists.txt | 9 +++-- app/main.cpp | 2 +- example/CMakeLists.txt | 9 +++-- include/find_object/MainWindow.h | 2 +- include/find_object/ObjWidget.h | 2 +- src/AboutDialog.cpp | 1 + src/AboutDialog.h | 2 +- src/AddObjectDialog.cpp | 6 ++-- src/AddObjectDialog.h | 2 +- src/CMakeLists.txt | 39 ++++++++++++++-------- src/FindObject.cpp | 4 +-- src/ImageDropWidget.cpp | 1 + src/ImageDropWidget.h | 2 +- src/KeypointItem.cpp | 6 ++-- src/KeypointItem.h | 4 +-- src/MainWindow.cpp | 30 ++++++++--------- src/ObjWidget.cpp | 27 ++++++++------- src/ParametersToolBox.cpp | 16 ++++----- src/ParametersToolBox.h | 2 +- src/RectItem.cpp | 6 ++-- src/RectItem.h | 4 +-- src/Settings.cpp | 4 +-- src/ui/aboutDialog.ui | 30 ++++++++++++----- src/utilite/UPlot.cpp | 38 ++++++++++----------- src/utilite/UPlot.h | 8 ++--- tools/similarity/CMakeLists.txt | 2 +- tools/tcpClient/CMakeLists.txt | 24 +++++++++---- tools/tcpImagesServer/CMakeLists.txt | 22 ++++++++---- tools/tcpRequest/CMakeLists.txt | 23 +++++++++---- tools/tcpService/CMakeLists.txt | 9 +++-- 31 files changed, 230 insertions(+), 156 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3800a612..8af0a6d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.3) +cmake_minimum_required(VERSION 2.8.5) # Detect if it is called by catkin SET(CATKIN_BUILD ${CATKIN_TOPLEVEL}) @@ -11,6 +11,14 @@ ELSE() PROJECT( find_object_2d ) ENDIF() +# Catkin doesn't support multiarch library path, +# fix to "lib" if not set by user. +IF(NOT DEFINED CMAKE_INSTALL_LIBDIR) + set(CMAKE_INSTALL_LIBDIR "lib") +ENDIF(NOT DEFINED CMAKE_INSTALL_LIBDIR) + +INCLUDE(GNUInstallDirs) + ####################### # VERSION ####################### @@ -28,7 +36,13 @@ ADD_DEFINITIONS(-DPROJECT_NAME="${PROJECT_NAME}") ####### DEPENDENCIES ####### FIND_PACKAGE(OpenCV REQUIRED) # tested on 2.3.1 -FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtNetwork REQUIRED) + +SET(FINDOBJECT_QT_VERSION 4 CACHE STRING "Which QT version to use") +IF("${FINDOBJECT_QT_VERSION}" STREQUAL "4") + FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtNetwork REQUIRED) +ELSE() + FIND_PACKAGE(Qt5 COMPONENTS Widgets Core Gui Network REQUIRED) +ENDIF() ADD_DEFINITIONS(-DQT_NO_KEYWORDS) # To avoid conflicts with boost signals used in ROS SET(NONFREE 0) @@ -60,24 +74,6 @@ IF(NOT CATKIN_BUILD) ####### Build libraries as shared or static ####### OPTION( BUILD_SHARED_LIBS "Set to OFF to build static libraries" ON ) - ####### SET RPATH ######### - # When RPATH is activated (supported on most UNIX systems), - # the user doesn't need to change LD_LIBRARY_PATH - - # use, i.e. don't skip the full RPATH for the build tree - SET(CMAKE_SKIP_BUILD_RPATH FALSE) - - # when building, don't use the install RPATH already - # (but later on when installing) - SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) - - # the RPATH to be used when installing - SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_PREFIX}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}") - - # add the automatically determined parts of the RPATH - # which point to directories outside the build tree to the install RPATH - SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) - ####### OUTPUT DIR ####### SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin) SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin) @@ -85,14 +81,12 @@ IF(NOT CATKIN_BUILD) ####### INSTALL DIR ####### # Offer the user the choice of overriding the installation directories - set(INSTALL_LIB_DIR lib/${PROJECT_PREFIX}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} CACHE PATH "Installation directory for libraries") - set(INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables") set(INSTALL_INCLUDE_DIR include/${PROJECT_PREFIX}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} CACHE PATH "Installation directory for header files") if(WIN32 AND NOT CYGWIN) set(DEF_INSTALL_CMAKE_DIR CMake) else() - set(DEF_INSTALL_CMAKE_DIR lib/${PROJECT_PREFIX}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}) + set(DEF_INSTALL_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/${PROJECT_PREFIX}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}) endif() set(INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Installation directory for CMake files") @@ -139,7 +133,7 @@ IF(NOT CATKIN_BUILD) ####################### # Create the FindObjectConfig.cmake and FindObjectConfigVersion files file(RELATIVE_PATH REL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_CMAKE_DIR}" "${CMAKE_INSTALL_PREFIX}/${INSTALL_INCLUDE_DIR}") - file(RELATIVE_PATH REL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_CMAKE_DIR}" "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIB_DIR}") + file(RELATIVE_PATH REL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_CMAKE_DIR}" "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") # ... for the build tree set(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include") @@ -248,6 +242,14 @@ IF(NOT CATKIN_BUILD) ENDIF() ENDIF() + IF(QT4_FOUND) + MESSAGE(STATUS " With Qt = YES (version 4, \"-DFINDOBJECT_QT_VERSION=4\")") + ELSEIF(Qt5_FOUND) + MESSAGE(STATUS " With Qt = YES (version 5, \"-DFINDOBJECT_QT_VERSION=5\")") + ELSE() + MESSAGE(STATUS " With Qt = NO (Qt not found, to use Qt5 you should set -DFINDOBJECT_QT_VERSION=5)") + ENDIF() + IF(APPLE) MESSAGE(STATUS " BUILD_AS_BUNDLE = ${BUILD_AS_BUNDLE}") ENDIF(APPLE) diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 45fe8210..e4c76fc9 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -5,7 +5,9 @@ SET(INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS} ) -INCLUDE(${QT_USE_FILE}) +IF("${FINDOBJECT_QT_VERSION}" STREQUAL "4") + INCLUDE(${QT_USE_FILE}) +ENDIF() SET(LIBRARIES ${QT_LIBRARIES} @@ -50,6 +52,9 @@ ELSE() ENDIF() # Linking with Qt libraries TARGET_LINK_LIBRARIES(find_object_app find_object ${LIBRARIES}) +IF("${FINDOBJECT_QT_VERSION}" STREQUAL "5") + QT5_USE_MODULES(find_object_app Widgets Core Gui Network PrintSupport) +ENDIF() IF(APPLE AND BUILD_AS_BUNDLE) SET_TARGET_PROPERTIES(find_object_app PROPERTIES @@ -66,7 +71,7 @@ ENDIF() # Installation stuff #--------------------------- INSTALL(TARGETS find_object_app - RUNTIME DESTINATION "${INSTALL_BIN_DIR}" COMPONENT runtime + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT runtime BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}" COMPONENT runtime) #--------------------------- diff --git a/app/main.cpp b/app/main.cpp index 9048d3c7..3a602739 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -25,7 +25,7 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include #include #include diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index f2149496..942ea940 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -9,7 +9,9 @@ SET(INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../include ) -INCLUDE(${QT_USE_FILE}) +IF("${FINDOBJECT_QT_VERSION}" STREQUAL "4") + INCLUDE(${QT_USE_FILE}) +ENDIF() SET(LIBRARIES ${OpenCV_LIBS} @@ -23,11 +25,14 @@ INCLUDE_DIRECTORIES(${INCLUDE_DIRS}) # The extension is automatically found. ADD_EXECUTABLE(example ${SRC_FILES}) TARGET_LINK_LIBRARIES(example find_object ${LIBRARIES}) +IF("${FINDOBJECT_QT_VERSION}" STREQUAL "5") + QT5_USE_MODULES(example Widgets Core Gui Network PrintSupport) +ENDIF() SET_TARGET_PROPERTIES( example PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-example) INSTALL(TARGETS example - RUNTIME DESTINATION bin COMPONENT runtime + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT runtime BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}" COMPONENT runtime) diff --git a/include/find_object/MainWindow.h b/include/find_object/MainWindow.h index 7cd2c613..392b4b2f 100644 --- a/include/find_object/MainWindow.h +++ b/include/find_object/MainWindow.h @@ -32,7 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "find_object/DetectionInfo.h" -#include +#include #include #include #include diff --git a/include/find_object/ObjWidget.h b/include/find_object/ObjWidget.h index 6867eb36..73c2b75d 100644 --- a/include/find_object/ObjWidget.h +++ b/include/find_object/ObjWidget.h @@ -31,7 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "find_object/FindObjectExp.h" // DLL export/import defines #include -#include +#include #include class QAction; diff --git a/src/AboutDialog.cpp b/src/AboutDialog.cpp index 6f3fd896..9a805816 100644 --- a/src/AboutDialog.cpp +++ b/src/AboutDialog.cpp @@ -47,6 +47,7 @@ AboutDialog::AboutDialog(QWidget * parent) : #endif ui_->label_version_opencv->setText(cv_version); + ui_->label_version_qt->setText(QT_VERSION_STR); } AboutDialog::~AboutDialog() diff --git a/src/AboutDialog.h b/src/AboutDialog.h index c50c77f4..2d99fbc4 100644 --- a/src/AboutDialog.h +++ b/src/AboutDialog.h @@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef ABOUTDIALOG_H_ #define ABOUTDIALOG_H_ -#include +#include #include class Ui_aboutDialog; diff --git a/src/AddObjectDialog.cpp b/src/AddObjectDialog.cpp index 3580cf59..a4260861 100644 --- a/src/AddObjectDialog.cpp +++ b/src/AddObjectDialog.cpp @@ -38,9 +38,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/src/AddObjectDialog.h b/src/AddObjectDialog.h index 5925d734..331dd45e 100644 --- a/src/AddObjectDialog.h +++ b/src/AddObjectDialog.h @@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef ADDOBJECTDIALOG_H_ #define ADDOBJECTDIALOG_H_ -#include +#include #include #include #include diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0fca4258..324c9192 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -34,15 +34,21 @@ SET(qrc ./resources.qrc ) -# generate rules for building source files from the resources -QT4_ADD_RESOURCES(srcs_qrc ${qrc}) +IF("${FINDOBJECT_QT_VERSION}" STREQUAL "4") + # generate rules for building source files from the resources + QT4_ADD_RESOURCES(srcs_qrc ${qrc}) -#Generate .h files from the .ui files -QT4_WRAP_UI(moc_uis ${uis}) + #Generate .h files from the .ui files + QT4_WRAP_UI(moc_uis ${uis}) -#This will generate moc_* for Qt -QT4_WRAP_CPP(moc_srcs ${headers_ui}) -### Qt Gui stuff end### + #This will generate moc_* for Qt + QT4_WRAP_CPP(moc_srcs ${headers_ui}) + ### Qt Gui stuff end### +ELSE() + QT5_ADD_RESOURCES(srcs_qrc ${qrc}) + QT5_WRAP_UI(moc_uis ${uis}) + QT5_WRAP_CPP(moc_srcs ${headers_ui}) +ENDIF() SET(SRC_FILES ./MainWindow.cpp @@ -95,7 +101,9 @@ IF(CATKIN_BUILD) ) ENDIF(CATKIN_BUILD) -INCLUDE(${QT_USE_FILE}) +IF("${FINDOBJECT_QT_VERSION}" STREQUAL "4") + INCLUDE(${QT_USE_FILE}) +ENDIF() SET(LIBRARIES ${QT_LIBRARIES} @@ -115,29 +123,32 @@ INCLUDE_DIRECTORIES(${INCLUDE_DIRS}) ADD_LIBRARY(find_object ${SRC_FILES}) # Linking with Qt libraries TARGET_LINK_LIBRARIES(find_object ${LIBRARIES}) +IF("${FINDOBJECT_QT_VERSION}" STREQUAL "5") + QT5_USE_MODULES(find_object Widgets Core Gui Network PrintSupport) +ENDIF() IF(CATKIN_BUILD) set_target_properties(find_object PROPERTIES OUTPUT_NAME find_object_2d) ENDIF(CATKIN_BUILD) IF(NOT CATKIN_BUILD) INSTALL(TARGETS find_object - RUNTIME DESTINATION "${INSTALL_BIN_DIR}" COMPONENT runtime - LIBRARY DESTINATION "${INSTALL_LIB_DIR}" COMPONENT devel - ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" COMPONENT devel) + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT runtime + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT devel + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT devel) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../include/ DESTINATION "${INSTALL_INCLUDE_DIR}" COMPONENT devel FILES_MATCHING PATTERN "*.h" PATTERN ".svn" EXCLUDE) ELSE() add_executable(find_object_2d ros/find_object_2d_node.cpp) target_link_libraries(find_object_2d find_object ${LIBRARIES}) - add_dependencies(find_object_2d find_object_2d_generate_messages_cpp) + add_dependencies(find_object_2d ${${PROJECT_NAME}_EXPORTED_TARGETS}) add_executable(print_objects_detected ros/print_objects_detected_node.cpp) target_link_libraries(print_objects_detected ${LIBRARIES}) - add_dependencies(print_objects_detected find_object_2d_generate_messages_cpp) + add_dependencies(print_objects_detected ${${PROJECT_NAME}_EXPORTED_TARGETS}) add_executable(tf_example ros/tf_example_node.cpp) target_link_libraries(tf_example ${LIBRARIES}) - add_dependencies(tf_example find_object_2d_generate_messages_cpp) + add_dependencies(tf_example ${${PROJECT_NAME}_EXPORTED_TARGETS}) ## Mark executables and/or libraries for installation install(TARGETS diff --git a/src/FindObject.cpp b/src/FindObject.cpp index 3037f400..17557a69 100644 --- a/src/FindObject.cpp +++ b/src/FindObject.cpp @@ -39,7 +39,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include +#include #include namespace find_object { @@ -374,7 +374,7 @@ std::vector limitKeypoints(const std::vector & keypo void limitKeypoints(std::vector & keypoints, cv::Mat & descriptors, int maxKeypoints) { - UASSERT(keypoints.size() == descriptors.rows); + UASSERT((int)keypoints.size() == descriptors.rows); std::vector kptsKept; cv::Mat descriptorsKept; if(maxKeypoints > 0 && (int)keypoints.size() > maxKeypoints) diff --git a/src/ImageDropWidget.cpp b/src/ImageDropWidget.cpp index 373c6b83..bd9ca634 100644 --- a/src/ImageDropWidget.cpp +++ b/src/ImageDropWidget.cpp @@ -10,6 +10,7 @@ #include #include #include +#include namespace find_object { diff --git a/src/ImageDropWidget.h b/src/ImageDropWidget.h index 74ef8ce5..04cdf699 100644 --- a/src/ImageDropWidget.h +++ b/src/ImageDropWidget.h @@ -8,7 +8,7 @@ #ifndef IMAGEDROPWIDGET_H_ #define IMAGEDROPWIDGET_H_ -#include +#include namespace find_object { diff --git a/src/KeypointItem.cpp b/src/KeypointItem.cpp index c044fd31..ec1834c4 100644 --- a/src/KeypointItem.cpp +++ b/src/KeypointItem.cpp @@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#include +#include namespace find_object { @@ -42,7 +42,7 @@ KeypointItem::KeypointItem(int id, qreal x, qreal y, int r, const cv::KeyPoint & { this->setPen(QPen(color)); this->setBrush(QBrush(color)); - this->setAcceptsHoverEvents(true); + this->setAcceptHoverEvents(true); this->setFlag(QGraphicsItem::ItemIsFocusable, true); this->setFlag(QGraphicsItem::ItemIsSelectable, true); } @@ -57,7 +57,7 @@ void KeypointItem::setColor(const QColor & color) this->setBrush(QBrush(color)); if(placeHolder_) { - QList items = placeHolder_->children(); + QList items = placeHolder_->childItems(); if(items.size()) { ((QGraphicsTextItem *)items.front())->setDefaultTextColor(this->pen().color().rgb()); diff --git a/src/KeypointItem.h b/src/KeypointItem.h index 4370bf7b..63367347 100644 --- a/src/KeypointItem.h +++ b/src/KeypointItem.h @@ -28,8 +28,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef KEYPOINTITEM_H_ #define KEYPOINTITEM_H_ -#include -#include +#include +#include #include #include #include diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index b8f6d743..191ec1d0 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -62,17 +62,17 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "utilite/UDirectory.h" @@ -382,7 +382,7 @@ void MainWindow::loadSession() this->showObject(obj); //update object labels - QLabel * title = qFindChild(this, QString("%1title").arg(iter.value()->id())); + QLabel * title = this->findChild(QString("%1title").arg(iter.value()->id())); title->setText(QString("%1 (%2)").arg(iter.value()->id()).arg(QString::number(iter.value()->keypoints().size()))); } @@ -973,11 +973,11 @@ void MainWindow::setupCameraFromTcpIp() else { bool ok; - int port = QInputDialog::getInteger(this, tr("Server port..."), "Port: ", Settings::getCamera_8port(), 1, USHRT_MAX, 1, &ok); + int port = QInputDialog::getInt(this, tr("Server port..."), "Port: ", Settings::getCamera_8port(), 1, USHRT_MAX, 1, &ok); if(ok) { - int queue = QInputDialog::getInteger(this, tr("Queue size..."), "Images buffer size (0 means infinite): ", Settings::getCamera_9queueSize(), 0, 2147483647, 1, &ok); + int queue = QInputDialog::getInt(this, tr("Queue size..."), "Images buffer size (0 means infinite): ", Settings::getCamera_9queueSize(), 0, 2147483647, 1, &ok); if(ok) { Settings::setCamera_6useTcpCamera(true); @@ -1073,7 +1073,7 @@ void MainWindow::updateObjects(const QList & ids) objWidgets_.value(signatures[i]->id())->updateData(signatures[i]->keypoints()); //update object labels - QLabel * title = qFindChild(this, QString("%1title").arg(signatures[i]->id())); + QLabel * title = this->findChild(QString("%1title").arg(signatures[i]->id())); title->setText(QString("%1 (%2)").arg(signatures[i]->id()).arg(QString::number(signatures[i]->keypoints().size()))); } } diff --git a/src/ObjWidget.cpp b/src/ObjWidget.cpp index 8a4772bb..b9c9a618 100644 --- a/src/ObjWidget.cpp +++ b/src/ObjWidget.cpp @@ -34,20 +34,19 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include diff --git a/src/ParametersToolBox.cpp b/src/ParametersToolBox.cpp index 4f79e4e3..ca9fa069 100644 --- a/src/ParametersToolBox.cpp +++ b/src/ParametersToolBox.cpp @@ -28,14 +28,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "find_object/Settings.h" #include "ParametersToolBox.h" -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include "find_object/utilite/ULogger.h" #include diff --git a/src/ParametersToolBox.h b/src/ParametersToolBox.h index ce43e108..ca6a44f3 100644 --- a/src/ParametersToolBox.h +++ b/src/ParametersToolBox.h @@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef PARAMETERSTOOLBOX_H_ #define PARAMETERSTOOLBOX_H_ -#include +#include class QVBoxLayout; class QAbstractButton; diff --git a/src/RectItem.cpp b/src/RectItem.cpp index ece2deed..f249e27b 100644 --- a/src/RectItem.cpp +++ b/src/RectItem.cpp @@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#include +#include namespace find_object { @@ -38,7 +38,7 @@ RectItem::RectItem(int id, const QRectF &rect, QGraphicsItem * parent) : placeHolder_(0), id_(id) { - this->setAcceptsHoverEvents(true); + this->setAcceptHoverEvents(true); this->setFlag(QGraphicsItem::ItemIsFocusable, true); this->setFlag(QGraphicsItem::ItemIsSelectable, true); } @@ -53,7 +53,7 @@ void RectItem::setColor(const QColor & color) this->setBrush(QBrush(color)); if(placeHolder_) { - QList items = placeHolder_->children(); + QList items = placeHolder_->childItems(); if(items.size()) { ((QGraphicsTextItem *)items.front())->setDefaultTextColor(this->pen().color().rgb()); diff --git a/src/RectItem.h b/src/RectItem.h index 20922196..3316b3f3 100644 --- a/src/RectItem.h +++ b/src/RectItem.h @@ -28,8 +28,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef RECTITEM_H_ #define RECTITEM_H_ -#include -#include +#include +#include #include #include diff --git a/src/Settings.cpp b/src/Settings.cpp index e2781999..6ed7d7cb 100644 --- a/src/Settings.cpp +++ b/src/Settings.cpp @@ -125,7 +125,7 @@ void Settings::loadSettings(const QString & fileName) // (assuming that index < 10... one character for index) QChar index = str.at(0); str = getParameter(key).toString(); - str[0] = index.toAscii(); + str[0] = index.toLatin1(); value = QVariant(str); UINFO("Updated list of parameter \"%s\"", key.toStdString().c_str()); } @@ -169,7 +169,7 @@ void Settings::loadSettings(const QString & fileName) } } str = getParameter(key).toString(); - str[0] = index.toAscii(); + str[0] = index.toLatin1(); value = QVariant(str); #endif } diff --git a/src/ui/aboutDialog.ui b/src/ui/aboutDialog.ui index d67f9972..b11cb80b 100644 --- a/src/ui/aboutDialog.ui +++ b/src/ui/aboutDialog.ui @@ -137,14 +137,7 @@ p, li { white-space: pre-wrap; } - - - - OpenCV version : - - - - + @@ -154,6 +147,27 @@ p, li { white-space: pre-wrap; } + + + + OpenCV version : + + + + + + + Qt version : + + + + + + + + + + diff --git a/src/utilite/UPlot.cpp b/src/utilite/UPlot.cpp index 1e43f982..32f78567 100644 --- a/src/utilite/UPlot.cpp +++ b/src/utilite/UPlot.cpp @@ -22,25 +22,25 @@ #include "utilite/UPlot.h" //#include "utilite/ULogger.h" -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #ifdef QT_SVG_LIB #include #endif @@ -58,7 +58,7 @@ UPlotItem::UPlotItem(qreal dataX, qreal dataY, qreal width) : _data.setX(dataX); _data.setY(dataY); this->setZValue(1); - this->setAcceptsHoverEvents(true); + this->setAcceptHoverEvents(true); _text = new QGraphicsTextItem(this); _text->setPlainText(QString("(%1,%2)").arg(_data.x()).arg(_data.y())); _text->setVisible(false); @@ -72,7 +72,7 @@ UPlotItem::UPlotItem(const QPointF & data, qreal width) : _nextItem(0) { this->setZValue(1); - this->setAcceptsHoverEvents(true); + this->setAcceptHoverEvents(true); _text = new QGraphicsTextItem(this); _text->setPlainText(QString("(%1,%2)").arg(_data.x()).arg(_data.y())); _text->setVisible(false); @@ -1593,7 +1593,7 @@ void UPlot::setupUi() _view->setScene(new QGraphicsScene(0,0,0,0,this)); _view->setStyleSheet( "QGraphicsView { border-style: none; }" ); _sceneRoot = _view->scene()->addText(""); - _sceneRoot->translate(0,0); + _sceneRoot->setPos(0,0); _graphicsViewHolder = new QWidget(this); _graphicsViewHolder->setMinimumSize(100,100); _verticalAxis = new UPlotAxis(Qt::Vertical, 0, 1, this); diff --git a/src/utilite/UPlot.h b/src/utilite/UPlot.h index ced25e42..c5bc444b 100644 --- a/src/utilite/UPlot.h +++ b/src/utilite/UPlot.h @@ -24,15 +24,15 @@ //#include "utilite/UtiLiteExp.h" // DLL export/import defines -#include +#include #include #include #include #include -#include +#include #include -#include -#include +#include +#include #include class QGraphicsView; diff --git a/tools/similarity/CMakeLists.txt b/tools/similarity/CMakeLists.txt index e884acdc..2c493835 100644 --- a/tools/similarity/CMakeLists.txt +++ b/tools/similarity/CMakeLists.txt @@ -24,5 +24,5 @@ SET_TARGET_PROPERTIES( similarity PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-similarity) INSTALL(TARGETS similarity - RUNTIME DESTINATION bin COMPONENT runtime + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT runtime BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}" COMPONENT runtime) diff --git a/tools/tcpClient/CMakeLists.txt b/tools/tcpClient/CMakeLists.txt index f9363d3f..11beb5b7 100644 --- a/tools/tcpClient/CMakeLists.txt +++ b/tools/tcpClient/CMakeLists.txt @@ -1,10 +1,15 @@ -### Qt Gui stuff ### + SET(headers_ui TcpClient.h ) -#This will generate moc_* for Qt -QT4_WRAP_CPP(moc_srcs ${headers_ui}) -### Qt Gui stuff end### + +IF("${FINDOBJECT_QT_VERSION}" STREQUAL "4") + #This will generate moc_* for Qt + QT4_WRAP_CPP(moc_srcs ${headers_ui}) + ### Qt Gui stuff end### +ELSE() + QT5_WRAP_CPP(moc_srcs ${headers_ui}) +ENDIF() SET(SRC_FILES TcpClient.cpp @@ -18,7 +23,9 @@ SET(INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS} ) -INCLUDE(${QT_USE_FILE}) +IF("${FINDOBJECT_QT_VERSION}" STREQUAL "4") + INCLUDE(${QT_USE_FILE}) +ENDIF() SET(LIBRARIES ${OpenCV_LIBS} @@ -32,10 +39,13 @@ INCLUDE_DIRECTORIES(${INCLUDE_DIRS}) # The extension is automatically found. ADD_EXECUTABLE(tcpClient ${SRC_FILES}) TARGET_LINK_LIBRARIES(tcpClient ${LIBRARIES}) +IF("${FINDOBJECT_QT_VERSION}" STREQUAL "5") + QT5_USE_MODULES(tcpClient Widgets Core Gui Network PrintSupport) +ENDIF() SET_TARGET_PROPERTIES( tcpClient PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-tcpClient) INSTALL(TARGETS tcpClient - RUNTIME DESTINATION bin COMPONENT runtime - BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}" COMPONENT runtime) \ No newline at end of file + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT runtime + BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}" COMPONENT runtime) diff --git a/tools/tcpImagesServer/CMakeLists.txt b/tools/tcpImagesServer/CMakeLists.txt index e6d6d135..f4ee7b29 100644 --- a/tools/tcpImagesServer/CMakeLists.txt +++ b/tools/tcpImagesServer/CMakeLists.txt @@ -1,10 +1,15 @@ -### Qt Gui stuff ### + SET(headers_ui ImagesTcpServer.h ) -#This will generate moc_* for Qt -QT4_WRAP_CPP(moc_srcs ${headers_ui}) -### Qt Gui stuff end### + +IF("${FINDOBJECT_QT_VERSION}" STREQUAL "4") + #This will generate moc_* for Qt + QT4_WRAP_CPP(moc_srcs ${headers_ui}) + ### Qt Gui stuff end### +ELSE() + QT5_WRAP_CPP(moc_srcs ${headers_ui}) +ENDIF() SET(SRC_FILES ImagesTcpServer.cpp @@ -18,7 +23,9 @@ SET(INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS} ) -INCLUDE(${QT_USE_FILE}) +IF("${FINDOBJECT_QT_VERSION}" STREQUAL "4") + INCLUDE(${QT_USE_FILE}) +ENDIF() SET(LIBRARIES ${OpenCV_LIBS} @@ -32,11 +39,14 @@ INCLUDE_DIRECTORIES(${INCLUDE_DIRS}) # The extension is automatically found. ADD_EXECUTABLE(tcpImagesServer ${SRC_FILES}) TARGET_LINK_LIBRARIES(tcpImagesServer find_object ${LIBRARIES}) +IF("${FINDOBJECT_QT_VERSION}" STREQUAL "5") + QT5_USE_MODULES(tcpImagesServer Widgets Core Gui Network PrintSupport) +ENDIF() SET_TARGET_PROPERTIES( tcpImagesServer PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-tcpImagesServer) INSTALL(TARGETS tcpImagesServer - RUNTIME DESTINATION bin COMPONENT runtime + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT runtime BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}" COMPONENT runtime) diff --git a/tools/tcpRequest/CMakeLists.txt b/tools/tcpRequest/CMakeLists.txt index 35e10bbd..6e5085d3 100644 --- a/tools/tcpRequest/CMakeLists.txt +++ b/tools/tcpRequest/CMakeLists.txt @@ -1,10 +1,15 @@ -### Qt Gui stuff ### + SET(headers_ui TcpResponse.h ) -#This will generate moc_* for Qt -QT4_WRAP_CPP(moc_srcs ${headers_ui}) -### Qt Gui stuff end### + +IF("${FINDOBJECT_QT_VERSION}" STREQUAL "4") + #This will generate moc_* for Qt + QT4_WRAP_CPP(moc_srcs ${headers_ui}) + ### Qt Gui stuff end### +ELSE() + QT5_WRAP_CPP(moc_srcs ${headers_ui}) +ENDIF() SET(SRC_FILES TcpResponse.cpp @@ -18,7 +23,10 @@ SET(INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS} ) -INCLUDE(${QT_USE_FILE}) +IF("${FINDOBJECT_QT_VERSION}" STREQUAL "4") + INCLUDE(${QT_USE_FILE}) +ENDIF() + SET(LIBRARIES ${OpenCV_LIBS} @@ -32,11 +40,14 @@ INCLUDE_DIRECTORIES(${INCLUDE_DIRS}) # The extension is automatically found. ADD_EXECUTABLE(tcpRequest ${SRC_FILES}) TARGET_LINK_LIBRARIES(tcpRequest find_object ${LIBRARIES}) +IF("${FINDOBJECT_QT_VERSION}" STREQUAL "5") + QT5_USE_MODULES(tcpRequest Widgets Core Gui Network PrintSupport) +ENDIF() SET_TARGET_PROPERTIES( tcpRequest PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-tcpRequest) INSTALL(TARGETS tcpRequest - RUNTIME DESTINATION bin COMPONENT runtime + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT runtime BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}" COMPONENT runtime) diff --git a/tools/tcpService/CMakeLists.txt b/tools/tcpService/CMakeLists.txt index 221b6003..8c4b19be 100644 --- a/tools/tcpService/CMakeLists.txt +++ b/tools/tcpService/CMakeLists.txt @@ -9,7 +9,9 @@ SET(INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS} ) -INCLUDE(${QT_USE_FILE}) +IF("${FINDOBJECT_QT_VERSION}" STREQUAL "4") + INCLUDE(${QT_USE_FILE}) +ENDIF() SET(LIBRARIES ${OpenCV_LIBS} @@ -23,11 +25,14 @@ INCLUDE_DIRECTORIES(${INCLUDE_DIRS}) # The extension is automatically found. ADD_EXECUTABLE(tcpService ${SRC_FILES}) TARGET_LINK_LIBRARIES(tcpService find_object ${LIBRARIES}) +IF("${FINDOBJECT_QT_VERSION}" STREQUAL "5") + QT5_USE_MODULES(tcpService Widgets Core Gui Network PrintSupport) +ENDIF() SET_TARGET_PROPERTIES( tcpService PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-tcpService) INSTALL(TARGETS tcpService - RUNTIME DESTINATION bin COMPONENT runtime + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT runtime BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}" COMPONENT runtime)