diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f18e9bcf023312eaacc23bd2659ae9b5e4683c1..715ec799bc08917597e516de51db1dad88400811 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,13 +43,16 @@ if(NOT UBUNTU_TOUCH) DESCRIPTION "Integration with QWidget based desktop styles" TYPE OPTIONAL ) - if(Qt5Widgets_FOUND) - set(HAVE_QWIDGETS 1) - add_definitions(-DHAVE_QWIDGETS) - set(__Qt5Widgets_LIBRARIES Qt5::Widgets) - endif() endif() +if(Qt5Widgets_FOUND) + add_definitions(-DHAVE_QWIDGETS -DQAPPLICATION_CLASS=QApplication) + set(__Qt5Widgets_LIBRARIES Qt5::Widgets) +else() + add_definitions(-DQAPPLICATION_CLASS=QGuiApplication) +endif() + + # # Load submodules # diff --git a/src/main.cpp b/src/main.cpp index be4189dc7abe4b14f1f07e20507b0fb1cc30304f..2059a8e5f259b262bedc39cf594fff3cfd7208f0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -32,11 +32,6 @@ #include #include #include -#if HAVE_QWIDGETS -#include -#else -#include -#endif #include #include #include @@ -54,6 +49,12 @@ #include "Globals.h" #include "Enums.h" #include "StatusBar.h" + +#ifndef QAPPLICATION_CLASS +#define QAPPLICATION_CLASS QApplication +#endif +#include QT_STRINGIFY(QAPPLICATION_CLASS) + // SingleApplication (Qt5 replacement for QtSingleApplication) #include "singleapp/singleapplication.h"