diff --git a/BatteryQuick/BatteryQuick.pro b/BatteryQuick/BatteryQuick.pro index 1271e23..669a189 100644 --- a/BatteryQuick/BatteryQuick.pro +++ b/BatteryQuick/BatteryQuick.pro @@ -4,7 +4,7 @@ SOURCES += \ main.cc resources.files = Main.qml -resources.prefix = /qml +resources.prefix = /qt/qml/BatteryQuickResources RESOURCES += resources # Additional import path used to resolve QML modules in Qt Creator's code model diff --git a/BatteryQuick/CMakeLists.txt b/BatteryQuick/CMakeLists.txt index e2580ce..e3a2cbc 100644 --- a/BatteryQuick/CMakeLists.txt +++ b/BatteryQuick/CMakeLists.txt @@ -3,7 +3,7 @@ qt_add_executable(BatteryQuick main.cc) qt_add_qml_module( BatteryQuick URI - qml + BatteryQuickResources VERSION 1.0 QML_FILES @@ -23,3 +23,10 @@ set_target_properties( WIN32_EXECUTABLE TRUE) target_link_libraries(BatteryQuick PRIVATE Qt6::Quick) + +include(GNUInstallDirs) +install( + TARGETS BatteryQuick + BUNDLE DESTINATION . + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/BatteryQuick/main.cc b/BatteryQuick/main.cc index 0a43b3c..ad007cd 100644 --- a/BatteryQuick/main.cc +++ b/BatteryQuick/main.cc @@ -6,15 +6,14 @@ auto main(int argc, char *argv[]) -> int QGuiApplication app(argc, argv); QQmlApplicationEngine engine; - const QUrl url(u"qrc:/qml/Main.qml"_qs); + const QUrl url(QStringLiteral("qrc:/qt/qml/BatteryQuickResources/Main.qml")); QObject::connect( &engine, &QQmlApplicationEngine::objectCreated, &app, [url](QObject *obj, const QUrl &objUrl) { - if ((obj == nullptr) && url == objUrl) { + if (!obj && url == objUrl) QCoreApplication::exit(-1); - } }, Qt::QueuedConnection); engine.load(url); diff --git a/BubbleWindow/bubblewidget.cpp b/BubbleWindow/bubblewidget.cpp index 68edd29..6f5660c 100644 --- a/BubbleWindow/bubblewidget.cpp +++ b/BubbleWindow/bubblewidget.cpp @@ -137,6 +137,8 @@ void BubbleWidget::exec() void BubbleWidget::paintEvent(QPaintEvent *event) { + Q_UNUSED(event) + QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing); painter.setPen(d_ptr->pen); diff --git a/CMakeLists.txt b/CMakeLists.txt index d71e411..ddfb17d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ project( include(cmake/common.cmake) find_package( - Qt6 REQUIRED + Qt6 6.5 REQUIRED COMPONENTS Core Widgets Charts @@ -21,8 +21,8 @@ find_package( Sql Quick) -qt_standard_project_setup(I18N_SOURCE_LANGUAGE en I18N_TRANSLATED_LANGUAGES - zh_CN) +qt_standard_project_setup(REQUIRES 6.5) +qt_policy(SET QTP0001 NEW) # qt_standard_project_setup will set CMAKE_RUNTIME_OUTPUT_DIRECTORY, we need to # set it back, and use EXECUTABLE_OUTPUT_PATH unset(CMAKE_RUNTIME_OUTPUT_DIRECTORY) diff --git a/TreeViewModel/listview.cc b/TreeViewModel/listview.cc index 80b6f4b..50ee63a 100644 --- a/TreeViewModel/listview.cc +++ b/TreeViewModel/listview.cc @@ -66,6 +66,8 @@ void ListView::onSelectionChanged(const QItemSelection &selected, const QItemSel void ListView::onDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) { + Q_UNUSED(bottomRight) + if (!topLeft.isValid()) { return; } diff --git a/TreeViewModel/normaltreeview.cc b/TreeViewModel/normaltreeview.cc index d2de083..7c73d55 100644 --- a/TreeViewModel/normaltreeview.cc +++ b/TreeViewModel/normaltreeview.cc @@ -34,6 +34,8 @@ auto NormalTreeModel::rowCount(const QModelIndex &idx) const -> int auto NormalTreeModel::headerData(int section, Qt::Orientation orientation, int role) const -> QVariant { + Q_UNUSED(orientation) + switch (role) { case Qt::TextAlignmentRole: return Qt::AlignVCenter; case Qt::CheckStateRole: { diff --git a/TreeViewModel/normaltreeview.hpp b/TreeViewModel/normaltreeview.hpp index 58a65a6..e5c610b 100644 --- a/TreeViewModel/normaltreeview.hpp +++ b/TreeViewModel/normaltreeview.hpp @@ -21,6 +21,7 @@ class NormalTreeModel : public BaseTreeModel protected: [[nodiscard]] auto columnCount(const QModelIndex &idx) const -> int override { + Q_UNUSED(idx) return m_headerList.size(); } [[nodiscard]] auto headerData(int section, Qt::Orientation orientation, int role) const