diff options
Diffstat (limited to 'examples/quick/shared/LauncherList.qml')
-rw-r--r-- | examples/quick/shared/LauncherList.qml | 70 |
1 files changed, 37 insertions, 33 deletions
diff --git a/examples/quick/shared/LauncherList.qml b/examples/quick/shared/LauncherList.qml index ba9ee6c5d2..fe44cf3634 100644 --- a/examples/quick/shared/LauncherList.qml +++ b/examples/quick/shared/LauncherList.qml @@ -1,13 +1,23 @@ /**************************************************************************** ** ** Copyright (C) 2017 Crimson AS <info@crimson.no> -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are @@ -38,7 +48,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import QtQuick 2.0 +import QtQuick 2.12 Rectangle { property int activePageCount: 0 @@ -47,10 +57,12 @@ Rectangle { //function used to add to model A) to enforce scheme B) to allow Qt.resolveUrl in url assignments color: "#eee" - function addExample(name, desc, url) - { + function addExample(name, desc, url) { myModel.append({"name":name, "description":desc, "url":url}) } + function showExample(url) { + pageComponent.createObject(pageContainer, { exampleUrl: url }).show() + } // The container rectangle here is used to give a nice "feel" when // transitioning into an example. @@ -62,10 +74,7 @@ Rectangle { id: launcherList clip: true delegate: SimpleLauncherDelegate{ - onClicked: { - var page = pageComponent.createObject(pageContainer, { exampleUrl: url }) - page.show() - } + onClicked: showExample(url) } model: ListModel {id:myModel} anchors.fill: parent @@ -87,9 +96,8 @@ Rectangle { width: parent.width height: parent.height - bar.height color: "white" - MouseArea{ + TapHandler { //Eats mouse events - anchors.fill: parent } Loader{ focus: true @@ -97,8 +105,6 @@ Rectangle { anchors.fill: parent } - x: -width - function show() { showAnim.start() } @@ -214,29 +220,27 @@ Rectangle { anchors.left: parent.left anchors.leftMargin: 16 - MouseArea { - id: mouse - hoverEnabled: true - anchors.centerIn: parent - width: 38 - height: 31 - anchors.verticalCenterOffset: -1 + TapHandler { + id: tapHandler enabled: activePageCount > 0 - onClicked: { + onTapped: { pageContainer.children[pageContainer.children.length - 1].exit() } - Rectangle { - anchors.fill: parent - opacity: mouse.pressed ? 1 : 0 - Behavior on opacity { NumberAnimation{ duration: 100 }} - gradient: Gradient { - GradientStop { position: 0 ; color: "#22000000" } - GradientStop { position: 0.2 ; color: "#11000000" } - } - border.color: "darkgray" - antialiasing: true - radius: 4 + } + Rectangle { + anchors.centerIn: back + width: 38 + height: 31 + anchors.verticalCenterOffset: -1 + opacity: tapHandler.pressed ? 1 : 0 + Behavior on opacity { NumberAnimation{ duration: 100 }} + gradient: Gradient { + GradientStop { position: 0 ; color: "#22000000" } + GradientStop { position: 0.2 ; color: "#11000000" } } + border.color: "darkgray" + antialiasing: true + radius: 4 } } } |