summaryrefslogtreecommitdiffstats
path: root/examples/statemachine/graphicsview/padnavigator
diff options
context:
space:
mode:
authorJuha Vuolle <juha.vuolle@insta.fi>2021-02-12 14:31:23 +0200
committerJuha Vuolle <juha.vuolle@insta.fi>2021-02-17 16:05:19 +0200
commitbf411290440543e66c5468018681d041d0b9d047 (patch)
tree138e5bd55a01418461849b3678794b544ffe4da9 /examples/statemachine/graphicsview/padnavigator
parent9251d5c76fb57674e8b7d3491f064814c5e08b20 (diff)
Rename example directory (all examples in it are statemachine examples)
Pick-to: 6.1 Task-number: QTBUG-89833 Change-Id: I5703667054d5f32633c741f97c2890b64801960c Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'examples/statemachine/graphicsview/padnavigator')
-rw-r--r--examples/statemachine/graphicsview/padnavigator/.prev_CMakeLists.txt74
-rw-r--r--examples/statemachine/graphicsview/padnavigator/CMakeLists.txt75
-rw-r--r--examples/statemachine/graphicsview/padnavigator/flippablepad.cpp108
-rw-r--r--examples/statemachine/graphicsview/padnavigator/flippablepad.h71
-rw-r--r--examples/statemachine/graphicsview/padnavigator/form.ui208
-rw-r--r--examples/statemachine/graphicsview/padnavigator/images/artsfftscope.pngbin0 -> 1291 bytes
-rw-r--r--examples/statemachine/graphicsview/padnavigator/images/blue_angle_swirl.jpgbin0 -> 11826 bytes
-rw-r--r--examples/statemachine/graphicsview/padnavigator/images/kontact_contacts.pngbin0 -> 4382 bytes
-rw-r--r--examples/statemachine/graphicsview/padnavigator/images/kontact_journal.pngbin0 -> 3261 bytes
-rw-r--r--examples/statemachine/graphicsview/padnavigator/images/kontact_mail.pngbin0 -> 3202 bytes
-rw-r--r--examples/statemachine/graphicsview/padnavigator/images/kontact_notes.pngbin0 -> 3893 bytes
-rw-r--r--examples/statemachine/graphicsview/padnavigator/images/kopeteavailable.pngbin0 -> 2380 bytes
-rw-r--r--examples/statemachine/graphicsview/padnavigator/images/metacontact_online.pngbin0 -> 2545 bytes
-rw-r--r--examples/statemachine/graphicsview/padnavigator/images/minitools.pngbin0 -> 2087 bytes
-rw-r--r--examples/statemachine/graphicsview/padnavigator/main.cpp65
-rw-r--r--examples/statemachine/graphicsview/padnavigator/padnavigator.cpp318
-rw-r--r--examples/statemachine/graphicsview/padnavigator/padnavigator.h72
-rw-r--r--examples/statemachine/graphicsview/padnavigator/padnavigator.pro27
-rw-r--r--examples/statemachine/graphicsview/padnavigator/padnavigator.qrc13
-rw-r--r--examples/statemachine/graphicsview/padnavigator/roundrectitem.cpp125
-rw-r--r--examples/statemachine/graphicsview/padnavigator/roundrectitem.h85
-rw-r--r--examples/statemachine/graphicsview/padnavigator/splashitem.cpp93
-rw-r--r--examples/statemachine/graphicsview/padnavigator/splashitem.h71
23 files changed, 1405 insertions, 0 deletions
diff --git a/examples/statemachine/graphicsview/padnavigator/.prev_CMakeLists.txt b/examples/statemachine/graphicsview/padnavigator/.prev_CMakeLists.txt
new file mode 100644
index 0000000..056dbf6
--- /dev/null
+++ b/examples/statemachine/graphicsview/padnavigator/.prev_CMakeLists.txt
@@ -0,0 +1,74 @@
+# Generated from padnavigator.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(padnavigator LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/padnavigator")
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS StateMachine)
+find_package(Qt6 COMPONENTS Widgets)
+
+qt_add_executable(padnavigator
+ flippablepad.cpp flippablepad.h
+ form.ui
+ main.cpp
+ padnavigator.cpp padnavigator.h
+ roundrectitem.cpp roundrectitem.h
+ splashitem.cpp splashitem.h
+)
+set_target_properties(padnavigator PROPERTIES
+ WIN32_EXECUTABLE FALSE
+ MACOSX_BUNDLE TRUE
+)
+target_link_libraries(padnavigator PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::StateMachine
+ Qt::Widgets
+)
+
+
+# Resources:
+set(padnavigator_resource_files
+ "images/artsfftscope.png"
+ "images/blue_angle_swirl.jpg"
+ "images/kontact_contacts.png"
+ "images/kontact_journal.png"
+ "images/kontact_mail.png"
+ "images/kontact_notes.png"
+ "images/kopeteavailable.png"
+ "images/metacontact_online.png"
+ "images/minitools.png"
+)
+
+qt6_add_resources(padnavigator "padnavigator"
+ PREFIX
+ "/"
+ FILES
+ ${padnavigator_resource_files}
+)
+
+if(TARGET Qt::OpenGL)
+ target_link_libraries(padnavigator PUBLIC
+ Qt::OpenGL
+ Qt::OpenGLWidgets
+ )
+endif()
+
+install(TARGETS padnavigator
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/statemachine/graphicsview/padnavigator/CMakeLists.txt b/examples/statemachine/graphicsview/padnavigator/CMakeLists.txt
new file mode 100644
index 0000000..979cca9
--- /dev/null
+++ b/examples/statemachine/graphicsview/padnavigator/CMakeLists.txt
@@ -0,0 +1,75 @@
+# Generated from padnavigator.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(padnavigator LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/padnavigator")
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS StateMachine)
+find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 COMPONENTS OpenGL) # special case
+
+qt_add_executable(padnavigator
+ flippablepad.cpp flippablepad.h
+ form.ui
+ main.cpp
+ padnavigator.cpp padnavigator.h
+ roundrectitem.cpp roundrectitem.h
+ splashitem.cpp splashitem.h
+)
+set_target_properties(padnavigator PROPERTIES
+ WIN32_EXECUTABLE FALSE
+ MACOSX_BUNDLE TRUE
+)
+target_link_libraries(padnavigator PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::StateMachine
+ Qt::Widgets
+)
+
+
+# Resources:
+set(padnavigator_resource_files
+ "images/artsfftscope.png"
+ "images/blue_angle_swirl.jpg"
+ "images/kontact_contacts.png"
+ "images/kontact_journal.png"
+ "images/kontact_mail.png"
+ "images/kontact_notes.png"
+ "images/kopeteavailable.png"
+ "images/metacontact_online.png"
+ "images/minitools.png"
+)
+
+qt6_add_resources(padnavigator "padnavigator"
+ PREFIX
+ "/"
+ FILES
+ ${padnavigator_resource_files}
+)
+
+if(TARGET Qt::OpenGL AND TARGET Qt::OpenGLWidgets)
+ target_link_libraries(padnavigator PUBLIC
+ Qt::OpenGL
+ Qt::OpenGLWidgets
+ )
+endif()
+
+install(TARGETS padnavigator
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/statemachine/graphicsview/padnavigator/flippablepad.cpp b/examples/statemachine/graphicsview/padnavigator/flippablepad.cpp
new file mode 100644
index 0000000..2639092
--- /dev/null
+++ b/examples/statemachine/graphicsview/padnavigator/flippablepad.cpp
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+** 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
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "flippablepad.h"
+
+#include <QDirIterator>
+
+//! [0]
+static QRectF boundsFromSize(const QSize &size)
+{
+ return QRectF((-size.width() / 2.0) * 150, (-size.height() / 2.0) * 150,
+ size.width() * 150, size.height() * 150);
+}
+//! [0]
+
+//! [1]
+static QPointF posForLocation(int column, int row, const QSize &size)
+{
+ return QPointF(column * 150, row * 150)
+ - QPointF((size.width() - 1) * 75, (size.height() - 1) * 75);
+}
+//! [1]
+
+//! [2]
+FlippablePad::FlippablePad(const QSize &size, QGraphicsItem *parent)
+ : RoundRectItem(boundsFromSize(size), QColor(226, 255, 92, 64), parent)
+{
+//! [2]
+//! [3]
+ int numIcons = size.width() * size.height();
+ QList<QPixmap> pixmaps;
+ QDirIterator it(":/images", {"*.png"});
+ while (it.hasNext() && pixmaps.size() < numIcons)
+ pixmaps << it.next();
+//! [3]
+
+//! [4]
+ const QRectF iconRect(-54, -54, 108, 108);
+ const QColor iconColor(214, 240, 110, 128);
+ iconGrid.resize(size.height());
+ int n = 0;
+
+ for (int y = 0; y < size.height(); ++y) {
+ iconGrid[y].resize(size.width());
+ for (int x = 0; x < size.width(); ++x) {
+ RoundRectItem *rect = new RoundRectItem(iconRect, iconColor, this);
+ rect->setZValue(1);
+ rect->setPos(posForLocation(x, y, size));
+ rect->setPixmap(pixmaps.at(n++ % pixmaps.size()));
+ iconGrid[y][x] = rect;
+ }
+ }
+}
+//! [4]
+
+//! [5]
+RoundRectItem *FlippablePad::iconAt(int column, int row) const
+{
+ return iconGrid[row][column];
+}
+//! [5]
diff --git a/examples/statemachine/graphicsview/padnavigator/flippablepad.h b/examples/statemachine/graphicsview/padnavigator/flippablepad.h
new file mode 100644
index 0000000..a056eae
--- /dev/null
+++ b/examples/statemachine/graphicsview/padnavigator/flippablepad.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+** 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
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef FLIPPABLEPAD_H
+#define FLIPPABLEPAD_H
+
+#include "roundrectitem.h"
+
+#include <QList>
+
+//! [0]
+class FlippablePad : public RoundRectItem
+{
+public:
+ explicit FlippablePad(const QSize &size, QGraphicsItem *parent = nullptr);
+
+ RoundRectItem *iconAt(int column, int row) const;
+
+private:
+ QList<QList<RoundRectItem *>> iconGrid;
+};
+//! [0]
+
+#endif // FLIPPABLEPAD_H
diff --git a/examples/statemachine/graphicsview/padnavigator/form.ui b/examples/statemachine/graphicsview/padnavigator/form.ui
new file mode 100644
index 0000000..fc7d123
--- /dev/null
+++ b/examples/statemachine/graphicsview/padnavigator/form.ui
@@ -0,0 +1,208 @@
+<ui version="4.0" >
+ <class>Form</class>
+ <widget class="QWidget" name="Form" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>378</width>
+ <height>385</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>BackSide</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2" >
+ <item>
+ <widget class="QGroupBox" name="groupBox" >
+ <property name="title" >
+ <string>Settings</string>
+ </property>
+ <property name="flat" >
+ <bool>true</bool>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <layout class="QGridLayout" name="gridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Title:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="QLineEdit" name="hostName" >
+ <property name="text" >
+ <string>Pad Navigator Example</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>Modified:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="label_3" >
+ <property name="text" >
+ <string>Extent</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <layout class="QHBoxLayout" name="horizontalLayout" >
+ <item>
+ <widget class="QSlider" name="horizontalSlider" >
+ <property name="value" >
+ <number>42</number>
+ </property>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinBox" >
+ <property name="value" >
+ <number>42</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QDateTimeEdit" name="dateTimeEdit" />
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_2" >
+ <property name="title" >
+ <string>Other input</string>
+ </property>
+ <property name="flat" >
+ <bool>true</bool>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_2" >
+ <item>
+ <widget class="QTreeWidget" name="treeWidget" >
+ <column>
+ <property name="text" >
+ <string>Widgets On Graphics View</string>
+ </property>
+ </column>
+ <item>
+ <property name="text" >
+ <string>QGraphicsProxyWidget</string>
+ </property>
+ <item>
+ <property name="text" >
+ <string>QGraphicsWidget</string>
+ </property>
+ <item>
+ <property name="text" >
+ <string>QObject</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>QGraphicsItem</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>QGraphicsLayoutItem</string>
+ </property>
+ </item>
+ </item>
+ </item>
+ <item>
+ <property name="text" >
+ <string>QGraphicsGridLayout</string>
+ </property>
+ <item>
+ <property name="text" >
+ <string>QGraphicsLayout</string>
+ </property>
+ <item>
+ <property name="text" >
+ <string>QGraphicsLayoutItem</string>
+ </property>
+ </item>
+ </item>
+ </item>
+ <item>
+ <property name="text" >
+ <string>QGraphicsLinearLayout</string>
+ </property>
+ <item>
+ <property name="text" >
+ <string>QGraphicsLayout</string>
+ </property>
+ <item>
+ <property name="text" >
+ <string>QGraphicsLayoutItem</string>
+ </property>
+ </item>
+ </item>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <tabstops>
+ <tabstop>groupBox</tabstop>
+ <tabstop>hostName</tabstop>
+ <tabstop>dateTimeEdit</tabstop>
+ <tabstop>horizontalSlider</tabstop>
+ <tabstop>spinBox</tabstop>
+ <tabstop>groupBox_2</tabstop>
+ <tabstop>treeWidget</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>horizontalSlider</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>spinBox</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>184</x>
+ <y>125</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>275</x>
+ <y>127</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>spinBox</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>horizontalSlider</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>272</x>
+ <y>114</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>190</x>
+ <y>126</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/examples/statemachine/graphicsview/padnavigator/images/artsfftscope.png b/examples/statemachine/graphicsview/padnavigator/images/artsfftscope.png
new file mode 100644
index 0000000..4db003f
--- /dev/null
+++ b/examples/statemachine/graphicsview/padnavigator/images/artsfftscope.png
Binary files differ
diff --git a/examples/statemachine/graphicsview/padnavigator/images/blue_angle_swirl.jpg b/examples/statemachine/graphicsview/padnavigator/images/blue_angle_swirl.jpg
new file mode 100644
index 0000000..5bf0deb
--- /dev/null
+++ b/examples/statemachine/graphicsview/padnavigator/images/blue_angle_swirl.jpg
Binary files differ
diff --git a/examples/statemachine/graphicsview/padnavigator/images/kontact_contacts.png b/examples/statemachine/graphicsview/padnavigator/images/kontact_contacts.png
new file mode 100644
index 0000000..6fb4cc8
--- /dev/null
+++ b/examples/statemachine/graphicsview/padnavigator/images/kontact_contacts.png
Binary files differ
diff --git a/examples/statemachine/graphicsview/padnavigator/images/kontact_journal.png b/examples/statemachine/graphicsview/padnavigator/images/kontact_journal.png
new file mode 100644
index 0000000..b1fedb6
--- /dev/null
+++ b/examples/statemachine/graphicsview/padnavigator/images/kontact_journal.png
Binary files differ
diff --git a/examples/statemachine/graphicsview/padnavigator/images/kontact_mail.png b/examples/statemachine/graphicsview/padnavigator/images/kontact_mail.png
new file mode 100644
index 0000000..672f8fa
--- /dev/null
+++ b/examples/statemachine/graphicsview/padnavigator/images/kontact_mail.png
Binary files differ
diff --git a/examples/statemachine/graphicsview/padnavigator/images/kontact_notes.png b/examples/statemachine/graphicsview/padnavigator/images/kontact_notes.png
new file mode 100644
index 0000000..229bf73
--- /dev/null
+++ b/examples/statemachine/graphicsview/padnavigator/images/kontact_notes.png
Binary files differ
diff --git a/examples/statemachine/graphicsview/padnavigator/images/kopeteavailable.png b/examples/statemachine/graphicsview/padnavigator/images/kopeteavailable.png
new file mode 100644
index 0000000..2eaf41a
--- /dev/null
+++ b/examples/statemachine/graphicsview/padnavigator/images/kopeteavailable.png
Binary files differ
diff --git a/examples/statemachine/graphicsview/padnavigator/images/metacontact_online.png b/examples/statemachine/graphicsview/padnavigator/images/metacontact_online.png
new file mode 100644
index 0000000..6a398dd
--- /dev/null
+++ b/examples/statemachine/graphicsview/padnavigator/images/metacontact_online.png
Binary files differ
diff --git a/examples/statemachine/graphicsview/padnavigator/images/minitools.png b/examples/statemachine/graphicsview/padnavigator/images/minitools.png
new file mode 100644
index 0000000..0248c9d
--- /dev/null
+++ b/examples/statemachine/graphicsview/padnavigator/images/minitools.png
Binary files differ
diff --git a/examples/statemachine/graphicsview/padnavigator/main.cpp b/examples/statemachine/graphicsview/padnavigator/main.cpp
new file mode 100644
index 0000000..c433ab3
--- /dev/null
+++ b/examples/statemachine/graphicsview/padnavigator/main.cpp
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+** 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
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "padnavigator.h"
+
+#include <QtWidgets/QtWidgets>
+
+//! [0]
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ Q_INIT_RESOURCE(padnavigator);
+
+ PadNavigator navigator(QSize(3, 3));
+ navigator.show();
+ return app.exec();
+}
+//! [0]
diff --git a/examples/statemachine/graphicsview/padnavigator/padnavigator.cpp b/examples/statemachine/graphicsview/padnavigator/padnavigator.cpp
new file mode 100644
index 0000000..5088386
--- /dev/null
+++ b/examples/statemachine/graphicsview/padnavigator/padnavigator.cpp
@@ -0,0 +1,318 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+** 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
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "flippablepad.h"
+#include "padnavigator.h"
+#include "splashitem.h"
+
+#include <QEventTransition>
+#include <QGraphicsProxyWidget>
+#include <QGraphicsRotation>
+#include <QHistoryState>
+#include <QKeyEventTransition>
+#include <QParallelAnimationGroup>
+#include <QPropertyAnimation>
+#include <QSequentialAnimationGroup>
+#include <QStateMachine>
+
+#ifndef QT_NO_OPENGL
+#include <QOpenGLWidget>
+#endif
+
+//! [0]
+PadNavigator::PadNavigator(const QSize &size, QWidget *parent)
+ : QGraphicsView(parent)
+{
+//! [0]
+//! [1]
+ // Splash item
+ SplashItem *splash = new SplashItem;
+ splash->setZValue(1);
+//! [1]
+
+//! [2]
+ // Pad item
+ FlippablePad *pad = new FlippablePad(size);
+ QGraphicsRotation *flipRotation = new QGraphicsRotation(pad);
+ QGraphicsRotation *xRotation = new QGraphicsRotation(pad);
+ QGraphicsRotation *yRotation = new QGraphicsRotation(pad);
+ flipRotation->setAxis(Qt::YAxis);
+ xRotation->setAxis(Qt::YAxis);
+ yRotation->setAxis(Qt::XAxis);
+ pad->setTransformations(QList<QGraphicsTransform *>()
+ << flipRotation
+ << xRotation << yRotation);
+//! [2]
+
+//! [3]
+ // Back (proxy widget) item
+ QGraphicsProxyWidget *backItem = new QGraphicsProxyWidget(pad);
+ QWidget *widget = new QWidget;
+ form.setupUi(widget);
+ form.hostName->setFocus();
+ backItem->setWidget(widget);
+ backItem->setVisible(false);
+ backItem->setFocus();
+ backItem->setCacheMode(QGraphicsItem::ItemCoordinateCache);
+ const QRectF r = backItem->rect();
+ backItem->setTransform(QTransform()
+ .rotate(180, Qt::YAxis)
+ .translate(-r.width()/2, -r.height()/2));
+//! [3]
+
+//! [4]
+ // Selection item
+ RoundRectItem *selectionItem = new RoundRectItem(QRectF(-60, -60, 120, 120), Qt::gray, pad);
+ selectionItem->setZValue(0.5);
+//! [4]
+
+//! [5]
+ // Splash animations
+ QPropertyAnimation *smoothSplashMove = new QPropertyAnimation(splash, "y");
+ QPropertyAnimation *smoothSplashOpacity = new QPropertyAnimation(splash, "opacity");
+ smoothSplashMove->setEasingCurve(QEasingCurve::InQuad);
+ smoothSplashMove->setDuration(250);
+ smoothSplashOpacity->setDuration(250);
+//! [5]
+
+//! [6]
+ // Selection animation
+ QPropertyAnimation *smoothXSelection = new QPropertyAnimation(selectionItem, "x");
+ QPropertyAnimation *smoothYSelection = new QPropertyAnimation(selectionItem, "y");
+ QPropertyAnimation *smoothXRotation = new QPropertyAnimation(xRotation, "angle");
+ QPropertyAnimation *smoothYRotation = new QPropertyAnimation(yRotation, "angle");
+ smoothXSelection->setDuration(125);
+ smoothYSelection->setDuration(125);
+ smoothXRotation->setDuration(125);
+ smoothYRotation->setDuration(125);
+ smoothXSelection->setEasingCurve(QEasingCurve::InOutQuad);
+ smoothYSelection->setEasingCurve(QEasingCurve::InOutQuad);
+ smoothXRotation->setEasingCurve(QEasingCurve::InOutQuad);
+ smoothYRotation->setEasingCurve(QEasingCurve::InOutQuad);
+//! [6]
+
+//! [7]
+ // Flip animation setup
+ QPropertyAnimation *smoothFlipRotation = new QPropertyAnimation(flipRotation, "angle");
+ QPropertyAnimation *smoothFlipScale = new QPropertyAnimation(pad, "scale");
+ QParallelAnimationGroup *flipAnimation = new QParallelAnimationGroup(this);
+ smoothFlipScale->setDuration(500);
+ smoothFlipRotation->setDuration(500);
+ smoothFlipScale->setEasingCurve(QEasingCurve::InOutQuad);
+ smoothFlipRotation->setEasingCurve(QEasingCurve::InOutQuad);
+ smoothFlipScale->setKeyValueAt(0, qvariant_cast<qreal>(1.0));
+ smoothFlipScale->setKeyValueAt(0.5, qvariant_cast<qreal>(0.7));
+ smoothFlipScale->setKeyValueAt(1, qvariant_cast<qreal>(1.0));
+ flipAnimation->addAnimation(smoothFlipRotation);
+ flipAnimation->addAnimation(smoothFlipScale);
+//! [7]
+
+//! [8]
+ // Flip animation delayed property assignment
+ QSequentialAnimationGroup *setVariablesSequence = new QSequentialAnimationGroup;
+ QPropertyAnimation *setFillAnimation = new QPropertyAnimation(pad, "fill");
+ QPropertyAnimation *setBackItemVisibleAnimation = new QPropertyAnimation(backItem, "visible");
+ QPropertyAnimation *setSelectionItemVisibleAnimation = new QPropertyAnimation(selectionItem, "visible");
+ setFillAnimation->setDuration(0);
+ setBackItemVisibleAnimation->setDuration(0);
+ setSelectionItemVisibleAnimation->setDuration(0);
+ setVariablesSequence->addPause(250);
+ setVariablesSequence->addAnimation(setBackItemVisibleAnimation);
+ setVariablesSequence->addAnimation(setSelectionItemVisibleAnimation);
+ setVariablesSequence->addAnimation(setFillAnimation);
+ flipAnimation->addAnimation(setVariablesSequence);
+//! [8]
+
+//! [9]
+ // Build the state machine
+ QStateMachine *stateMachine = new QStateMachine(this);
+ QState *splashState = new QState(stateMachine);
+ QState *frontState = new QState(stateMachine);
+ QHistoryState *historyState = new QHistoryState(frontState);
+ QState *backState = new QState(stateMachine);
+//! [9]
+//! [10]
+ frontState->assignProperty(pad, "fill", false);
+ frontState->assignProperty(splash, "opacity", 0.0);
+ frontState->assignProperty(backItem, "visible", false);
+ frontState->assignProperty(flipRotation, "angle", qvariant_cast<qreal>(0.0));
+ frontState->assignProperty(selectionItem, "visible", true);
+ backState->assignProperty(pad, "fill", true);
+ backState->assignProperty(backItem, "visible", true);
+ backState->assignProperty(xRotation, "angle", qvariant_cast<qreal>(0.0));
+ backState->assignProperty(yRotation, "angle", qvariant_cast<qreal>(0.0));
+ backState->assignProperty(flipRotation, "angle", qvariant_cast<qreal>(180.0));
+ backState->assignProperty(selectionItem, "visible", false);
+ stateMachine->addDefaultAnimation(smoothXRotation);
+ stateMachine->addDefaultAnimation(smoothYRotation);
+ stateMachine->addDefaultAnimation(smoothXSelection);
+ stateMachine->addDefaultAnimation(smoothYSelection);
+ stateMachine->setInitialState(splashState);
+//! [10]
+
+//! [11]
+ // Transitions
+ QEventTransition *anyKeyTransition = new QEventTransition(this, QEvent::KeyPress, splashState);
+ anyKeyTransition->setTargetState(frontState);
+ anyKeyTransition->addAnimation(smoothSplashMove);
+ anyKeyTransition->addAnimation(smoothSplashOpacity);
+//! [11]
+
+//! [12]
+ QKeyEventTransition *enterTransition = new QKeyEventTransition(this, QEvent::KeyPress,
+ Qt::Key_Enter, backState);
+ QKeyEventTransition *returnTransition = new QKeyEventTransition(this, QEvent::KeyPress,
+ Qt::Key_Return, backState);
+ QKeyEventTransition *backEnterTransition = new QKeyEventTransition(this, QEvent::KeyPress,
+ Qt::Key_Enter, frontState);
+ QKeyEventTransition *backReturnTransition = new QKeyEventTransition(this, QEvent::KeyPress,
+ Qt::Key_Return, frontState);
+ enterTransition->setTargetState(historyState);
+ returnTransition->setTargetState(historyState);
+ backEnterTransition->setTargetState(backState);
+ backReturnTransition->setTargetState(backState);
+ enterTransition->addAnimation(flipAnimation);
+ returnTransition->addAnimation(flipAnimation);
+ backEnterTransition->addAnimation(flipAnimation);
+ backReturnTransition->addAnimation(flipAnimation);
+//! [12]
+
+//! [13]
+ // Create substates for each icon; store in temporary grid.
+ int columns = size.width();
+ int rows = size.height();
+ QList<QList<QState *>> stateGrid;
+ stateGrid.resize(rows);
+ for (int y = 0; y < rows; ++y) {
+ stateGrid[y].resize(columns);
+ for (int x = 0; x < columns; ++x)
+ stateGrid[y][x] = new QState(frontState);
+ }
+ frontState->setInitialState(stateGrid[0][0]);
+ selectionItem->setPos(pad->iconAt(0, 0)->pos());
+//! [13]
+
+//! [14]
+ // Enable key navigation using state transitions
+ for (int y = 0; y < rows; ++y) {
+ for (int x = 0; x < columns; ++x) {
+ QState *state = stateGrid[y][x];
+ QKeyEventTransition *rightTransition = new QKeyEventTransition(this, QEvent::KeyPress,
+ Qt::Key_Right, state);
+ QKeyEventTransition *leftTransition = new QKeyEventTransition(this, QEvent::KeyPress,
+ Qt::Key_Left, state);
+ QKeyEventTransition *downTransition = new QKeyEventTransition(this, QEvent::KeyPress,
+ Qt::Key_Down, state);
+ QKeyEventTransition *upTransition = new QKeyEventTransition(this, QEvent::KeyPress,
+ Qt::Key_Up, state);
+ rightTransition->setTargetState(stateGrid[y][(x + 1) % columns]);
+ leftTransition->setTargetState(stateGrid[y][((x - 1) + columns) % columns]);
+ downTransition->setTargetState(stateGrid[(y + 1) % rows][x]);
+ upTransition->setTargetState(stateGrid[((y - 1) + rows) % rows][x]);
+//! [14]
+//! [15]
+ RoundRectItem *icon = pad->iconAt(x, y);
+ state->assignProperty(xRotation, "angle", -icon->x() / 6.0);
+ state->assignProperty(yRotation, "angle", icon->y() / 6.0);
+ state->assignProperty(selectionItem, "x", icon->x());
+ state->assignProperty(selectionItem, "y", icon->y());
+ frontState->assignProperty(icon, "visible", true);
+ backState->assignProperty(icon, "visible", false);
+
+ QPropertyAnimation *setIconVisibleAnimation = new QPropertyAnimation(icon, "visible");
+ setIconVisibleAnimation->setDuration(0);
+ setVariablesSequence->addAnimation(setIconVisibleAnimation);
+ }
+ }
+//! [15]
+
+//! [16]
+ // Scene
+ QGraphicsScene *scene = new QGraphicsScene(this);
+ scene->setBackgroundBrush(QPixmap(":/images/blue_angle_swirl.jpg"));
+ scene->setItemIndexMethod(QGraphicsScene::NoIndex);
+ scene->addItem(pad);
+ scene->setSceneRect(scene->itemsBoundingRect());
+ setScene(scene);
+//! [16]
+
+//! [17]
+ // Adjust splash item to scene contents
+ const QRectF sbr = splash->boundingRect();
+ splash->setPos(-sbr.width() / 2, scene->sceneRect().top() - 2);
+ frontState->assignProperty(splash, "y", splash->y() - 100.0);
+ scene->addItem(splash);
+//! [17]
+
+//! [18]
+ // View
+ setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ setMinimumSize(50, 50);
+ setViewportUpdateMode(FullViewportUpdate);
+ setCacheMode(CacheBackground);
+ setRenderHints(QPainter::Antialiasing
+ | QPainter::SmoothPixmapTransform
+ | QPainter::TextAntialiasing);
+#ifndef QT_NO_OPENGL
+ setViewport(new QOpenGLWidget);
+#endif
+
+ stateMachine->start();
+//! [18]
+}
+
+//! [19]
+void PadNavigator::resizeEvent(QResizeEvent *event)
+{
+ QGraphicsView::resizeEvent(event);
+ fitInView(scene()->sceneRect(), Qt::KeepAspectRatio);
+}
+//! [19]
diff --git a/examples/statemachine/graphicsview/padnavigator/padnavigator.h b/examples/statemachine/graphicsview/padnavigator/padnavigator.h
new file mode 100644
index 0000000..0fe9ad0
--- /dev/null
+++ b/examples/statemachine/graphicsview/padnavigator/padnavigator.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+** 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
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef PADNAVIGATOR_H
+#define PADNAVIGATOR_H
+
+#include <QGraphicsView>
+#include "ui_form.h"
+
+//! [0]
+class PadNavigator : public QGraphicsView
+{
+ Q_OBJECT
+public:
+ explicit PadNavigator(const QSize &size, QWidget *parent = nullptr);
+
+protected:
+ void resizeEvent(QResizeEvent *event) override;
+
+private:
+ Ui::Form form;
+};
+//! [0]
+
+#endif // PADNAVIGATOR_H
diff --git a/examples/statemachine/graphicsview/padnavigator/padnavigator.pro b/examples/statemachine/graphicsview/padnavigator/padnavigator.pro
new file mode 100644
index 0000000..f787c51
--- /dev/null
+++ b/examples/statemachine/graphicsview/padnavigator/padnavigator.pro
@@ -0,0 +1,27 @@
+SOURCES += main.cpp \
+ roundrectitem.cpp \
+ flippablepad.cpp \
+ padnavigator.cpp \
+ splashitem.cpp
+
+HEADERS += \
+ roundrectitem.h \
+ flippablepad.h \
+ padnavigator.h \
+ splashitem.h
+
+RESOURCES += \
+ padnavigator.qrc
+
+FORMS += \
+ form.ui
+
+QT += statemachine widgets
+requires(qtConfig(treewidget))
+qtHaveModule(opengl): QT += opengl openglwidgets
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/statemachine/graphicsview/padnavigator
+INSTALLS += target
+
+CONFIG += console
diff --git a/examples/statemachine/graphicsview/padnavigator/padnavigator.qrc b/examples/statemachine/graphicsview/padnavigator/padnavigator.qrc
new file mode 100644
index 0000000..b26ab92
--- /dev/null
+++ b/examples/statemachine/graphicsview/padnavigator/padnavigator.qrc
@@ -0,0 +1,13 @@
+<RCC>
+ <qresource>
+ <file>images/blue_angle_swirl.jpg</file>
+ <file>images/artsfftscope.png</file>
+ <file>images/kontact_contacts.png</file>
+ <file>images/kontact_journal.png</file>
+ <file>images/kontact_mail.png</file>
+ <file>images/kontact_notes.png</file>
+ <file>images/kopeteavailable.png</file>
+ <file>images/metacontact_online.png</file>
+ <file>images/minitools.png</file>
+ </qresource>
+</RCC>
diff --git a/examples/statemachine/graphicsview/padnavigator/roundrectitem.cpp b/examples/statemachine/graphicsview/padnavigator/roundrectitem.cpp
new file mode 100644
index 0000000..b4ea489
--- /dev/null
+++ b/examples/statemachine/graphicsview/padnavigator/roundrectitem.cpp
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+** 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
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "roundrectitem.h"
+
+#include <QGuiApplication>
+#include <QPainter>
+#include <QPalette>
+
+//! [0]
+RoundRectItem::RoundRectItem(const QRectF &bounds, const QColor &color,
+ QGraphicsItem *parent)
+ : QGraphicsObject(parent), fillRect(false), bounds(bounds)
+{
+ gradient.setStart(bounds.topLeft());
+ gradient.setFinalStop(bounds.bottomRight());
+ gradient.setColorAt(0, color);
+ gradient.setColorAt(1, color.darker(200));
+ setCacheMode(ItemCoordinateCache);
+}
+//! [0]
+
+//! [1]
+QPixmap RoundRectItem::pixmap() const
+{
+ return pix;
+}
+void RoundRectItem::setPixmap(const QPixmap &pixmap)
+{
+ pix = pixmap;
+ update();
+}
+//! [1]
+
+//! [2]
+QRectF RoundRectItem::boundingRect() const
+{
+ return bounds.adjusted(0, 0, 2, 2);
+}
+//! [2]
+
+//! [3]
+void RoundRectItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+ QWidget *widget)
+{
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
+ painter->setPen(Qt::NoPen);
+ painter->setBrush(QColor(0, 0, 0, 64));
+ painter->drawRoundedRect(bounds.translated(2, 2), 25, 25, Qt::RelativeSize);
+//! [3]
+//! [4]
+ if (fillRect)
+ painter->setBrush(QGuiApplication::palette().brush(QPalette::Window));
+ else
+ painter->setBrush(gradient);
+ painter->setPen(QPen(Qt::black, 1));
+ painter->drawRoundedRect(bounds, 25,25, Qt::RelativeSize);
+//! [4]
+//! [5]
+ if (!pix.isNull()) {
+ painter->scale(1.95, 1.95);
+ painter->drawPixmap(-pix.width() / 2, -pix.height() / 2, pix);
+ }
+}
+//! [5]
+
+//! [6]
+bool RoundRectItem::fill() const
+{
+ return fillRect;
+}
+void RoundRectItem::setFill(bool fill)
+{
+ fillRect = fill;
+ update();
+}
+//! [6]
diff --git a/examples/statemachine/graphicsview/padnavigator/roundrectitem.h b/examples/statemachine/graphicsview/padnavigator/roundrectitem.h
new file mode 100644
index 0000000..91b3e65
--- /dev/null
+++ b/examples/statemachine/graphicsview/padnavigator/roundrectitem.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+** 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
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef ROUNDRECTITEM_H
+#define ROUNDRECTITEM_H
+
+#include <QGraphicsObject>
+#include <QLinearGradient>
+
+//! [0]
+class RoundRectItem : public QGraphicsObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool fill READ fill WRITE setFill)
+public:
+ RoundRectItem(const QRectF &bounds, const QColor &color,
+ QGraphicsItem *parent = nullptr);
+
+ QPixmap pixmap() const;
+ void setPixmap(const QPixmap &pixmap);
+
+ QRectF boundingRect() const override;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
+
+ bool fill() const;
+ void setFill(bool fill);
+//! [0]
+
+//! [1]
+private:
+ QPixmap pix;
+ bool fillRect;
+ QRectF bounds;
+ QLinearGradient gradient;
+};
+//! [1]
+
+#endif // ROUNDRECTITEM_H
diff --git a/examples/statemachine/graphicsview/padnavigator/splashitem.cpp b/examples/statemachine/graphicsview/padnavigator/splashitem.cpp
new file mode 100644
index 0000000..7c3dfba
--- /dev/null
+++ b/examples/statemachine/graphicsview/padnavigator/splashitem.cpp
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+** 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
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "splashitem.h"
+
+#include <QPainter>
+
+//! [0]
+SplashItem::SplashItem(QGraphicsItem *parent)
+ : QGraphicsObject(parent)
+{
+ text = tr("Welcome to the Pad Navigator Example. You can use the"
+ " keyboard arrows to navigate the icons, and press enter"
+ " to activate an item. Press any key to begin.");
+ setCacheMode(DeviceCoordinateCache);
+}
+//! [0]
+
+//! [1]
+QRectF SplashItem::boundingRect() const
+{
+ return QRectF(0, 0, 400, 175);
+}
+//! [1]
+
+//! [2]
+void SplashItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+ QWidget *widget)
+{
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
+ painter->setPen(QPen(Qt::black, 2));
+ painter->setBrush(QColor(245, 245, 255, 220));
+ painter->setClipRect(boundingRect());
+ painter->drawRoundedRect(3, -100 + 3, 400 - 6, 250 - 6, 25, 25, Qt::RelativeSize);
+
+ QRectF textRect = boundingRect().adjusted(10, 10, -10, -10);
+ int flags = Qt::AlignTop | Qt::AlignLeft | Qt::TextWordWrap;
+
+ QFont font;
+ font.setPixelSize(18);
+ painter->setPen(Qt::black);
+ painter->setFont(font);
+ painter->drawText(textRect, flags, text);
+}
+//! [2]
diff --git a/examples/statemachine/graphicsview/padnavigator/splashitem.h b/examples/statemachine/graphicsview/padnavigator/splashitem.h
new file mode 100644
index 0000000..b8e723d
--- /dev/null
+++ b/examples/statemachine/graphicsview/padnavigator/splashitem.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+** 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
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SPLASHITEM_H
+#define SPLASHITEM_H
+
+#include <QGraphicsObject>
+
+//! [0]
+class SplashItem : public QGraphicsObject
+{
+ Q_OBJECT
+public:
+ explicit SplashItem(QGraphicsItem *parent = nullptr);
+
+ QRectF boundingRect() const override;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
+
+private:
+ QString text;
+};
+//! [0]
+
+#endif // SPLASHITEM_H