Skip to content

Commit

Permalink
core: use QApplication and respect user theme choice (#6)
Browse files Browse the repository at this point in the history
Fixes qqc2-desktop-style usage
  • Loading branch information
outfoxxed authored Oct 13, 2024
1 parent 49f20fb commit 52a32d3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down
8 changes: 5 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "qmlSources/SystemIconProvider.hpp"
#include "qmlSources/SystemInternals.hpp"
#include <QGuiApplication>
#include <QApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QQuickStyle>
Expand All @@ -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) {
Expand Down Expand Up @@ -205,11 +206,12 @@ 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");

QQuickStyle::setStyle("org.kde.desktop");
if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE"))
QQuickStyle::setStyle("org.kde.desktop");

auto systemInternals = new CSystemInternals;

Expand Down

0 comments on commit 52a32d3

Please sign in to comment.