aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/extras
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@theqtcompany.com>2015-07-10 15:25:03 +0200
committerMitch Curtis <mitch.curtis@theqtcompany.com>2015-07-16 16:01:35 +0000
commit7975760a4fc0a9ba6f05fa405ba07381131c0f79 (patch)
tree02961959c18e2bd9c9a7358f82ee7bd1c8731f84 /src/imports/extras
parent00eec16115770b0822c250237949243816ac2e1c (diff)
Add Dial.
Change-Id: Ie80fac70141ef72bb68f7c9e91827e834dc1fc4a Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/imports/extras')
-rw-r--r--src/imports/extras/Dial.qml83
-rw-r--r--src/imports/extras/extras.pro1
-rw-r--r--src/imports/extras/qmldir1
-rw-r--r--src/imports/extras/qtquickextras2plugin.cpp2
4 files changed, 87 insertions, 0 deletions
diff --git a/src/imports/extras/Dial.qml b/src/imports/extras/Dial.qml
new file mode 100644
index 00000000..fbf2807f
--- /dev/null
+++ b/src/imports/extras/Dial.qml
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Extras 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 QtQuick.Controls 2.0
+import QtQuick.Extras 2.0
+
+AbstractDial {
+ id: control
+
+ implicitWidth: 100
+ implicitHeight: 100
+
+ Accessible.pressed: pressed
+ Accessible.role: Accessible.Dial
+
+ //! [background]
+ background: Rectangle {
+ color: control.Theme.backgroundColor
+ radius: width / 2
+
+ border.color: control.activeFocus ? control.Theme.focusColor : control.Theme.frameColor
+ }
+ //! [background]
+
+ //! [handle]
+ handle: Rectangle {
+ id: handleItem
+
+ x: background.width / 2 - handle.width / 2
+ y: background.height / 2 - handle.height / 2
+ transform: [
+ Translate {
+ y: -background.height * 0.35
+ },
+ Rotation {
+ angle: control.angle
+ origin.x: handle.width / 2
+ origin.y: handle.height / 2
+ }
+ ]
+ implicitWidth: 20
+ implicitHeight: 20
+ radius: width / 2
+ border.width: control.activeFocus ? 2 : 1
+ border.color: control.activeFocus ? control.Theme.focusColor : control.Theme.frameColor
+ color: control.Theme.baseColor
+ }
+ //! [handle]
+}
diff --git a/src/imports/extras/extras.pro b/src/imports/extras/extras.pro
index 79e9bbfe..5aa6f04e 100644
--- a/src/imports/extras/extras.pro
+++ b/src/imports/extras/extras.pro
@@ -9,6 +9,7 @@ OTHER_FILES += \
qmldir
QML_FILES = \
+ Dial.qml \
Drawer.qml \
SwipeView.qml \
Tumbler.qml
diff --git a/src/imports/extras/qmldir b/src/imports/extras/qmldir
index 4ba7c40b..51c99e31 100644
--- a/src/imports/extras/qmldir
+++ b/src/imports/extras/qmldir
@@ -1,6 +1,7 @@
module QtQuick.Extras
plugin qtquickextras2plugin
classname QtQuickExtras2Plugin
+Dial 2.0 Dial.qml
Drawer 2.0 Drawer.qml
SwipeView 2.0 SwipeView.qml
Tumbler 2.0 Tumbler.qml
diff --git a/src/imports/extras/qtquickextras2plugin.cpp b/src/imports/extras/qtquickextras2plugin.cpp
index 2a930ffd..a17ae159 100644
--- a/src/imports/extras/qtquickextras2plugin.cpp
+++ b/src/imports/extras/qtquickextras2plugin.cpp
@@ -36,6 +36,7 @@
#include <QtQml/qqmlextensionplugin.h>
+#include <QtQuickExtras/private/qquickdial_p.h>
#include <QtQuickExtras/private/qquickdrawer_p.h>
#include <QtQuickExtras/private/qquickswipeview_p.h>
#include <QtQuickExtras/private/qquicktumbler_p.h>
@@ -53,6 +54,7 @@ public:
void QtQuickExtras2Plugin::registerTypes(const char *uri)
{
+ qmlRegisterType<QQuickDial>(uri, 2, 0, "AbstractDial");
qmlRegisterType<QQuickDrawer>(uri, 2, 0, "AbstractDrawer");
qmlRegisterType<QQuickSwipeView>(uri, 2, 0, "AbstractSwipeView");
qmlRegisterType<QQuickTumbler>(uri, 2, 0, "AbstractTumbler");