diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6d001cfc..c1a0b310 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,7 @@ jobs: qt_ver: 6 qt_host: linux qt_version: '6.2.4' - qt_modules: 'qt5compat qtimageformats' + qt_modules: 'qt5compat qtimageformats qtcharts' - os: windows-2022 name: "Windows-Legacy" @@ -44,7 +44,7 @@ jobs: qt_ver: 6 qt_host: mac qt_version: '6.3.0' - qt_modules: 'qt5compat qtimageformats' + qt_modules: 'qt5compat qtimageformats qtcharts' - os: macos-12 name: macOS-Legacy @@ -52,7 +52,7 @@ jobs: qt_ver: 5 qt_host: mac qt_version: '5.15.2' - qt_modules: '' + qt_modules: 'qtcharts' runs-on: ${{ matrix.os }} @@ -97,6 +97,7 @@ jobs: qt${{ matrix.qt_ver }}-base:p qt${{ matrix.qt_ver }}-svg:p qt${{ matrix.qt_ver }}-imageformats:p + qt${{ matrix.qt_ver }}-charts:p quazip-qt${{ matrix.qt_ver }}:p ccache:p nsis:p @@ -154,7 +155,7 @@ jobs: - name: Install Qt (Linux) if: runner.os == 'Linux' && matrix.qt_ver != 6 run: | - sudo apt-get -y install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5core5a libqt5network5 libqt5gui5 + sudo apt-get -y install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5core5a libqt5network5 libqt5gui5 libqt5charts5-dev - name: Install Qt (macOS and AppImage) if: runner.os == 'Linux' && matrix.qt_ver == 6 || runner.os == 'macOS' diff --git a/CMakeLists.txt b/CMakeLists.txt index f4f099af..318db208 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -150,7 +150,8 @@ set(Launcher_BUILD_TIMESTAMP "${TODAY}") include(QtVersionlessBackport) if(Launcher_QT_VERSION_MAJOR EQUAL 5) set(QT_VERSION_MAJOR 5) - find_package(Qt5 REQUIRED COMPONENTS Core Widgets Concurrent Network Test Xml) + find_package(Qt5 REQUIRED COMPONENTS Core Widgets Concurrent Network Test + Xml Charts) if(NOT Launcher_FORCE_BUNDLED_LIBS) find_package(QuaZip-Qt5 1.3 QUIET) @@ -164,7 +165,8 @@ if(Launcher_QT_VERSION_MAJOR EQUAL 5) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUNICODE -D_UNICODE") elseif(Launcher_QT_VERSION_MAJOR EQUAL 6) set(QT_VERSION_MAJOR 6) - find_package(Qt6 REQUIRED COMPONENTS Core Widgets Concurrent Network Test Xml Core5Compat) + find_package(Qt6 REQUIRED COMPONENTS Core Widgets Concurrent Network Test + Xml Charts Core5Compat) list(APPEND Launcher_QT_LIBS Qt6::Core5Compat) if(NOT Launcher_FORCE_BUNDLED_LIBS) diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 77b4b8d6..3594e2e6 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -996,7 +996,7 @@ target_link_libraries(Launcher_logic Qt${QT_VERSION_MAJOR}::Concurrent Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Widgets - Qt${QT_VERSION_MAJOR}Charts + Qt${QT_VERSION_MAJOR}::Charts ${Launcher_QT_LIBS} ) target_link_libraries(Launcher_logic diff --git a/launcher/ui/pages/instance/StoragePage.cpp b/launcher/ui/pages/instance/StoragePage.cpp index 5e421474..dc17f0b7 100644 --- a/launcher/ui/pages/instance/StoragePage.cpp +++ b/launcher/ui/pages/instance/StoragePage.cpp @@ -50,11 +50,11 @@ StoragePage::StoragePage(BaseInstance* inst, QWidget* parent) : QWidget(parent), m_confirmation_box->addButton(QMessageBox::No); m_confirmation_box->setDefaultButton(QMessageBox::No); - m_series = new QtCharts::QPieSeries(this); + m_series = new QPieSeries(this); m_series->setLabelsVisible(); - m_series->setLabelsPosition(QtCharts::QPieSlice::LabelInsideHorizontal); - m_chart_view = new QtCharts::QChartView(this); - m_chart = new QtCharts::QChart(); + m_series->setLabelsPosition(QPieSlice::LabelInsideHorizontal); + m_chart_view = new QChartView(this); + m_chart = new QChart(); m_chart->setParent(this); m_chart->addSeries(m_series); m_chart->setBackgroundVisible(false); diff --git a/launcher/ui/pages/instance/StoragePage.h b/launcher/ui/pages/instance/StoragePage.h index 6254f3b2..6cee9966 100644 --- a/launcher/ui/pages/instance/StoragePage.h +++ b/launcher/ui/pages/instance/StoragePage.h @@ -31,6 +31,10 @@ #include #include +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +using namespace QtCharts; +#endif + namespace Ui { class StoragePage; @@ -75,9 +79,9 @@ private: Ui::StoragePage *ui; BaseInstance *m_inst; - QtCharts::QPieSeries *m_series; - QtCharts::QChart *m_chart; - QtCharts::QChartView *m_chart_view; + QPieSeries *m_series; + QChart *m_chart; + QChartView *m_chart_view; QMessageBox *m_confirmation_box; };