core: use QApplication and respect user theme choice (#6)

Fixes qqc2-desktop-style usage
This commit is contained in:
outfoxxed 2024-10-13 16:26:29 -07:00 committed by GitHub
parent 49f20fbcc5
commit 52a32d3afe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 5 deletions

View File

@ -8,7 +8,7 @@ project(hsi VERSION ${VER} LANGUAGES CXX)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt6 6.5 REQUIRED COMPONENTS Quick QuickControls2)
find_package(Qt6 6.5 REQUIRED COMPONENTS Widgets Quick QuickControls2)
find_package(PkgConfig REQUIRED)
set(CMAKE_CXX_STANDARD 23)
@ -41,7 +41,7 @@ qt_add_resources(hyprsysteminfo "resource"
)
target_link_libraries(hyprsysteminfo
PRIVATE Qt6::Quick Qt6::Gui Qt6::QuickControls2 PkgConfig::deps
PRIVATE Qt6::Widgets Qt6::Quick Qt6::Gui Qt6::QuickControls2 PkgConfig::deps
)
include(GNUInstallDirs)

View File

@ -1,6 +1,6 @@
#include "qmlSources/SystemIconProvider.hpp"
#include "qmlSources/SystemInternals.hpp"
#include <QGuiApplication>
#include <QApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QQuickStyle>
@ -11,6 +11,7 @@
#include <hyprutils/string/VarList.hpp>
#include <hyprutils/string/String.hpp>
#include <qtenvironmentvariables.h>
using namespace Hyprutils::String;
static std::string readFile(const std::string& filename) {
@ -205,10 +206,11 @@ static void getSystemInfo(CSystemInternals* hsi, QGuiApplication* app) {
}
int main(int argc, char* argv[]) {
QGuiApplication app(argc, argv);
QApplication app(argc, argv);
app.setApplicationName("Hyprland System Info");
if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE"))
QQuickStyle::setStyle("org.kde.desktop");
auto systemInternals = new CSystemInternals;