From c34e39cd1fd078510467536a9562e365cdae4d8f Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 21 Dec 2015 15:01:57 +0100 Subject: Material: set default transitions for Popup Change-Id: I3844718c4a6fa0410f6d8670390878e4521976c0 Reviewed-by: Mitch Curtis --- src/imports/controls/Popup.qml | 42 +++++++++++++++++++++ src/imports/controls/controls.pri | 1 + src/imports/controls/material/Popup.qml | 54 +++++++++++++++++++++++++++ src/imports/controls/material/material.pri | 1 + src/imports/controls/qtlabscontrolsplugin.cpp | 2 +- 5 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 src/imports/controls/Popup.qml create mode 100644 src/imports/controls/material/Popup.qml (limited to 'src/imports') diff --git a/src/imports/controls/Popup.qml b/src/imports/controls/Popup.qml new file mode 100644 index 00000000..b7c6fe08 --- /dev/null +++ b/src/imports/controls/Popup.qml @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Labs Controls module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.6 +import Qt.labs.templates 1.0 as T + +T.Popup { + id: control +} diff --git a/src/imports/controls/controls.pri b/src/imports/controls/controls.pri index 7cd0af87..6b3c4fc9 100644 --- a/src/imports/controls/controls.pri +++ b/src/imports/controls/controls.pri @@ -14,6 +14,7 @@ QML_FILES = \ MenuItem.qml \ Pane.qml \ PageIndicator.qml \ + Popup.qml \ ProgressBar.qml \ RadioButton.qml \ RangeSlider.qml \ diff --git a/src/imports/controls/material/Popup.qml b/src/imports/controls/material/Popup.qml new file mode 100644 index 00000000..40531c61 --- /dev/null +++ b/src/imports/controls/material/Popup.qml @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Labs Controls module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.6 +import Qt.labs.templates 1.0 as T + +T.Popup { + id: control + + enter: Transition { + // grow_fade_in + NumberAnimation { property: "scale"; from: 0.9; to: 1.0; easing.type: Easing.OutQuint; duration: 220 } + NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; easing.type: Easing.OutCubic; duration: 150 } + } + + exit: Transition { + // shrink_fade_out + NumberAnimation { property: "scale"; from: 1.0; to: 0.9; easing.type: Easing.OutQuint; duration: 220 } + NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; easing.type: Easing.OutCubic; duration: 150 } + } +} diff --git a/src/imports/controls/material/material.pri b/src/imports/controls/material/material.pri index 088905cc..2587241a 100644 --- a/src/imports/controls/material/material.pri +++ b/src/imports/controls/material/material.pri @@ -23,6 +23,7 @@ QML_FILES += \ $$PWD/Menu.qml \ $$PWD/Pane.qml \ $$PWD/PageIndicator.qml \ + $$PWD/Popup.qml \ $$PWD/ProgressBar.qml \ $$PWD/RadioButton.qml \ $$PWD/RangeSlider.qml \ diff --git a/src/imports/controls/qtlabscontrolsplugin.cpp b/src/imports/controls/qtlabscontrolsplugin.cpp index 6c0bacfb..c822d9be 100644 --- a/src/imports/controls/qtlabscontrolsplugin.cpp +++ b/src/imports/controls/qtlabscontrolsplugin.cpp @@ -71,7 +71,6 @@ void QtLabsControlsPlugin::registerTypes(const char *uri) qmlRegisterType(); qmlRegisterType(uri, 1, 0, "Container"); qmlRegisterType(uri, 1, 0, "Control"); - qmlRegisterType(uri, 1, 0, "Popup"); QQuickStyleSelector selector; selector.setBaseUrl(baseUrl()); @@ -91,6 +90,7 @@ void QtLabsControlsPlugin::registerTypes(const char *uri) qmlRegisterType(selector.select(QStringLiteral("/MenuItem.qml")), uri, 1, 0, "MenuItem"); qmlRegisterType(selector.select(QStringLiteral("/Pane.qml")), uri, 1, 0, "Pane"); qmlRegisterType(selector.select(QStringLiteral("/PageIndicator.qml")), uri, 1, 0, "PageIndicator"); + qmlRegisterType(selector.select(QStringLiteral("/Popup.qml")), uri, 1, 0, "Popup"); qmlRegisterType(selector.select(QStringLiteral("/ProgressBar.qml")), uri, 1, 0, "ProgressBar"); qmlRegisterType(selector.select(QStringLiteral("/RadioButton.qml")), uri, 1, 0, "RadioButton"); qmlRegisterType(selector.select(QStringLiteral("/RangeSlider.qml")), uri, 1, 0, "RangeSlider"); -- cgit v1.2.3