Skip to content

Commit

Permalink
feat: use fusion theme
Browse files Browse the repository at this point in the history
  • Loading branch information
mhduiy committed Nov 9, 2024
1 parent 2384c4b commit 35fea04
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ set(SRC_PATHS
src/main.cpp
)

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Quick Widgets Gui Network WebSockets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Quick Widgets Gui Network WebSockets)
set(QT_VERSION_MAJOR 6)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Quick Widgets Gui Network WebSockets QuickControls2)

include_directories(.)

Expand Down Expand Up @@ -74,7 +74,7 @@ foreach(MFloat_QRC_FILE ${MFloat_QRC_FILE_LIST})
)
endforeach()

qt6_add_qml_module(${PROJECT_NAME}
qt_add_qml_module(${PROJECT_NAME}
URI MFloat
VERSION 1.0
RESOURCES ${CMAKE_SOURCE_DIR}/src/MFloat/mfloat.qrc
Expand All @@ -91,4 +91,5 @@ target_link_libraries(${PROJECT_NAME} PRIVATE
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Network
Qt${QT_VERSION_MAJOR}::WebSockets
Qt${QT_VERSION_MAJOR}::QuickControls2
)
4 changes: 4 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include <QThread>
#include <QQuickItem>
#include <QElapsedTimer>
#include <QStyleFactory>
#include <QQuickStyle>

#include "cpp/adb/connectmanager.h"
#include "cpp/infoPageTool/infopagetool.h"
Expand All @@ -24,6 +26,8 @@ int main(int argc, char *argv[])
qunsetenv("https_proxy");
#endif

QApplication::setStyle(QStyleFactory::create("fusion")); //应用Qt原生样式
QQuickStyle::setStyle("Fusion");
QElapsedTimer loaderTimer;
loaderTimer.start();

Expand Down

0 comments on commit 35fea04

Please sign in to comment.