34 lines
1 KiB
C++
34 lines
1 KiB
C++
#include <QApplication>
|
|
#include <QQmlApplicationEngine>
|
|
#include <QtQml>
|
|
#include <QUrl>
|
|
#include <QQuickStyle>
|
|
#include <KLocalizedContext>
|
|
#include <KLocalizedString>
|
|
#include <qcoreapplication.h>
|
|
#include <qstringliteral.h>
|
|
|
|
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"));
|
|
QCoreApplication::setApplicationVersion(QStringLiteral("0.1.0"));
|
|
|
|
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();
|
|
}
|