Skip to content

Commit

Permalink
For #4: Explicitly setting Qt Quick style
Browse files Browse the repository at this point in the history
  • Loading branch information
retifrav committed May 15, 2023
1 parent 21b9b34 commit 2f9bf4b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ set(CMAKE_AUTORCC ON)
#set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# building with Qt 5 would requite some changes, so Qt 6 is explicitly the one
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml Charts Multimedia)
find_package(Qt6 REQUIRED COMPONENTS Core Quick QuickControls2 Qml Charts Multimedia)

qt_standard_project_setup()

Expand Down Expand Up @@ -119,6 +119,7 @@ target_include_directories(${CMAKE_PROJECT_NAME}
target_link_libraries(${CMAKE_PROJECT_NAME}
PRIVATE
Qt${QT_VERSION_MAJOR}::Quick
Qt${QT_VERSION_MAJOR}::QuickControls2
Qt${QT_VERSION_MAJOR}::Qml
Qt${QT_VERSION_MAJOR}::Charts
Qt${QT_VERSION_MAJOR}::Multimedia
Expand Down
5 changes: 5 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <QQmlContext>
#include <QFont>
#include <QScreen>
#include <QQuickStyle>

#include "backend.h"

int main(int argc, char *argv[])
Expand Down Expand Up @@ -107,6 +109,9 @@ int main(int argc, char *argv[])
}
//qDebug() << "Debug mode:" << debugMode << "|" << "host:" << host2ping;

// starting with Qt 6 one needs to specify the style
QQuickStyle::setStyle("Basic");

// https://doc.qt.io/qt-5/scalability.html#calculating-scaling-ratio
qreal refDpi = 216.;
qreal refHeight = 1776.;
Expand Down

0 comments on commit 2f9bf4b

Please sign in to comment.