From a78cae73b185a045f402c82a00e8c39111380775 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Mon, 18 Sep 2017 13:47:37 +0200 Subject: Doc: review Star Delegate Example - update screenshot - minor corrections description example Task-number: QTBUG-60635 Change-Id: I2351160ee9ec0a926fddb122e720c887f851dba5 Reviewed-by: Venugopal Shivashankar --- examples/widgets/doc/src/stardelegate.qdoc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'examples') diff --git a/examples/widgets/doc/src/stardelegate.qdoc b/examples/widgets/doc/src/stardelegate.qdoc index dcc7080456..44d17662ca 100644 --- a/examples/widgets/doc/src/stardelegate.qdoc +++ b/examples/widgets/doc/src/stardelegate.qdoc @@ -37,7 +37,7 @@ When displaying data in a QListView, QTableView, or QTreeView, the individual items are drawn by a \l{Delegate Classes}{delegate}. Also, when the user starts - editing an item (e.g., by double-clicking the item), the delegate + editing an item (for example, by double-clicking the item), the delegate provides an editor widget that is placed on top of the item while editing takes place. @@ -96,9 +96,9 @@ QItemDelegate paint it for us. This ensures that the \c StarDelegate can handle the most common data types. - In the case where the item is a \c StarRating, we draw the - background if the item is selected, and we draw the item using \c - StarRating::paint(), which we will review later. + If the item is a \c StarRating, we draw the background if the + item is selected, and we draw the item using \c StarRating::paint(), + which we will review later. \c{StartRating}s can be stored in a QVariant thanks to the Q_DECLARE_METATYPE() macro appearing in \c starrating.h. More on @@ -133,8 +133,8 @@ We simply call \c setStarRating() on the editor. The \l{QAbstractItemDelegate::}{setModelData()} function is - called when editing is finished, to commit data from the editor - to the model: + called to commit data from the editor to the model when editing + is finished: \snippet itemviews/stardelegate/stardelegate.cpp 4 @@ -210,7 +210,7 @@ current rating, and \c myMaxStarCount stores the highest possible rating (typically 5). - The Q_DECLARE_METATYPE() macro makes the type \c StarRating known + The \c Q_DECLARE_METATYPE() macro makes the type \c StarRating known to QVariant, making it possible to store \c StarRating values in QVariant. @@ -283,7 +283,7 @@ \list \li It is possible to open editors programmatically by calling QAbstractItemView::edit(), instead of relying on edit - triggers. This could be use to support other edit triggers + triggers. This could be used to support other edit triggers than those offered by the QAbstractItemView::EditTrigger enum. For example, in the Star Delegate example, hovering over an item with the mouse might make sense as a way to pop up an -- cgit v1.2.3 From 0bdbefa3c0dcc9c587a9adb555b547eac4323851 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Thu, 14 Sep 2017 17:10:12 +0200 Subject: Doc: add doc to Style Sheet example Task-number: QTBUG-60635 Change-Id: I6c80427bce1efc67bbf4ec67b0afeafc27088d79 Reviewed-by: Martin Smith --- examples/widgets/doc/src/stylesheet.qdoc | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'examples') diff --git a/examples/widgets/doc/src/stylesheet.qdoc b/examples/widgets/doc/src/stylesheet.qdoc index 0016836f0d..a86b697059 100644 --- a/examples/widgets/doc/src/stylesheet.qdoc +++ b/examples/widgets/doc/src/stylesheet.qdoc @@ -33,5 +33,56 @@ \borderedimage stylesheet-pagefold.png \caption Screen Shot of the Pagefold style sheet + + The Style Sheet example shows how widgets can be styled using Qt Style Sheets. + You can open the style editor by selecting \uicontrol File > \uicontrol Edit Style Sheet, + to select an existing style sheet or design your own style and load it. + + The Style Sheet example consists of 2 classes: + \list + \li \c MainWindow + \li \c StyleSheetEditor + \endlist + + + \section1 MainWindow Class + + \c MainWindow inherits QWidget, and is the application's main window defined in + \c mainwindow.ui. The style of \c MainWindow can be modified with \l StyleSheetEditor. + + + \section1 StyleSheetEditor Class + + \c StyleSheetEditor enables you to open an editor where you can load an existing style sheet. + It is also possible to define a new stylesheet and load it. Its layout is defined in + \c stylesheeteditor.ui. + + \quotefromfile widgets/stylesheet/stylesheeteditor.cpp + \skipto on_styleCombo_activated + \printline on_styleCombo_activated + + Sets the specified \a styleName and grays the \c applyButton. + + \skipto on_styleSheetCombo_activated + \printline on_styleSheetCombo_activated + + Loads the stylesheet from \c styleSheetName. + + \skipto on_styleTextEdit_textChanged() + \printline on_styleTextEdit_textChanged() + + Enables the \c applyButton when the text in the buffer has changed. + + \skipto on_applyButton_clicked() + \printline on_applyButton_clicked() + + Sets the stylesheet properties in \l qApp and disables the \c applyButton. + + \skipto loadStyleSheet(const QString &sheetName) + \printline loadStyleSheet(const QString &sheetName) + + Loads the specified \a sheetName, and sets its properties in + \l qApp. + */ -- cgit v1.2.3 From f39f813113d71ec7acb0ae99f6ee1ee64e76935c Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Tue, 24 Oct 2017 15:22:23 +0200 Subject: Doc: drop Lighting Effect Example Task-number: QTBUG-60635 Change-Id: If455a778ff6ebd53d8110b3dc25d8b9e27255bac Reviewed-by: Frederik Gladhorn Reviewed-by: Nico Vertriest --- examples/widgets/doc/src/lighting.qdoc | 35 ------ examples/widgets/effects/effects.pro | 1 - examples/widgets/effects/lighting/lighting.cpp | 145 ------------------------- examples/widgets/effects/lighting/lighting.h | 80 -------------- examples/widgets/effects/lighting/lighting.pro | 8 -- examples/widgets/effects/lighting/main.cpp | 65 ----------- 6 files changed, 334 deletions(-) delete mode 100644 examples/widgets/doc/src/lighting.qdoc delete mode 100644 examples/widgets/effects/lighting/lighting.cpp delete mode 100644 examples/widgets/effects/lighting/lighting.h delete mode 100644 examples/widgets/effects/lighting/lighting.pro delete mode 100644 examples/widgets/effects/lighting/main.cpp (limited to 'examples') diff --git a/examples/widgets/doc/src/lighting.qdoc b/examples/widgets/doc/src/lighting.qdoc deleted file mode 100644 index 994172cf5d..0000000000 --- a/examples/widgets/doc/src/lighting.qdoc +++ /dev/null @@ -1,35 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \example effects/lighting - \title Lighting Effect Example - \ingroup examples-graphicsview-graphicseffects - \brief Demonstrates how to apply effects on items in the view - - \image lightingeffect-example.png -*/ diff --git a/examples/widgets/effects/effects.pro b/examples/widgets/effects/effects.pro index 795e0508ac..05911979b9 100644 --- a/examples/widgets/effects/effects.pro +++ b/examples/widgets/effects/effects.pro @@ -2,5 +2,4 @@ TEMPLATE = \ subdirs SUBDIRS = \ blurpicker \ - lighting \ fademessage diff --git a/examples/widgets/effects/lighting/lighting.cpp b/examples/widgets/effects/lighting/lighting.cpp deleted file mode 100644 index 1ba7dd9ce7..0000000000 --- a/examples/widgets/effects/lighting/lighting.cpp +++ /dev/null @@ -1,145 +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 "lighting.h" -#include -#include - -Lighting::Lighting(QWidget *parent): QGraphicsView(parent), angle(0.0) -{ - setScene(&m_scene); - - setupScene(); - - QTimer *timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), SLOT(animate())); - timer->setInterval(30); - timer->start(); - - setRenderHint(QPainter::Antialiasing, true); - setFrameStyle(QFrame::NoFrame); -} - -void Lighting::setupScene() -{ - m_scene.setSceneRect(-300, -200, 600, 460); - - QLinearGradient linearGrad(QPointF(-100, -100), QPointF(100, 100)); - linearGrad.setColorAt(0, QColor(255, 255, 255)); - linearGrad.setColorAt(1, QColor(192, 192, 255)); - setBackgroundBrush(linearGrad); - - QRadialGradient radialGrad(30, 30, 30); - radialGrad.setColorAt(0, Qt::yellow); - radialGrad.setColorAt(0.2, Qt::yellow); - radialGrad.setColorAt(1, Qt::transparent); - QPixmap pixmap(60, 60); - pixmap.fill(Qt::transparent); - QPainter painter(&pixmap); - painter.setPen(Qt::NoPen); - painter.setBrush(radialGrad); - painter.drawEllipse(0, 0, 60, 60); - painter.end(); - - m_lightSource = m_scene.addPixmap(pixmap); - m_lightSource->setZValue(2); - - for (int i = -2; i < 3; ++i) - for (int j = -2; j < 3; ++j) { - QAbstractGraphicsShapeItem *item; - if ((i + j) & 1) - item = new QGraphicsEllipseItem(0, 0, 50, 50); - else - item = new QGraphicsRectItem(0, 0, 50, 50); - - item->setPen(QPen(Qt::black, 1)); - item->setBrush(QBrush(Qt::white)); - QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect; - effect->setBlurRadius(8); - item->setGraphicsEffect(effect); - item->setZValue(1); - item->setPos(i * 80, j * 80); - m_scene.addItem(item); - m_items << item; - } - - -} - -void Lighting::animate() -{ - angle += qDegreesToRadians(qreal(6)); - qreal xs = 200 * qSin(angle) - 40 + 25; - qreal ys = 200 * qCos(angle) - 40 + 25; - m_lightSource->setPos(xs, ys); - - for (int i = 0; i < m_items.size(); ++i) { - QGraphicsItem *item = m_items.at(i); - Q_ASSERT(item); - QGraphicsDropShadowEffect *effect = static_cast(item->graphicsEffect()); - Q_ASSERT(effect); - - QPointF delta(item->x() - xs, item->y() - ys); - effect->setOffset(delta.toPoint() / 30); - - qreal dx = delta.x(); - qreal dy = delta.y(); - qreal dd = qSqrt(dx * dx + dy * dy); - QColor color = effect->color(); - color.setAlphaF(qBound(0.4, 1 - dd / 200.0, 0.7)); - effect->setColor(color); - } - - m_scene.update(); -} - -void Lighting::resizeEvent(QResizeEvent * /* event */) -{ -} diff --git a/examples/widgets/effects/lighting/lighting.h b/examples/widgets/effects/lighting/lighting.h deleted file mode 100644 index 615824d46f..0000000000 --- a/examples/widgets/effects/lighting/lighting.h +++ /dev/null @@ -1,80 +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 LIGHTING_H -#define LIGHTING_H - -#include -#include - -class Lighting: public QGraphicsView -{ - Q_OBJECT - -public: - Lighting(QWidget *parent = 0); - -private slots: - void animate(); - -private: - void setupScene(); - -protected: - void resizeEvent(QResizeEvent *event) override; - -private: - qreal angle; - QGraphicsScene m_scene; - QGraphicsItem *m_lightSource; - QList m_items; -}; - -#endif // LIGHTING_H diff --git a/examples/widgets/effects/lighting/lighting.pro b/examples/widgets/effects/lighting/lighting.pro deleted file mode 100644 index 0a3b397de5..0000000000 --- a/examples/widgets/effects/lighting/lighting.pro +++ /dev/null @@ -1,8 +0,0 @@ -QT += widgets - -SOURCES += main.cpp lighting.cpp -HEADERS += lighting.h - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/widgets/effects/lighting -INSTALLS += target diff --git a/examples/widgets/effects/lighting/main.cpp b/examples/widgets/effects/lighting/main.cpp deleted file mode 100644 index 22e55c0985..0000000000 --- a/examples/widgets/effects/lighting/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 "lighting.h" -#include - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - - Lighting lighting; - lighting.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Lighting and Shadows")); - - lighting.resize(640, 480); - lighting.show(); - - return app.exec(); -} -- cgit v1.2.3 From 6e7cf8b918b05d093d80af3943dc32f7680b4c00 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Tue, 12 Sep 2017 13:53:42 +0200 Subject: Doc: update screenshots in Addressbook Example doc Task-number: QTBUG-60635 Change-Id: I5b098120f0e47687ac90d7f05b91a2a60f1eab32 Reviewed-by: Venugopal Shivashankar --- .../widgets/doc/images/addressbook-editdialog.png | Bin 8669 -> 11374 bytes examples/widgets/doc/images/addressbook-example.png | Bin 12388 -> 20047 bytes .../doc/images/addressbook-newaddresstab.png | Bin 12556 -> 17413 bytes 3 files changed, 0 insertions(+), 0 deletions(-) (limited to 'examples') diff --git a/examples/widgets/doc/images/addressbook-editdialog.png b/examples/widgets/doc/images/addressbook-editdialog.png index fd41ee63f7..7434aa44ef 100644 Binary files a/examples/widgets/doc/images/addressbook-editdialog.png and b/examples/widgets/doc/images/addressbook-editdialog.png differ diff --git a/examples/widgets/doc/images/addressbook-example.png b/examples/widgets/doc/images/addressbook-example.png index b743c166da..eebe97a718 100644 Binary files a/examples/widgets/doc/images/addressbook-example.png and b/examples/widgets/doc/images/addressbook-example.png differ diff --git a/examples/widgets/doc/images/addressbook-newaddresstab.png b/examples/widgets/doc/images/addressbook-newaddresstab.png index ff215a4b20..6b60ee08e9 100644 Binary files a/examples/widgets/doc/images/addressbook-newaddresstab.png and b/examples/widgets/doc/images/addressbook-newaddresstab.png differ -- cgit v1.2.3 From b00feb8cfc0d2a6451f93573ca1533ca9117d854 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Wed, 18 Oct 2017 13:32:57 +0200 Subject: Doc: Add screenshot to Validators example Task-number: QTBUG-60635 Change-Id: Ie68e611b57900847a00587fdf8558be4be38f23d Reviewed-by: Venugopal Shivashankar --- examples/widgets/doc/src/validators.qdoc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'examples') diff --git a/examples/widgets/doc/src/validators.qdoc b/examples/widgets/doc/src/validators.qdoc index f3f4dc5e63..bbb2e5f7b6 100644 --- a/examples/widgets/doc/src/validators.qdoc +++ b/examples/widgets/doc/src/validators.qdoc @@ -31,4 +31,6 @@ \ingroup examples-widgets \brief The Validators example shows the signal emission behavior of input validators. + + \borderedimage validators.png */ -- cgit v1.2.3 From 64298b42a3c17cefd45e9d2b8d17b026b7db1eca Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Tue, 24 Oct 2017 15:44:30 +0200 Subject: Doc: drop Application Chooser Example There are plenty of other examples showing how to use QStateMachine Task-number: QTBUG-60635 Change-Id: I82300b2a0f4e7733f08579a2aa9b548cb7d87efa Reviewed-by: Venugopal Shivashankar Reviewed-by: Richard Moe Gustavsen --- examples/widgets/animation/animation.pro | 1 - .../appchooser/accessories-dictionary.png | Bin 5396 -> 0 bytes .../widgets/animation/appchooser/akregator.png | Bin 4873 -> 0 bytes .../widgets/animation/appchooser/appchooser.pro | 8 - .../widgets/animation/appchooser/appchooser.qrc | 8 - examples/widgets/animation/appchooser/digikam.png | Bin 3334 -> 0 bytes examples/widgets/animation/appchooser/k3b.png | Bin 8220 -> 0 bytes examples/widgets/animation/appchooser/main.cpp | 183 --------------------- examples/widgets/doc/src/appchooser.qdoc | 38 ----- 9 files changed, 238 deletions(-) delete mode 100644 examples/widgets/animation/appchooser/accessories-dictionary.png delete mode 100644 examples/widgets/animation/appchooser/akregator.png delete mode 100644 examples/widgets/animation/appchooser/appchooser.pro delete mode 100644 examples/widgets/animation/appchooser/appchooser.qrc delete mode 100644 examples/widgets/animation/appchooser/digikam.png delete mode 100644 examples/widgets/animation/appchooser/k3b.png delete mode 100644 examples/widgets/animation/appchooser/main.cpp delete mode 100644 examples/widgets/doc/src/appchooser.qdoc (limited to 'examples') diff --git a/examples/widgets/animation/animation.pro b/examples/widgets/animation/animation.pro index a13f8bb65a..19b79caf15 100644 --- a/examples/widgets/animation/animation.pro +++ b/examples/widgets/animation/animation.pro @@ -2,7 +2,6 @@ TEMPLATE = \ subdirs SUBDIRS += \ animatedtiles \ - appchooser \ easing \ moveblocks \ states \ diff --git a/examples/widgets/animation/appchooser/accessories-dictionary.png b/examples/widgets/animation/appchooser/accessories-dictionary.png deleted file mode 100644 index e9bd55d918..0000000000 Binary files a/examples/widgets/animation/appchooser/accessories-dictionary.png and /dev/null differ diff --git a/examples/widgets/animation/appchooser/akregator.png b/examples/widgets/animation/appchooser/akregator.png deleted file mode 100644 index a086f45ab6..0000000000 Binary files a/examples/widgets/animation/appchooser/akregator.png and /dev/null differ diff --git a/examples/widgets/animation/appchooser/appchooser.pro b/examples/widgets/animation/appchooser/appchooser.pro deleted file mode 100644 index 674e623b2d..0000000000 --- a/examples/widgets/animation/appchooser/appchooser.pro +++ /dev/null @@ -1,8 +0,0 @@ -QT += widgets - -SOURCES = main.cpp -RESOURCES = appchooser.qrc - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/widgets/animation/appchooser -INSTALLS += target diff --git a/examples/widgets/animation/appchooser/appchooser.qrc b/examples/widgets/animation/appchooser/appchooser.qrc deleted file mode 100644 index 28a3e1c4c1..0000000000 --- a/examples/widgets/animation/appchooser/appchooser.qrc +++ /dev/null @@ -1,8 +0,0 @@ - - - accessories-dictionary.png - akregator.png - digikam.png - k3b.png - - diff --git a/examples/widgets/animation/appchooser/digikam.png b/examples/widgets/animation/appchooser/digikam.png deleted file mode 100644 index 9de9fb2f80..0000000000 Binary files a/examples/widgets/animation/appchooser/digikam.png and /dev/null differ diff --git a/examples/widgets/animation/appchooser/k3b.png b/examples/widgets/animation/appchooser/k3b.png deleted file mode 100644 index bbcafcfba1..0000000000 Binary files a/examples/widgets/animation/appchooser/k3b.png and /dev/null differ diff --git a/examples/widgets/animation/appchooser/main.cpp b/examples/widgets/animation/appchooser/main.cpp deleted file mode 100644 index 71c869f6a2..0000000000 --- a/examples/widgets/animation/appchooser/main.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtCore module 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 -#include - - -class Pixmap : public QGraphicsWidget -{ - Q_OBJECT - -public: - Pixmap(const QPixmap &pix, QGraphicsItem *parent = 0) - : QGraphicsWidget(parent), orig(pix), p(pix) - { - } - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) override - { - painter->drawPixmap(QPointF(), p); - } - - void mousePressEvent(QGraphicsSceneMouseEvent *) override - { - emit clicked(); - } - - void setGeometry(const QRectF &rect) override - { - QGraphicsWidget::setGeometry(rect); - - if (rect.size().width() > orig.size().width()) - p = orig.scaled(rect.size().toSize()); - else - p = orig; - } - -Q_SIGNALS: - void clicked(); - -private: - QPixmap orig; - QPixmap p; -}; - -class GraphicsView : public QGraphicsView -{ - Q_OBJECT -public: - GraphicsView(QGraphicsScene *scene, QWidget *parent = 0) : QGraphicsView(scene, parent) - { - } - - void resizeEvent(QResizeEvent *) override - { - fitInView(sceneRect(), Qt::KeepAspectRatio); - } -}; - - -void createStates(const QObjectList &objects, - const QRect &selectedRect, QState *parent) -{ - for (int i = 0; i < objects.size(); ++i) { - QState *state = new QState(parent); - state->assignProperty(objects.at(i), "geometry", selectedRect); - parent->addTransition(objects.at(i), SIGNAL(clicked()), state); - } -} - -void createAnimations(const QObjectList &objects, QStateMachine *machine) -{ - for (int i=0; iaddDefaultAnimation(new QPropertyAnimation(objects.at(i), "geometry")); -} - -int main(int argc, char **argv) -{ - Q_INIT_RESOURCE(appchooser); - - QApplication app(argc, argv); - - Pixmap *p1 = new Pixmap(QPixmap(":/digikam.png")); - Pixmap *p2 = new Pixmap(QPixmap(":/akregator.png")); - Pixmap *p3 = new Pixmap(QPixmap(":/accessories-dictionary.png")); - Pixmap *p4 = new Pixmap(QPixmap(":/k3b.png")); - - p1->setObjectName("p1"); - p2->setObjectName("p2"); - p3->setObjectName("p3"); - p4->setObjectName("p4"); - - p1->setGeometry(QRectF( 0.0, 0.0, 64.0, 64.0)); - p2->setGeometry(QRectF(236.0, 0.0, 64.0, 64.0)); - p3->setGeometry(QRectF(236.0, 236.0, 64.0, 64.0)); - p4->setGeometry(QRectF( 0.0, 236.0, 64.0, 64.0)); - - QGraphicsScene scene(0, 0, 300, 300); - scene.setBackgroundBrush(Qt::white); - scene.addItem(p1); - scene.addItem(p2); - scene.addItem(p3); - scene.addItem(p4); - - GraphicsView window(&scene); - window.setFrameStyle(0); - window.setAlignment(Qt::AlignLeft | Qt::AlignTop); - window.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - window.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - - QStateMachine machine; - machine.setGlobalRestorePolicy(QState::RestoreProperties); - - QState *group = new QState(&machine); - group->setObjectName("group"); - - QRect selectedRect(86, 86, 128, 128); - - QState *idleState = new QState(group); - group->setInitialState(idleState); - - QObjectList objects; - objects << p1 << p2 << p3 << p4; - createStates(objects, selectedRect, group); - createAnimations(objects, &machine); - - machine.setInitialState(group); - machine.start(); - - window.resize(300, 300); - window.show(); - - return app.exec(); -} - -#include "main.moc" diff --git a/examples/widgets/doc/src/appchooser.qdoc b/examples/widgets/doc/src/appchooser.qdoc deleted file mode 100644 index e74860214a..0000000000 --- a/examples/widgets/doc/src/appchooser.qdoc +++ /dev/null @@ -1,38 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \example animation/appchooser - \title Application Chooser Example - - \brief The Application Chooser example shows how to use the Qt state - machine and the animation framework to select between - applications. - - \image appchooser-example.png - -*/ -- cgit v1.2.3 From cfccd44b9db066e996759515297b42865064c806 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 25 Apr 2017 10:18:08 +0200 Subject: Demonstrate the new AA_CompressTabletEvents in the tablet example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I1972da2ead51274771ff24b4c506c2b581ee6abe Reviewed-by: Gabriel de Dietrich Reviewed-by: Jan Arve Sæther --- examples/widgets/widgets/tablet/mainwindow.cpp | 10 ++++++++++ examples/widgets/widgets/tablet/mainwindow.h | 1 + 2 files changed, 11 insertions(+) (limited to 'examples') diff --git a/examples/widgets/widgets/tablet/mainwindow.cpp b/examples/widgets/widgets/tablet/mainwindow.cpp index 0d63ac316b..feae16dd83 100644 --- a/examples/widgets/widgets/tablet/mainwindow.cpp +++ b/examples/widgets/widgets/tablet/mainwindow.cpp @@ -60,6 +60,7 @@ MainWindow::MainWindow(TabletCanvas *canvas) createMenus(); setWindowTitle(tr("Tablet Example")); setCentralWidget(m_canvas); + QCoreApplication::setAttribute(Qt::AA_CompressHighFrequencyEvents); } //! [0] @@ -97,6 +98,11 @@ void MainWindow::setSaturationValuator(QAction *action) } //! [4] +void MainWindow::setEventCompression(bool compress) +{ + QCoreApplication::setAttribute(Qt::AA_CompressTabletEvents, compress); +} + //! [5] void MainWindow::save() { @@ -220,6 +226,10 @@ void MainWindow::createMenus() connect(colorSaturationGroup, &QActionGroup::triggered, this, &MainWindow::setSaturationValuator); + QAction *compressAction = tabletMenu->addAction(tr("Co&mpress events")); + compressAction->setCheckable(true); + connect(compressAction, &QAction::toggled, this, &MainWindow::setEventCompression); + QMenu *helpMenu = menuBar()->addMenu("&Help"); helpMenu->addAction(tr("A&bout"), this, &MainWindow::about); helpMenu->addAction(tr("About &Qt"), qApp, &QApplication::aboutQt); diff --git a/examples/widgets/widgets/tablet/mainwindow.h b/examples/widgets/widgets/tablet/mainwindow.h index 68af1f1687..4b99324f04 100644 --- a/examples/widgets/widgets/tablet/mainwindow.h +++ b/examples/widgets/widgets/tablet/mainwindow.h @@ -71,6 +71,7 @@ private slots: void setAlphaValuator(QAction *action); void setLineWidthValuator(QAction *action); void setSaturationValuator(QAction *action); + void setEventCompression(bool compress); void save(); void load(); void about(); -- cgit v1.2.3 From 1fe6a75fecfad98c907bf8961b163a0f65f62c72 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Fri, 24 Nov 2017 15:33:00 +0100 Subject: Doc: Minor corrections custom sort filter example Task-number: QTBUG-60635 Change-Id: I17a69f85663eaa92e92b4e97385c21a729405e1f Reviewed-by: Venugopal Shivashankar --- examples/widgets/doc/src/customsortfiltermodel.qdoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'examples') diff --git a/examples/widgets/doc/src/customsortfiltermodel.qdoc b/examples/widgets/doc/src/customsortfiltermodel.qdoc index 0eb6560e10..6eab846e89 100644 --- a/examples/widgets/doc/src/customsortfiltermodel.qdoc +++ b/examples/widgets/doc/src/customsortfiltermodel.qdoc @@ -75,7 +75,7 @@ QSortFilterProxyModel's default implementations of functions are written so that they call the equivalent functions in the relevant source model. This simple proxying mechanism may need to be - overridden for source models with more complex behavior; in this + overridden for source models with more complex behavior. In this example we derive from the QSortFilterProxyModel class to ensure that our filter can recognize a valid range of dates, and to control the sorting behavior. @@ -170,7 +170,7 @@ We implement two private slots, \c textFilterChanged() and \c dateFilterChanged(), to respond to the user changing the filter - pattern, case sensitivity or any of the dates. In addition, we + pattern, case sensitivity, or any of the dates. In addition, we implement a public \c setSourceModel() convenience function to set up the model/ view relation. @@ -197,7 +197,7 @@ \snippet itemviews/customsortfiltermodel/window.cpp 1 The QTreeView class provides a default model/view implementation - of a tree view; our view implements a tree representation of items + of a tree view. Our view implements a tree representation of items in the application's source model. \snippet itemviews/customsortfiltermodel/window.cpp 2 -- cgit v1.2.3 From d0812cbdabcff4d388334c499c23992cce98d4da Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Fri, 10 Nov 2017 12:14:02 +0100 Subject: Doc: modify connect statement to new syntax MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-60635 Change-Id: I776bdc49ae42e2d0c11dc33d58d9ce91b9f5e753 Reviewed-by: Mårten Nordheim Reviewed-by: Edward Welbourne --- examples/widgets/painting/affine/xform.cpp | 48 +++++++++++++++--------------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'examples') diff --git a/examples/widgets/painting/affine/xform.cpp b/examples/widgets/painting/affine/xform.cpp index e47bc9d251..20f6eb3c6d 100644 --- a/examples/widgets/painting/affine/xform.cpp +++ b/examples/widgets/painting/affine/xform.cpp @@ -77,8 +77,8 @@ XFormView::XFormView(QWidget *parent) pts->setBoundingRect(QRectF(0, 0, 500, 500)); ctrlPoints << QPointF(250, 250) << QPointF(350, 250); pts->setPoints(ctrlPoints); - connect(pts, SIGNAL(pointsChanged(QPolygonF)), - this, SLOT(updateCtrlPoints(QPolygonF))); + connect(pts, &HoverPoints::pointsChanged, + this,&XFormView::updateCtrlPoints); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); } @@ -876,29 +876,29 @@ XFormWidget::XFormWidget(QWidget *parent) #endif mainGroupLayout->addWidget(whatsThisButton); - connect(rotateSlider, SIGNAL(valueChanged(int)), view, SLOT(changeRotation(int))); - connect(shearSlider, SIGNAL(valueChanged(int)), view, SLOT(changeShear(int))); - connect(scaleSlider, SIGNAL(valueChanged(int)), view, SLOT(changeScale(int))); - - connect(vectorType, SIGNAL(clicked()), view, SLOT(setVectorType())); - connect(pixmapType, SIGNAL(clicked()), view, SLOT(setPixmapType())); - connect(textType, SIGNAL(clicked()), view, SLOT(setTextType())); - connect(textType, SIGNAL(toggled(bool)), textEditor, SLOT(setEnabled(bool))); - connect(textEditor, SIGNAL(textChanged(QString)), view, SLOT(setText(QString))); - - connect(view, SIGNAL(rotationChanged(int)), rotateSlider, SLOT(setValue(int))); - connect(view, SIGNAL(scaleChanged(int)), scaleSlider, SLOT(setValue(int))); - connect(view, SIGNAL(shearChanged(int)), shearSlider, SLOT(setValue(int))); - - connect(resetButton, SIGNAL(clicked()), view, SLOT(reset())); - connect(animateButton, SIGNAL(clicked(bool)), view, SLOT(setAnimation(bool))); - connect(whatsThisButton, SIGNAL(clicked(bool)), view, SLOT(setDescriptionEnabled(bool))); - connect(whatsThisButton, SIGNAL(clicked(bool)), view->hoverPoints(), SLOT(setDisabled(bool))); - connect(view, SIGNAL(descriptionEnabledChanged(bool)), view->hoverPoints(), SLOT(setDisabled(bool))); - connect(view, SIGNAL(descriptionEnabledChanged(bool)), whatsThisButton, SLOT(setChecked(bool))); - connect(showSourceButton, SIGNAL(clicked()), view, SLOT(showSource())); + connect(rotateSlider, &QSlider::valueChanged, view, &XFormView::changeRotation); + connect(shearSlider, &QSlider::valueChanged, view, &XFormView::changeShear); + connect(scaleSlider, &QSlider::valueChanged, view, &XFormView::changeScale); + + connect(vectorType, &QRadioButton::clicked, view, &XFormView::setVectorType); + connect(pixmapType, &QRadioButton::clicked, view, &XFormView::setPixmapType); + connect(textType, &QRadioButton::clicked, view, &XFormView::setTextType); + connect(textType, &QRadioButton::toggled, textEditor, &XFormView::setEnabled); + connect(textEditor, &QLineEdit::textChanged, view, &XFormView::setText); + + connect(view, &XFormView::rotationChanged, rotateSlider, &QSlider::setValue); + connect(view, &XFormView::scaleChanged, scaleSlider, &QAbstractSlider::setValue); + connect(view, &XFormView::shearChanged, shearSlider, &QAbstractSlider::setValue); + + connect(resetButton, &QPushButton::clicked, view, &XFormView::reset); + connect(animateButton, &QPushButton::clicked, view, &XFormView::setAnimation); + connect(whatsThisButton, &QPushButton::clicked, view, &ArthurFrame::setDescriptionEnabled); + connect(whatsThisButton, &QPushButton::clicked, view->hoverPoints(), &HoverPoints::setDisabled); + connect(view, &XFormView::descriptionEnabledChanged, view->hoverPoints(), &HoverPoints::setDisabled); + connect(view, &XFormView::descriptionEnabledChanged, whatsThisButton, &QPushButton::setChecked); + connect(showSourceButton, &QPushButton::clicked, view, &XFormView::showSource); #ifdef QT_OPENGL_SUPPORT - connect(enableOpenGLButton, SIGNAL(clicked(bool)), view, SLOT(enableOpenGL(bool))); + connect(enableOpenGLButton, &QPushButton::clicked, view, &XFormView::enableOpenGL); #endif view->loadSourceFile(":res/affine/xform.cpp"); view->loadDescription(":res/affine/xform.html"); -- cgit v1.2.3