From 9a6e5fdf6f99e16dcbed86efe77258b86f43ad63 Mon Sep 17 00:00:00 2001 From: "Peter K. Moss" Date: Mon, 20 Dec 2021 12:12:46 +0100 Subject: [PATCH] QT6 migration (#16) * Feature: qt6 migration (#15) * migrate to QT6 to support qt6 the QRegExp has been changed to QRegularExpression and some attributes and operators have been changed or depricated, which are now fixed * update install instructions for QT6 * remove build workflow since it relies on ubuntu, which is a pain for qt6 * fix versions in install docs --- .github/workflows/build.yml | 21 --------------------- CMakeLists.txt | 15 ++++++++------- docs/install.md | 22 +++++++++++++++++++++- src/helpers.cpp | 4 ++-- src/main.cpp | 1 - src/mainwindow.cpp | 2 +- 6 files changed, 32 insertions(+), 33 deletions(-) delete mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index ee60fe9..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: C/C++ CI - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ubuntu-20.04 - - steps: - - uses: actions/checkout@v2 - - name: Install deps - run: sudo apt update && sudo apt install build-essential g++-10 qt5-default libqt5webengine5 libqt5webenginecore5 qtbase5-dev qtwebengine5-dev - - name: cmake - run: cmake . - - name: make - run: make diff --git a/CMakeLists.txt b/CMakeLists.txt index 5174a58..b09d793 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,12 +8,13 @@ set(CMAKE_CXX_STANDARD_REQUIRED TRUE) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) -find_package(Qt5Core REQUIRED) -find_package(Qt5Widgets REQUIRED) -find_package(Qt5WebEngineCore REQUIRED) -find_package(Qt5WebEngineWidgets REQUIRED) -find_package(Qt5WebChannel REQUIRED) -find_package(Qt5Gui REQUIRED) +# Qt5 libraries +find_package(Qt6Core REQUIRED) +find_package(Qt6Widgets REQUIRED) +find_package(Qt6WebEngineCore REQUIRED) +find_package(Qt6WebEngineWidgets REQUIRED) +find_package(Qt6WebChannel REQUIRED) +find_package(Qt6Gui REQUIRED) set(CMAKE_CXX_FLAGS "-O3 -Wall -Wextra") @@ -28,6 +29,6 @@ add_executable(qmarkdown src/resources/resources.qrc ) -target_link_libraries(qmarkdown Qt5::Widgets Qt5::Core Qt5::WebEngineCore Qt5::WebEngineWidgets Qt5::WebChannel Qt5::Gui stdc++fs) +target_link_libraries(qmarkdown Qt::Widgets Qt::Core Qt::WebEngineCore Qt::WebEngineWidgets Qt::WebChannel Qt::Gui stdc++fs) install(TARGETS qmarkdown DESTINATION ${DESTDIR}${PREFIX}/usr/bin) diff --git a/docs/install.md b/docs/install.md index 91acb49..61fab11 100644 --- a/docs/install.md +++ b/docs/install.md @@ -2,9 +2,11 @@ ## Dependencies -`qt` version `5.9.0` or above, for all the following parts of the library: +`qt` version `6.0.0` or above, for all the following parts of the library: - Core +- Gui +- Network - Widgets - WebChannel - WebView @@ -12,10 +14,20 @@ All development libraries should be installed before compiling. +### Note for versions 0.3.2 and below + +Versions below 0.4 are running QT5 instead of QT6, so you'll need QT5 version `5.9.0` for these builds. + ## Packages ### Ubuntu +#### Version 0.4 and above + +You'll most likely have to compile QT from source since ubuntu doesn't have QT6 libraries... yet! + +#### Version 0.3.2 and below + * `build-essential` * `qt5-default` * `qtbase5-dev` @@ -29,6 +41,14 @@ Sometimes the following packages are also needed: ### Arch based (Pacman) +#### Version 0.4 and above + +* `qt6-base` +* `qt6-webengine` +* `qt6-webchannel` + +#### Version 0.3.2 and below + * `qt5-base` * `qt5-webengine` * `qt5-webchannel` diff --git a/src/helpers.cpp b/src/helpers.cpp index 1b76fd7..7fbc5ff 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -11,12 +11,12 @@ #include #include #include -#include +#include using namespace std; QString get_file(QString path) { - path.replace(QRegExp("(.*/)*"), ""); + path.replace(QRegularExpression("(.*/)*"), ""); return path; } diff --git a/src/main.cpp b/src/main.cpp index 6f20a15..5ab47f0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -71,7 +71,6 @@ void load_args(int argc, char *argv[], QString *file, QString *index_file) { int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName("qMarkdown"); - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication app(argc, argv); QString file; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 60b739d..ee9b683 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -158,7 +158,7 @@ void MainWindow::setupShortcuts() { m_shortcuts[5] = new QShortcut(Qt::Key_L, this, SLOT(scrollRight())); m_shortcuts[6] = new QShortcut(Qt::Key_G, this, SLOT(scrollTop())); - m_shortcuts[7] = new QShortcut(QKeySequence(Qt::Modifier::SHIFT + Qt::Key_G), this, SLOT(scrollBottom())); + m_shortcuts[7] = new QShortcut(QKeySequence(Qt::Modifier::SHIFT | Qt::Key_G), this, SLOT(scrollBottom())); m_shortcuts[8] = new QShortcut(Qt::Key_O, this, SLOT(openFileInput())); m_shortcuts[9] = new QShortcut(Qt::Key_Escape, this, SLOT(closeFileInput()));