Added Qt5 support ("cmake -DFINDOBJECT_QT_VERSION=5 ..")

This commit is contained in:
matlabbe 2015-11-29 18:39:20 -05:00
parent ae7b79629b
commit 164da72169
31 changed files with 230 additions and 156 deletions

View File

@ -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)

View File

@ -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)
#---------------------------

View File

@ -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 <QtGui/QApplication>
#include <QApplication>
#include <QtCore/QDir>
#include <QtCore/QFile>
#include <iostream>

View File

@ -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)

View File

@ -32,7 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "find_object/DetectionInfo.h"
#include <QtGui/QMainWindow>
#include <QMainWindow>
#include <QtCore/QSet>
#include <QtCore/QTimer>
#include <QtCore/QTime>

View File

@ -31,7 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "find_object/FindObjectExp.h" // DLL export/import defines
#include <opencv2/features2d/features2d.hpp>
#include <QtGui/QWidget>
#include <QWidget>
#include <QtCore/QMultiMap>
class QAction;

View File

@ -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()

View File

@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ABOUTDIALOG_H_
#define ABOUTDIALOG_H_
#include <QtGui/QDialog>
#include <QDialog>
#include <QtCore/QUrl>
class Ui_aboutDialog;

View File

@ -38,9 +38,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdio.h>
#include <QtGui/QGraphicsScene>
#include <QtGui/QGraphicsPixmapItem>
#include <QtGui/QMessageBox>
#include <QGraphicsScene>
#include <QGraphicsPixmapItem>
#include <QMessageBox>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>

View File

@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ADDOBJECTDIALOG_H_
#define ADDOBJECTDIALOG_H_
#include <QtGui/QDialog>
#include <QDialog>
#include <QtCore/QTimer>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/core/core.hpp>

View File

@ -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

View File

