Permalink
Browse files

Updated for Qt5

  • Loading branch information...
navzam committed Dec 8, 2013
1 parent b1c233d commit aad677ea6220d0ad5e56f423225979ffb8676f58
Showing with 24 additions and 27 deletions.
  1. +9 −9 CMakeLists.txt
  2. +1 −1 src/console_widget.cpp
  3. +12 −12 src/main_window.cpp
  4. +2 −5 ui/main_window.ui
View
@@ -1,8 +1,9 @@
project(computer)
-cmake_minimum_required(VERSION 2.8.0)
+cmake_minimum_required(VERSION 2.8.12)
-find_package(Qt4 REQUIRED)
+find_package(Qt5Widgets REQUIRED)
+find_package(Qt5PrintSupport REQUIRED)
set(INCLUDE ${computer_SOURCE_DIR}/include)
set(RC ${computer_SOURCE_DIR}/rc)
@@ -12,8 +13,6 @@ set(UI ${computer_SOURCE_DIR}/ui)
include_directories(${computer_BINARY_DIR})
include_directories(${INCLUDE})
-include(${QT_USE_FILE})
-
file(GLOB INCLUDES ${INCLUDE}/*.hpp)
file(GLOB SOURCES ${SRC}/*)
file(GLOB UIS ${UI}/*)
@@ -24,9 +23,9 @@ set(computer_MOC_SRCS ${INCLUDES})
set(computer_QRC_FILES ${RC}/icons.qrc ${RC}/target.qrc)
-qt4_wrap_cpp(computer_SRCS_CXX ${computer_MOC_SRCS})
-qt4_wrap_ui(computer_SRCS_CXX ${computer_UI})
-qt4_add_resources(computer_SRCS_CXX ${computer_QRC_FILES})
+qt5_wrap_cpp(computer_SRCS_CXX ${computer_MOC_SRCS})
+qt5_wrap_ui(computer_SRCS_CXX ${computer_UI})
+qt5_add_resources(computer_SRCS_CXX ${computer_QRC_FILES})
if(WIN32)
set(OPENCV_INSTALL_DIR ${CMAKE_SOURCE_DIR}/../opencv/build/install)
@@ -54,7 +53,8 @@ endif()
set(EXECUTABLE_OUTPUT_PATH ${computer_SOURCE_DIR}/deploy)
set(LIBRARY_OUTPUT_PATH ${computer_SOURCE_DIR}/lib)
-target_link_libraries(computer ${QT_LIBRARIES} pcompiler kovanserial kar kovan)
+qt5_use_modules(computer Widgets PrintSupport)
+target_link_libraries(computer pcompiler kovanserial kar kovan)
if(WIN32)
target_link_libraries(computer opencv_core300 opencv_imgproc300)
@@ -87,7 +87,7 @@ endif()
if(APPLE)
add_custom_target(computer_MacDeployQt ALL
- COMMAND ${QT_BINARY_DIR}/macdeployqt ${computer_SOURCE_DIR}/deploy/computer.app -verbose=0
+ COMMAND ${_qt5Core_install_prefix}/bin/macdeployqt ${computer_SOURCE_DIR}/deploy/computer.app -verbose=0
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
DEPENDS computer)
View
@@ -43,7 +43,7 @@ void ConsoleWidget::keyPressEvent(QKeyEvent *event)
// if(event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) text = "\n";
_current.insert(_current.size() + _offset, text);
- m_process->write(_current.toAscii(), _current.length());
+ m_process->write(_current.toUtf8(), _current.length());
_current = QString();
}
View
@@ -38,14 +38,14 @@ MainWindow::MainWindow(QWidget *parent)
ui->setupUi(this);
setWindowTitle(QUserInfo::username() + "'s Computer");
- connect(ui->actionPrint, SIGNAL(activated()), SLOT(print()));
- connect(ui->actionSave, SIGNAL(activated()), SLOT(saveToFile()));
- connect(ui->actionCopy, SIGNAL(activated()), SLOT(copy()));
- connect(ui->actionStop, SIGNAL(activated()), SLOT(terminateProcess()));
- connect(ui->actionAbout, SIGNAL(activated()), SLOT(about()));
- connect(ui->actionSettings, SIGNAL(activated()), SLOT(settings()));
- connect(ui->actionOpenWorkingDirectory, SIGNAL(activated()), SLOT(openWorkingDir()));
- connect(ui->actionVision, SIGNAL(activated()), SLOT(vision()));
+ connect(ui->actionPrint, SIGNAL(triggered()), SLOT(print()));
+ connect(ui->actionSave, SIGNAL(triggered()), SLOT(saveToFile()));
+ connect(ui->actionCopy, SIGNAL(triggered()), SLOT(copy()));
+ connect(ui->actionStop, SIGNAL(triggered()), SLOT(terminateProcess()));
+ connect(ui->actionAbout, SIGNAL(triggered()), SLOT(about()));
+ connect(ui->actionSettings, SIGNAL(triggered()), SLOT(settings()));
+ connect(ui->actionOpenWorkingDirectory, SIGNAL(triggered()), SLOT(openWorkingDir()));
+ connect(ui->actionVision, SIGNAL(triggered()), SLOT(vision()));
connect(ui->console, SIGNAL(abortRequested()), this, SLOT(terminateProcess()));
ui->programs->setModel(m_archivesModel);
@@ -304,10 +304,10 @@ void MainWindow::updateAdvert()
version += " for *nix";
#endif
- Advert ad(tr("N/A").toAscii(),
- version.toAscii(),
- tr("computer").toAscii(),
- displayName().toAscii(),
+ Advert ad(tr("N/A").toUtf8(),
+ version.toUtf8(),
+ tr("computer").toUtf8(),
+ displayName().toUtf8(),
KOVAN_SERIAL_PORT);
m_heartbeat->setAdvert(ad);
}
View
@@ -21,9 +21,6 @@
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
- <property name="spacing">
- <number>6</number>
- </property>
<property name="margin">
<number>6</number>
</property>
@@ -357,7 +354,7 @@
<connections>
<connection>
<sender>actionZoom_Out</sender>
- <signal>activated()</signal>
+ <signal>triggered()</signal>
<receiver>console</receiver>
<slot>zoomOut()</slot>
<hints>
@@ -373,7 +370,7 @@
</connection>
<connection>
<sender>actionZoom</sender>
- <signal>activated()</signal>
+ <signal>triggered()</signal>
<receiver>console</receiver>
<slot>zoomIn()</slot>
<hints>

0 comments on commit aad677e

Please sign in to comment.