Commit 0a126e4a authored by Marco Martin's avatar Marco Martin Committed by Linus Jahn

Use QApplication when QWidgets found (#222)

This way it can use QWidgets based QQC2 styles, in a Plasma Desktop
session, so it will use the breeze style to integrate with other apps.
parent 6d25037f
...@@ -34,8 +34,17 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") ...@@ -34,8 +34,17 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
# Find packages # Find packages
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Qml Quick Sql QuickControls2) find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Qml Quick Sql QuickControls2)
find_package(KF5Kirigami2 REQUIRED) find_package(KF5Kirigami2 REQUIRED)
find_package(Qt5Widgets)
find_package(Gloox REQUIRED) find_package(Gloox REQUIRED)
set_package_properties(Qt5Widgets PROPERTIES DESCRIPTION "Integration with QWidget based desktop styles"
TYPE OPTIONAL
)
if(Qt5Widgets_FOUND)
set(HAVE_QWIDGETS 1)
add_definitions(-DHAVE_QWIDGETS)
endif()
# #
# Load submodules # Load submodules
# #
...@@ -84,6 +93,7 @@ target_link_libraries(${PROJECT_NAME} ...@@ -84,6 +93,7 @@ target_link_libraries(${PROJECT_NAME}
Qt5::Sql Qt5::Sql
Qt5::Qml Qt5::Qml
Qt5::Quick Qt5::Quick
Qt5::Widgets
${GLOOX_LIBRARIES} ${GLOOX_LIBRARIES}
) )
......
...@@ -32,7 +32,11 @@ ...@@ -32,7 +32,11 @@
#include <QCommandLineParser> #include <QCommandLineParser>
#include <QCommandLineOption> #include <QCommandLineOption>
#include <QDebug> #include <QDebug>
#if HAVE_QWIDGETS
#include <QApplication>
#else
#include <QGuiApplication> #include <QGuiApplication>
#endif
#include <QLocale> #include <QLocale>
#include <qqml.h> #include <qqml.h>
#include <QQmlApplicationEngine> #include <QQmlApplicationEngine>
...@@ -92,7 +96,11 @@ int main(int argc, char *argv[]) ...@@ -92,7 +96,11 @@ int main(int argc, char *argv[])
// //
// create a qt app // create a qt app
#if HAVE_QWIDGETS
QApplication app(argc, argv);
#else
QGuiApplication app(argc, argv); QGuiApplication app(argc, argv);
#endif
// name, display name, description // name, display name, description
QGuiApplication::setApplicationName(APPLICATION_NAME); QGuiApplication::setApplicationName(APPLICATION_NAME);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment