diff options
Diffstat (limited to 'examples/widgets/graphicsview')
25 files changed, 0 insertions, 1395 deletions
diff --git a/examples/widgets/graphicsview/CMakeLists.txt b/examples/widgets/graphicsview/CMakeLists.txt index 5ea8d6b2c6..a60ba190ef 100644 --- a/examples/widgets/graphicsview/CMakeLists.txt +++ b/examples/widgets/graphicsview/CMakeLists.txt @@ -4,7 +4,6 @@ add_subdirectory(chip) add_subdirectory(elasticnodes) add_subdirectory(embeddeddialogs) add_subdirectory(collidingmice) -add_subdirectory(padnavigator) add_subdirectory(basicgraphicslayouts) add_subdirectory(diagramscene) add_subdirectory(flowlayout) diff --git a/examples/widgets/graphicsview/graphicsview.pro b/examples/widgets/graphicsview/graphicsview.pro index d591450559..8becd8aa9d 100644 --- a/examples/widgets/graphicsview/graphicsview.pro +++ b/examples/widgets/graphicsview/graphicsview.pro @@ -4,7 +4,6 @@ SUBDIRS = \ elasticnodes \ embeddeddialogs \ collidingmice \ - padnavigator \ basicgraphicslayouts \ diagramscene \ dragdroprobot \ diff --git a/examples/widgets/graphicsview/padnavigator/.prev_CMakeLists.txt b/examples/widgets/graphicsview/padnavigator/.prev_CMakeLists.txt deleted file mode 100644 index e00a7d40a5..0000000000 --- a/examples/widgets/graphicsview/padnavigator/.prev_CMakeLists.txt +++ /dev/null @@ -1,68 +0,0 @@ -# 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 Widgets) - -add_executable(padnavigator - flippablepad.cpp flippablepad.h - form.ui - main.cpp - padnavigator.cpp padnavigator.h - roundrectitem.cpp roundrectitem.h - splashitem.cpp splashitem.h -) -target_link_libraries(padnavigator PUBLIC - Qt::Core - Qt::Gui - 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/widgets/graphicsview/padnavigator/CMakeLists.txt b/examples/widgets/graphicsview/padnavigator/CMakeLists.txt deleted file mode 100644 index cb21f80d22..0000000000 --- a/examples/widgets/graphicsview/padnavigator/CMakeLists.txt +++ /dev/null @@ -1,69 +0,0 @@ -# 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 Widgets) -find_package(Qt6 COMPONENTS OpenGL) # special case - -add_executable(padnavigator - flippablepad.cpp flippablepad.h - form.ui - main.cpp - padnavigator.cpp padnavigator.h - roundrectitem.cpp roundrectitem.h - splashitem.cpp splashitem.h -) -target_link_libraries(padnavigator PUBLIC - Qt::Core - Qt::Gui - 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/widgets/graphicsview/padnavigator/flippablepad.cpp b/examples/widgets/graphicsview/padnavigator/flippablepad.cpp deleted file mode 100644 index 263909225e..0000000000 --- a/examples/widgets/graphicsview/padnavigator/flippablepad.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** 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/widgets/graphicsview/padnavigator/flippablepad.h b/examples/widgets/graphicsview/padnavigator/flippablepad.h deleted file mode 100644 index a056eae1c5..0000000000 --- a/examples/widgets/graphicsview/padnavigator/flippablepad.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** 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/widgets/graphicsview/padnavigator/form.ui b/examples/widgets/graphicsview/padnavigator/form.ui deleted file mode 100644 index fc7d12321e..0000000000 --- a/examples/widgets/graphicsview/padnavigator/form.ui +++ /dev/null @@ -1,208 +0,0 @@ -<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/widgets/graphicsview/padnavigator/images/artsfftscope.png b/examples/widgets/graphicsview/padnavigator/images/artsfftscope.png Binary files differdeleted file mode 100644 index 4db003f8d2..0000000000 --- a/examples/widgets/graphicsview/padnavigator/images/artsfftscope.png +++ /dev/null diff --git a/examples/widgets/graphicsview/padnavigator/images/blue_angle_swirl.jpg b/examples/widgets/graphicsview/padnavigator/images/blue_angle_swirl.jpg Binary files differdeleted file mode 100644 index 5bf0debdbd..0000000000 --- a/examples/widgets/graphicsview/padnavigator/images/blue_angle_swirl.jpg +++ /dev/null diff --git a/examples/widgets/graphicsview/padnavigator/images/kontact_contacts.png b/examples/widgets/graphicsview/padnavigator/images/kontact_contacts.png Binary files differdeleted file mode 100644 index 6fb4cc8f38..0000000000 --- a/examples/widgets/graphicsview/padnavigator/images/kontact_contacts.png +++ /dev/null diff --git a/examples/widgets/graphicsview/padnavigator/images/kontact_journal.png b/examples/widgets/graphicsview/padnavigator/images/kontact_journal.png Binary files differdeleted file mode 100644 index b1fedb6982..0000000000 --- a/examples/widgets/graphicsview/padnavigator/images/kontact_journal.png +++ /dev/null diff --git a/examples/widgets/graphicsview/padnavigator/images/kontact_mail.png b/examples/widgets/graphicsview/padnavigator/images/kontact_mail.png Binary files differdeleted file mode 100644 index 672f8fa3ab..0000000000 --- a/examples/widgets/graphicsview/padnavigator/images/kontact_mail.png +++ /dev/null diff --git a/examples/widgets/graphicsview/padnavigator/images/kontact_notes.png b/examples/widgets/graphicsview/padnavigator/images/kontact_notes.png Binary files differdeleted file mode 100644 index 229bf73ac6..0000000000 --- a/examples/widgets/graphicsview/padnavigator/images/kontact_notes.png +++ /dev/null diff --git a/examples/widgets/graphicsview/padnavigator/images/kopeteavailable.png b/examples/widgets/graphicsview/padnavigator/images/kopeteavailable.png Binary files differdeleted file mode 100644 index 2eaf41afec..0000000000 --- a/examples/widgets/graphicsview/padnavigator/images/kopeteavailable.png +++ /dev/null diff --git a/examples/widgets/graphicsview/padnavigator/images/metacontact_online.png b/examples/widgets/graphicsview/padnavigator/images/metacontact_online.png Binary files differdeleted file mode 100644 index 6a398dd10f..0000000000 --- a/examples/widgets/graphicsview/padnavigator/images/metacontact_online.png +++ /dev/null diff --git a/examples/widgets/graphicsview/padnavigator/images/minitools.png b/examples/widgets/graphicsview/padnavigator/images/minitools.png Binary files differdeleted file mode 100644 index 0248c9d50a..0000000000 --- a/examples/widgets/graphicsview/padnavigator/images/minitools.png +++ /dev/null diff --git a/examples/widgets/graphicsview/padnavigator/main.cpp b/examples/widgets/graphicsview/padnavigator/main.cpp deleted file mode 100644 index c433ab3aa9..0000000000 --- a/examples/widgets/graphicsview/padnavigator/main.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** 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/widgets/graphicsview/padnavigator/padnavigator.cpp b/examples/widgets/graphicsview/padnavigator/padnavigator.cpp deleted file mode 100644 index 5088386a26..0000000000 --- a/examples/widgets/graphicsview/padnavigator/padnavigator.cpp +++ /dev/null @@ -1,318 +0,0 @@ -/**************************************************************************** -** -** 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/widgets/graphicsview/padnavigator/padnavigator.h b/examples/widgets/graphicsview/padnavigator/padnavigator.h deleted file mode 100644 index 0fe9ad045d..0000000000 --- a/examples/widgets/graphicsview/padnavigator/padnavigator.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** 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/widgets/graphicsview/padnavigator/padnavigator.pro b/examples/widgets/graphicsview/padnavigator/padnavigator.pro deleted file mode 100644 index d957be4593..0000000000 --- a/examples/widgets/graphicsview/padnavigator/padnavigator.pro +++ /dev/null @@ -1,27 +0,0 @@ -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 += widgets -requires(qtConfig(treewidget)) -qtHaveModule(opengl): QT += opengl openglwidgets - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/widgets/graphicsview/padnavigator -INSTALLS += target - -CONFIG += console diff --git a/examples/widgets/graphicsview/padnavigator/padnavigator.qrc b/examples/widgets/graphicsview/padnavigator/padnavigator.qrc deleted file mode 100644 index b26ab92ae1..0000000000 --- a/examples/widgets/graphicsview/padnavigator/padnavigator.qrc +++ /dev/null @@ -1,13 +0,0 @@ -<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/widgets/graphicsview/padnavigator/roundrectitem.cpp b/examples/widgets/graphicsview/padnavigator/roundrectitem.cpp deleted file mode 100644 index b4ea489069..0000000000 --- a/examples/widgets/graphicsview/padnavigator/roundrectitem.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** 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/widgets/graphicsview/padnavigator/roundrectitem.h b/examples/widgets/graphicsview/padnavigator/roundrectitem.h deleted file mode 100644 index 91b3e6542e..0000000000 --- a/examples/widgets/graphicsview/padnavigator/roundrectitem.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** 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/widgets/graphicsview/padnavigator/splashitem.cpp b/examples/widgets/graphicsview/padnavigator/splashitem.cpp deleted file mode 100644 index 7c3dfba588..0000000000 --- a/examples/widgets/graphicsview/padnavigator/splashitem.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** 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/widgets/graphicsview/padnavigator/splashitem.h b/examples/widgets/graphicsview/padnavigator/splashitem.h deleted file mode 100644 index b8e723db81..0000000000 --- a/examples/widgets/graphicsview/padnavigator/splashitem.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** 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 |