diff options
-rw-r--r-- | asteroid-stopwatch.desktop | 2 | ||||
-rw-r--r-- | asteroid-stopwatch.pro | 2 | ||||
-rw-r--r-- | main.cpp | 30 | ||||
-rw-r--r-- | main.qml | 4 |
4 files changed, 15 insertions, 23 deletions
diff --git a/asteroid-stopwatch.desktop b/asteroid-stopwatch.desktop index 4f80516..ba8ce7b 100644 --- a/asteroid-stopwatch.desktop +++ b/asteroid-stopwatch.desktop @@ -2,6 +2,6 @@ Type=Application Name=Stopwatch Categories=Applications; -Exec=env QT_QUICK_CONTROLS_STYLE=Asteroid /usr/bin/asteroid-stopwatch +Exec=invoker --type=qtcomponents-qt5 /usr/bin/asteroid-stopwatch Icon=clock X-Desktop-File-Install-Version=0.20 diff --git a/asteroid-stopwatch.pro b/asteroid-stopwatch.pro index 387ddf3..8647880 100644 --- a/asteroid-stopwatch.pro +++ b/asteroid-stopwatch.pro @@ -1,6 +1,8 @@ TEMPLATE = app QT += widgets qml quick xml svg QTPLUGIN += qsvg +CONFIG += link_pkgconfig +PKGCONFIG += qdeclarative5-boostable SOURCES += main.cpp RESOURCES += resources.qrc @@ -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(); } @@ -22,9 +22,9 @@ import QtGraphicalEffects 1.0 import QtQuick.Controls 1.3 import org.asteroid.controls 1.0 -Application { +Item { id: app - title: "Stopwatch" + anchors.fill: parent property bool running property var previousTime |