diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-12-18 15:34:32 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-12-18 21:25:36 +0000 |
commit | 9586162f1dbf3960321bfb1c392ee63864458deb (patch) | |
tree | f7b726d6e2b86a7e4e681ca880d021c6ff92bbed /examples | |
parent | 3e820f09d940c991cce1063d781dc530adc8710c (diff) |
Gallery: remove the problematic restart functionality
It doesn't work nicely on Android (the new app instance goes to
the background) and QProcess is not available at all on iOS.
Change-Id: I3aeec773927825fdd5fc499a2ac0acbe59634114
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/controls/gallery/gallery.cpp | 28 | ||||
-rw-r--r-- | examples/controls/gallery/gallery.qml | 12 |
2 files changed, 10 insertions, 30 deletions
diff --git a/examples/controls/gallery/gallery.cpp b/examples/controls/gallery/gallery.cpp index 5b28a6ce..778ecbc2 100644 --- a/examples/controls/gallery/gallery.cpp +++ b/examples/controls/gallery/gallery.cpp @@ -42,42 +42,22 @@ #include <QQmlApplicationEngine> #include <QQmlContext> #include <QSettings> -#include <QProcess> - -class GalleryApplication : public QGuiApplication -{ - Q_OBJECT - -public: - GalleryApplication(int &argc, char *argv[]) : QGuiApplication(argc, argv) - { - setApplicationName("Gallery"); - setOrganizationName("QtProject"); - } - -public slots: - void restart() - { - QProcess::startDetached(applicationFilePath()); - quit(); - } -}; int main(int argc, char *argv[]) { + QGuiApplication::setApplicationName("Gallery"); + QGuiApplication::setOrganizationName("QtProject"); QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - GalleryApplication app(argc, argv); + + QGuiApplication app(argc, argv); QSettings settings; qputenv("QT_LABS_CONTROLS_STYLE", settings.value("style").toByteArray()); QQmlApplicationEngine engine; - engine.rootContext()->setContextProperty("app", &app); engine.load(QUrl("qrc:/gallery.qml")); if (engine.rootObjects().isEmpty()) return -1; return app.exec(); } - -#include "gallery.moc" diff --git a/examples/controls/gallery/gallery.qml b/examples/controls/gallery/gallery.qml index 1552ec55..2bd7d40f 100644 --- a/examples/controls/gallery/gallery.qml +++ b/examples/controls/gallery/gallery.qml @@ -198,6 +198,7 @@ ApplicationWindow { onPressedOutside: close() contentItem: Pane { + id: settingsPane x: (window.width - width) / 2 y: window.height / 6 width: Math.min(window.width, window.height) / 3 * 2 @@ -238,7 +239,7 @@ ApplicationWindow { Label { text: "Restart required" - opacity: restartButton.opacity + opacity: styleBox.currentIndex !== styleBox.styleIndex ? 1.0 : 0.0 horizontalAlignment: Label.AlignHCenter verticalAlignment: Label.AlignVCenter Layout.fillWidth: true @@ -246,15 +247,14 @@ ApplicationWindow { } RowLayout { - spacing: 20 + spacing: 10 Button { - id: restartButton - text: "Restart" - opacity: styleBox.currentIndex !== styleBox.styleIndex ? 1.0 : 0.0 + id: okButton + text: "Ok" onClicked: { settings.style = styleBox.displayText - app.restart() + settingsPopup.close() } Layout.preferredWidth: 0 Layout.fillWidth: true |