@ -39,7 +39,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QtCore/QStringList>
#include <QtCore/QTime>
#include <QtCore/QDir>
#include <QtGui/QGraphicsRectItem>
#include <QGraphicsRectItem>
#include <stdio.h>
namespace find_object {
@ -374,7 +374,7 @@ std::vector<cv::KeyPoint> limitKeypoints(const std::vector<cv::KeyPoint> & keypo
void limitKeypoints(std::vector<cv::KeyPoint> & keypoints, cv::Mat & descriptors, int maxKeypoints)
{
UASSERT(keypoints.size() == descriptors.rows);
UASSERT((int)keypoints.size() == descriptors.rows);
std::vector<cv::KeyPoint> kptsKept;
cv::Mat descriptorsKept;
if(maxKeypoints > 0 && (int)keypoints.size() > maxKeypoints)

View File

@ -10,6 +10,7 @@
#include <QtGui/QDragEnterEvent>
#include <QtCore/QRegExp>
#include <QtCore/QUrl>
#include <QMimeData>
namespace find_object {

View File

@ -8,7 +8,7 @@
#ifndef IMAGEDROPWIDGET_H_
#define IMAGEDROPWIDGET_H_
#include <QtGui/QWidget>
#include <QWidget>
namespace find_object {

View File

@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QtGui/QPen>
#include <QtGui/QBrush>
#include <QtGui/QGraphicsScene>
#include <QGraphicsScene>
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<QGraphicsItem *> items = placeHolder_->children();
QList<QGraphicsItem *> items = placeHolder_->childItems();
if(items.size())
{
((QGraphicsTextItem *)items.front())->setDefaultTextColor(this->pen().color().rgb());

View File

@ -28,8 +28,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef KEYPOINTITEM_H_
#define KEYPOINTITEM_H_
#include <QtGui/QGraphicsEllipseItem>
#include <QtGui/QGraphicsTextItem>
#include <QGraphicsEllipseItem>
#include <QGraphicsTextItem>
#include <QtGui/QPen>
#include <QtGui/QBrush>
#include <opencv2/features2d/features2d.hpp>

View File

@ -62,17 +62,17 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QtCore/QThread>
#include <QtCore/QLineF>
#include <QtGui/QFileDialog>
#include <QtGui/QMessageBox>
#include <QtGui/QGraphicsScene>
#include <QtGui/QGraphicsRectItem>
#include <QtGui/QSpinBox>
#include <QtGui/QStatusBar>
#include <QtGui/QProgressDialog>
#include <QtGui/QCloseEvent>
#include <QtGui/QCheckBox>
#include <QtGui/QScrollBar>
#include <QtGui/QInputDialog>
#include <QFileDialog>
#include <QMessageBox>
#include <QGraphicsScene>
#include <QGraphicsRectItem>
#include <QSpinBox>
#include <QStatusBar>
#include <QProgressDialog>
#include <QCloseEvent>
#include <QCheckBox>
#include <QScrollBar>
#include <QInputDialog>
#include "utilite/UDirectory.h"
@ -382,7 +382,7 @@ void MainWindow::loadSession()
this->showObject(obj);
//update object labels
QLabel * title = qFindChild<QLabel*>(this, QString("%1title").arg(iter.value()->id()));
QLabel * title = this->findChild<QLabel*>(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<int> & ids)
objWidgets_.value(signatures[i]->id())->updateData(signatures[i]->keypoints());
//update object labels
QLabel * title = qFindChild<QLabel*>(this, QString("%1title").arg(signatures[i]->id()));
QLabel * title = this->findChild<QLabel*>(QString("%1title").arg(signatures[i]->id()));
title->setText(QString("%1 (%2)").arg(signatures[i]->id()).arg(QString::number(signatures[i]->keypoints().size())));
}
}

View File

@ -34,20 +34,19 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <opencv2/highgui/highgui.hpp>
#include <QtGui/QWidget>
#include <QtGui/QContextMenuEvent>
#include <QtGui/QMenu>
#include <QtGui/QMenu>
#include <QtGui/QFileDialog>
#include <QtGui/QAction>
#include <QtGui/QGraphicsView>
#include <QtGui/QGraphicsScene>
#include <QtGui/QVBoxLayout>
#include <QtGui/QGraphicsRectItem>
#include <QtGui/QInputDialog>
#include <QtGui/QPen>
#include <QtGui/QLabel>
#include <QtGui/QColorDialog>
#include <QWidget>
#include <QContextMenuEvent>
#include <QMenu>
#include <QFileDialog>
#include <QAction>
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QVBoxLayout>
#include <QGraphicsRectItem>
#include <QInputDialog>
#include <QPen>
#include <QLabel>
#include <QColorDialog>
#include <QtCore/QDir>

View File

@ -28,14 +28,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "find_object/Settings.h"
#include "ParametersToolBox.h"
#include <QtGui/QComboBox>
#include <QtGui/QDoubleSpinBox>
#include <QtGui/QLineEdit>
#include <QtGui/QLabel>
#include <QtGui/QGroupBox>
#include <QtGui/QCheckBox>
#include <QtGui/QVBoxLayout>
#include <QtGui/QMessageBox>
#include <QComboBox>
#include <QDoubleSpinBox>
#include <QLineEdit>
#include <QLabel>
#include <QGroupBox>
#include <QCheckBox>
#include <QVBoxLayout>
#include <QMessageBox>
#include <stdio.h>
#include "find_object/utilite/ULogger.h"
#include <opencv2/opencv_modules.hpp>

View File

@ -28,7 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef PARAMETERSTOOLBOX_H_
#define PARAMETERSTOOLBOX_H_
#include <QtGui/QToolBox>
#include <QToolBox>
class QVBoxLayout;
class QAbstractButton;

View File

@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QtGui/QPen>
#include <QtGui/QBrush>
#include <QtGui/QGraphicsScene>
#include <QGraphicsScene>
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<QGraphicsItem *> items = placeHolder_->children();
QList<QGraphicsItem *> items = placeHolder_->childItems();
if(items.size())
{
((QGraphicsTextItem *)items.front())->setDefaultTextColor(this->pen().color().rgb());

View File

@ -28,8 +28,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef RECTITEM_H_
#define RECTITEM_H_
#include <QtGui/QGraphicsRectItem>
#include <QtGui/QGraphicsTextItem>
#include <QGraphicsRectItem>
#include <QGraphicsTextItem>
#include <QtGui/QPen>
#include <QtGui/QBrush>

View File

@ -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
}

View File

@ -137,14 +137,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>OpenCV version :</string>
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<widget class="QLabel" name="label_version_opencv">
<property name="text">
<string/>
@ -154,6 +147,27 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>OpenCV version :</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Qt version :</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLabel" name="label_version_qt">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>

View File

@ -22,25 +22,25 @@
#include "utilite/UPlot.h"
//#include "utilite/ULogger.h"
#include <QtGui/QGraphicsScene>
#include <QtGui/QGraphicsView>
#include <QtGui/QGraphicsItem>
#include <QtGui/QHBoxLayout>
#include <QtGui/QFormLayout>
#include <QtGui/QResizeEvent>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QGraphicsItem>
#include <QHBoxLayout>
#include <QFormLayout>
#include <QResizeEvent>
#include <QtCore/QTime>
#include <QtCore/QTimer>
#include <QtCore/QFileInfo>
#include <QtGui/QPushButton>
#include <QtGui/QToolButton>
#include <QtGui/QLabel>
#include <QtGui/QMenu>
#include <QtGui/QInputDialog>
#include <QtGui/QMessageBox>
#include <QtGui/QFileDialog>
#include <QtGui/QClipboard>
#include <QtGui/QApplication>
#include <QtGui/QPrinter>
#include <QPushButton>
#include <QToolButton>
#include <QLabel>
#include <QMenu>
#include <QInputDialog>
#include <QMessageBox>
#include <QFileDialog>
#include <QClipboard>
#include <QApplication>
#include <QPrinter>
#ifdef QT_SVG_LIB
#include <QtSvg/QSvgGenerator>
#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);

View File

@ -24,15 +24,15 @@
//#include "utilite/UtiLiteExp.h" // DLL export/import defines
#include <QtGui/QFrame>
#include <QFrame>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtGui/QPen>
#include <QtGui/QBrush>
#include <QtGui/QGraphicsEllipseItem>
#include <QGraphicsEllipseItem>
#include <QtCore/QMutex>
#include <QtGui/QLabel>
#include <QtGui/QPushButton>
#include <QLabel>
#include <QPushButton>
#include <QtCore/QTime>
class QGraphicsView;

View File

@ -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)

View File

@ -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)
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT runtime
BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}" COMPONENT runtime)

View File

@ -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)

View File

@ -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)

View File

@ -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)