32 lines
910 B
C++
32 lines
910 B
C++
|
#include <QApplication>
|
||
|
#include <QQmlApplicationEngine>
|
||
|
#include <QtQml>
|
||
|
#include <QUrl>
|
||
|
#include <QQuickStyle>
|
||
|
#include <KLocalizedContext>
|
||
|
#include <KLocalizedString>
|
||
|
|
||
|
int main(int argc, char *argv[])
|
||
|
{
|
||
|
QApplication app(argc, argv);
|
||
|
KLocalizedString::setApplicationDomain("helloworld");
|
||
|
QCoreApplication::setOrganizationName(QStringLiteral("KDE"));
|
||
|
QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org"));
|
||
|
QCoreApplication::setApplicationName(QStringLiteral("Hello World"));
|
||
|
|
||
|
if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) {
|
||
|
QQuickStyle::setStyle(QStringLiteral("org.kde.desktop"));
|
||
|
}
|
||
|
|
||
|
QQmlApplicationEngine engine;
|
||
|
|
||
|
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
|
||
|
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
||
|
|
||
|
if (engine.rootObjects().isEmpty()) {
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
return app.exec();
|
||
|
}
|