Skip to content

Commit

Permalink
QT6 migration (#16)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Peterwmoss committed Dec 20, 2021
1 parent 979da49 commit 9a6e5fd
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 33 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/build.yml

This file was deleted.

15 changes: 8 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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)
22 changes: 21 additions & 1 deletion docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,32 @@

## 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
- WebEngine

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`
Expand All @@ -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`
Expand Down
4 changes: 2 additions & 2 deletions src/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
#include <QDir>
#include <QFileInfo>
#include <QString>
#include <qregexp.h>
#include <QRegularExpression>

using namespace std;

QString get_file(QString path) {
path.replace(QRegExp("(.*/)*"), "");
path.replace(QRegularExpression("(.*/)*"), "");
return path;
}

Expand Down
1 change: 0 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down

0 comments on commit 9a6e5fd

Please sign in to comment.