diff options
author | Florent Revest <revestflo@gmail.com> | 2016-02-08 18:16:02 +0100 |
---|---|---|
committer | Florent Revest <revestflo@gmail.com> | 2016-02-08 18:16:02 +0100 |
commit | ff0201bc23545d6794b43f6a5fd558cfcdd29e15 (patch) | |
tree | c67d89eb9043b4a7578074c87af504836213ef08 /main.cpp | |
parent | cdcf5e8496b51091f9d71a6a52a588a97686c49d (diff) |
Use MDeclarativeCache from mapplauncherd to get faster startup
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 30 |
1 files changed, 10 insertions, 20 deletions
@@ -15,26 +15,16 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <QtQml> -#include <QtQuick/QQuickView> -#include <QtCore/QString> -#include <QScreen> -#include <QtGui/QGuiApplication> +#include <QQuickView> +#include <QGuiApplication> +#include <MDeclarativeCache> -int main(int argc, char *argv[]) +Q_DECL_EXPORT int main(int argc, char *argv[]) { - QGuiApplication app(argc, argv); - QScreen* sc = app.primaryScreen(); - if(sc) { - sc->setOrientationUpdateMask(Qt::LandscapeOrientation | Qt::PortraitOrientation | Qt::InvertedLandscapeOrientation | Qt::InvertedPortraitOrientation); - } - QQmlApplicationEngine engine(QUrl("qrc:/main.qml")); - QObject *topLevel = engine.rootObjects().value(0); - QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel); - if(!window) { - qWarning("Error: Your root item has to be a Window."); - return -1; - } - window->showFullScreen(); - return app.exec(); + QScopedPointer<QGuiApplication> app(MDeclarativeCache::qApplication(argc, argv)); + QScopedPointer<QQuickView> view(MDeclarativeCache::qQuickView()); + view->setSource(QUrl("qrc:/main.qml")); + view->setTitle("Stopwatch"); + view->showFullScreen(); + return app->exec(); } |