diff --git a/CMakeLists.txt b/CMakeLists.txt index 87664ac..0e73db2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,6 @@ cmake_minimum_required( VERSION 2.8 ) project(qtermwidget) -option(USE_QT5 "Build using Qt5. Default OFF." OFF) option(BUILD_TEST "Build test application. Default OFF." OFF) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") @@ -25,13 +24,8 @@ include_directories( add_definitions(-Wall) -if(USE_QT5) - set(QTERMWIDGET_LIBRARY_NAME qtermwidget5) - include(qtermwidget5_use) -else() - include(qtermwidget4_use) - set(QTERMWIDGET_LIBRARY_NAME qtermwidget4) -endif() +set(QTERMWIDGET_LIBRARY_NAME qtermwidget5) +include(qtermwidget5_use) # main library @@ -110,17 +104,9 @@ if(HAVE_UPDWTMPX) add_definitions(-DHAVE_UPDWTMPX) endif() - -if(USE_QT5) - qt5_wrap_cpp(MOCS ${HDRS}) - qt5_wrap_ui(UI_SRCS ${UI}) - set(PKG_CONFIG_REQ "Qt5Core, Qt5Xml, Qt5Widgets") -else() - qt4_wrap_cpp(MOCS ${HDRS}) - qt4_wrap_ui(UI_SRCS ${UI}) - set(PKG_CONFIG_REQ "QtCore, QtXml") -endif() - +qt5_wrap_cpp(MOCS ${HDRS}) +qt5_wrap_ui(UI_SRCS ${UI}) +set(PKG_CONFIG_REQ "Qt5Core, Qt5Xml, Qt5Widgets") add_library(${QTERMWIDGET_LIBRARY_NAME} SHARED ${SRCS} ${MOCS} ${UI_SRCS}) target_link_libraries(${QTERMWIDGET_LIBRARY_NAME} ${QTERMWIDGET_QT_LIBRARIES}) diff --git a/INSTALL b/INSTALL index e26c91a..1053de7 100644 --- a/INSTALL +++ b/INSTALL @@ -1,6 +1,6 @@ Requirements: - Qt4 or Qt5 + Qt >= 5.4 cmake Supported (tested) platforms: @@ -15,8 +15,7 @@ Build: http://www.cmake.org/Wiki/CMake_FAQ#Out-of-source_build_trees 1) mkdir -p build && cd build - 2a) cmake path/to/source -DUSE_QT5=true # Qt 5 - 2b) cmake path/to/source # Qt 4 only + 2) cmake path/to/source 3) make 4) optional: make install diff --git a/cmake/qtermwidget4-config.cmake.in b/cmake/qtermwidget4-config.cmake.in deleted file mode 100644 index 7f3a10f..0000000 --- a/cmake/qtermwidget4-config.cmake.in +++ /dev/null @@ -1,47 +0,0 @@ -# - Find the QTermWidget include and library dirs and define a some macros -# -# The module defines the following variables -# QTERMWIDGET_FOUND - Set to TRUE if all of the above has been found -# -# QTERMWIDGET_INCLUDE_DIR - The QTermWidget include directory -# -# QTERMWIDGET_INCLUDE_DIRS - The QTermWidget include directory -# -# QTERMWIDGET_LIBRARIES - The libraries needed to use QTermWidget -# -# QTERMWIDGET_USE_FILE - The variable QTERMWIDGET_USE_FILE is set which is the path -# to a CMake file that can be included to compile qtermwidget -# applications and libraries. It sets up the compilation -# environment for include directories and populates a -# QTERMWIDGET_LIBRARIES variable. -# -# QTERMWIDGET_QT_LIBRARIES - The Qt libraries needed by QTermWidget -# -# Typical usage: -# option(USE_QT5 "Build using Qt5. Default off" OFF) -# if (USE_QT5) -# find_package(QTERMWIDGET4) -# else() -# find_package(QTERMWIDGET5) -# endif() -# -# include(${QTERMWIDGET_USE_FILE}) -# add_executable(foo main.cpp) -# target_link_libraries(foo ${QTERMWIDGET_QT_LIBRARIES} ${QTERMWIDGET_LIBRARIES}) - -set(QTERMWIDGET_INCLUDE_DIR @QTERMWIDGET_INCLUDE_DIR@) -set(QTERMWIDGET_LIBRARY @QTERMWIDGET_LIBRARY_NAME@) - -set(QTERMWIDGET_LIBRARIES ${QTERMWIDGET_LIBRARY}) -set(QTERMWIDGET_INCLUDE_DIRS "${QTERMWIDGET_INCLUDE_DIR}") - -set(QTERMWIDGET_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/qtermwidget4_use.cmake") -set(QTERMWIDGET_FOUND 1) - -set(QTERMWIDGET_VERSION_MAJOR @QTERMWIDGET_VERSION_MAJOR@) -set(QTERMWIDGET_VERSION_MINOR @QTERMWIDGET_VERSION_MINOR@) -set(QTERMWIDGET_VERSION_PATCH @QTERMWIDGET_VERSION_PATCH@) -set(QTERMWIDGET_VERSION @QTERMWIDGET_VERSION@) - -mark_as_advanced(QTERMWIDGET_LIBRARY QTERMWIDGET_INCLUDE_DIR) - diff --git a/cmake/qtermwidget5-config.cmake.in b/cmake/qtermwidget5-config.cmake.in index 5f8edb9..83295e4 100644 --- a/cmake/qtermwidget5-config.cmake.in +++ b/cmake/qtermwidget5-config.cmake.in @@ -18,12 +18,7 @@ # QTERMWIDGET_QT_LIBRARIES - The Qt libraries needed by QTermWidget # # Typical usage: -# option(USE_QT5 "Build using Qt5. Default off" OFF) -# if (USE_QT5) -# find_package(QTERMWIDGET4) -# else() -# find_package(QTERMWIDGET5) -# endif() +# find_package(QTERMWIDGET5) # # include(${QTERMWIDGET_USE_FILE}) # add_executable(foo main.cpp) @@ -44,4 +39,3 @@ set(QTERMWIDGET_VERSION_PATCH @QTERMWIDGET_VERSION_PATCH@) set(QTERMWIDGET_VERSION @QTERMWIDGET_VERSION@) mark_as_advanced(QTERMWIDGET_LIBRARY QTERMWIDGET_INCLUDE_DIR) - diff --git a/lib/Session.cpp b/lib/Session.cpp index 7d2a773..42d93c3 100644 --- a/lib/Session.cpp +++ b/lib/Session.cpp @@ -121,42 +121,11 @@ Session::Session(QObject* parent) : WId Session::windowId() const { - // Returns a window ID for this session which is used - // to set the WINDOWID environment variable in the shell - // process. - // - // Sessions can have multiple views or no views, which means - // that a single ID is not always going to be accurate. - // - // If there are no views, the window ID is just 0. If - // there are multiple views, then the window ID for the - // top-level window which contains the first view is - // returned - // - // On Qt5, requesting window IDs breaks QQuickWidget and the likes, - // for example, see the following bug reports: - // - // https://bugreports.qt-project.org/browse/QTBUG-41779 - // https://bugreports.qt-project.org/browse/QTBUG-40765 - // https://bugreports.qt-project.org/browse/QTBUG-41942 - -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) - return 0; -#else - if ( _views.count() == 0 ) { - return 0; - } else { - QWidget * window = _views.first(); - - Q_ASSERT( window ); - - while ( window->parentWidget() != 0 ) { - window = window->parentWidget(); - } - - return window->winId(); - } -#endif + // On Qt5, requesting window IDs breaks QQuickWidget and the likes, + // for example, see the following bug reports: + // https://bugreports.qt.io/browse/QTBUG-40765 + // https://codereview.qt-project.org/#/c/94880/ + return 0; } void Session::setDarkBackground(bool darkBackground) diff --git a/lib/TerminalDisplay.cpp b/lib/TerminalDisplay.cpp index 18b0f47..ad8b94d 100644 --- a/lib/TerminalDisplay.cpp +++ b/lib/TerminalDisplay.cpp @@ -726,15 +726,11 @@ void TerminalDisplay::drawCharacters(QPainter& painter, // the application's default layout direction to be used instead of // the widget-specific layout direction, which should always be // Qt::LeftToRight for this widget - // This was discussed in: http://lists.kde.org/?t=120552223600002&r=1&w=2 + // This was discussed in: http://lists.kde.org/?t=120552223600002&r=1&w=2 if (_bidiEnabled) painter.drawText(rect,0,text); else -#if QT_VERSION >= 0x040800 painter.drawText(rect, Qt::AlignBottom, LTR_OVERRIDE_CHAR + text); -#else - painter.drawText(rect, 0, LTR_OVERRIDE_CHAR + text); -#endif } }