Commit be0eef9d authored by Carl Schwan's avatar Carl Schwan 🚴
Browse files

Use QtQuick Controls 2 desktop style on the desktop

Also move some ifdef to a more modern style.
parent 9ed37d77
......@@ -11,7 +11,7 @@ project(kalgebra VERSION ${RELEASE_SERVICE_VERSION})
find_package(ECM 1.7.0 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${ECM_MODULE_PATH})
find_package(Qt5 5.2 REQUIRED NO_MODULE COMPONENTS Qml Quick Xml Svg PrintSupport Test)
find_package(Qt5 5.14 REQUIRED NO_MODULE COMPONENTS Qml Quick Xml Svg PrintSupport Test)
include(KDEInstallDirs)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(KDECMakeSettings)
......
......@@ -12,13 +12,17 @@ target_link_libraries(kalgebramobile Qt5::Qml Qt5::Quick Qt5::Gui
set(DESKTOPFILE_INSTALL ${KDE_INSTALL_APPDIR})
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
if(ANDROID)
# Material requires QtSvg for icons
# if we don't link it here explicitly, androiddeployqt doesn't bring it
find_package(Qt5Svg REQUIRED)
find_package(Qt5QuickControls2 REQUIRED)
find_package(KF5Kirigami2 REQUIRED)
kirigami_package_breeze_icons(ICONS list-add)
target_link_libraries(kalgebramobile Qt5::Svg KF5::Kirigami2)
target_link_libraries(kalgebramobile Qt5::Svg KF5::Kirigami2 Qt5::QuickControls2)
else()
find_package(Qt5Widgets REQUIRED)
target_link_libraries(kalgebramobile Qt5::Widgets)
endif()
install(TARGETS kalgebramobile ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
......
......@@ -17,6 +17,10 @@
*************************************************************************************/
#include <QGuiApplication>
#ifndef Q_OS_ANDROID
#include <QApplication>
#include <QQuickStyle>
#endif
#include <KLocalizedContext>
#include <KLocalizedString>
......@@ -38,11 +42,15 @@
Q_DECL_EXPORT int main(int argc, char *argv[])
{
#ifdef __ANDROID__
qputenv("QT_QUICK_CONTROLS_STYLE", "Material");
#ifdef Q_OS_ANDROID
QQuickStyle::setStyle("Material");
#endif
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#ifdef Q_OS_ANDROID
QGuiApplication app(argc, argv);
#else
QApplication app(argc, argv);
#endif
KLocalizedString::setApplicationDomain("kalgebramobile");
KAboutData about(QStringLiteral("kalgebramobile"), QStringLiteral("KAlgebra"), QStringLiteral(KALGEBRA_VERSION_STRING), i18n("A portable calculator"),
KAboutLicense::GPL, i18n("(C) 2006-2020 Aleix Pol i Gonzalez"));
......
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