feat: do not use QtWidgets on android and set platform style
parent
d03e38719e
commit
db6d4742e3
|
@ -36,7 +36,7 @@ set(keysmith_internal_libs keysmith_lib)
|
||||||
qt5_add_resources(RESOURCES resources.qrc)
|
qt5_add_resources(RESOURCES resources.qrc)
|
||||||
add_executable(keysmith ${keysmith_SRCS} ${RESOURCES})
|
add_executable(keysmith ${keysmith_SRCS} ${RESOURCES})
|
||||||
target_link_libraries(keysmith
|
target_link_libraries(keysmith
|
||||||
Qt5::Core Qt5::Gui Qt5::Qml Qt5::Quick Qt5::Svg
|
Qt5::Core Qt5::Gui Qt5::Qml Qt5::Quick Qt5::Svg Qt5::QuickControls2
|
||||||
KF5::I18n
|
KF5::I18n
|
||||||
${keysmith_internal_libs}
|
${keysmith_internal_libs}
|
||||||
)
|
)
|
||||||
|
|
18
src/main.cpp
18
src/main.cpp
|
@ -4,12 +4,18 @@
|
||||||
* SPDX-FileCopyrightText: 2020-2021 Johan Ouwerkerk <jm.ouwerkerk@gmail.com>
|
* SPDX-FileCopyrightText: 2020-2021 Johan Ouwerkerk <jm.ouwerkerk@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
#include <QQmlApplicationEngine>
|
#include <QQmlApplicationEngine>
|
||||||
|
#include <QQuickStyle>
|
||||||
#include <QtQml>
|
#include <QtQml>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
|
#ifdef Q_OS_ANDROID
|
||||||
|
#include <QGuiApplication>
|
||||||
|
#else
|
||||||
|
#include <QApplication>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <KLocalizedContext>
|
#include <KLocalizedContext>
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
|
|
||||||
|
@ -42,7 +48,17 @@ static QQmlDebuggingEnabler enabler;
|
||||||
Q_DECL_EXPORT int main(int argc, char *argv[])
|
Q_DECL_EXPORT int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
|
|
||||||
|
#ifdef Q_OS_ANDROID
|
||||||
|
QGuiApplication app(argc, argv);
|
||||||
|
QQuickStyle::setStyle(QStringLiteral("Material"));
|
||||||
|
#else
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) {
|
||||||
|
QQuickStyle::setStyle(QStringLiteral("org.kde.desktop"));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
KLocalizedString::setApplicationDomain("keysmith");
|
KLocalizedString::setApplicationDomain("keysmith");
|
||||||
|
|
||||||
QCoreApplication::setOrganizationName(QStringLiteral("KDE"));
|
QCoreApplication::setOrganizationName(QStringLiteral("KDE"));
|
||||||
|
|
Loading…
Reference in New Issue