diff options
Diffstat (limited to 'examples')
410 files changed, 2069 insertions, 1951 deletions
diff --git a/examples/aggregate/examples.pro b/examples/aggregate/examples.pro new file mode 100644 index 0000000000..bf5e48fd59 --- /dev/null +++ b/examples/aggregate/examples.pro @@ -0,0 +1,6 @@ +TEMPLATE = subdirs + +sd = $$files(*) +for(d, sd): \ + exists($$d/$${d}.pro): \ + SUBDIRS += $$d diff --git a/examples/dbus/complexpingpong/complexpingpong.pro b/examples/dbus/complexpingpong/complexpingpong.pro index 1dfeff92ac..cd618d549d 100644 --- a/examples/dbus/complexpingpong/complexpingpong.pro +++ b/examples/dbus/complexpingpong/complexpingpong.pro @@ -2,4 +2,3 @@ TEMPLATE = subdirs CONFIG += ordered win32:CONFIG += console SUBDIRS = complexping.pro complexpong.pro -QT += widgets diff --git a/examples/dbus/dbus.pro b/examples/dbus/dbus.pro index 89d42bf7fe..fd43c23fa3 100644 --- a/examples/dbus/dbus.pro +++ b/examples/dbus/dbus.pro @@ -3,9 +3,7 @@ SUBDIRS = listnames \ pingpong \ complexpingpong -!contains(QT_CONFIG, no-widgets) { +qtHaveModule(widgets) { SUBDIRS += chat \ remotecontrolledcar } - -QT += widgets diff --git a/examples/dbus/doc/src/chat.qdoc b/examples/dbus/doc/src/chat.qdoc new file mode 100644 index 0000000000..b06338d87e --- /dev/null +++ b/examples/dbus/doc/src/chat.qdoc @@ -0,0 +1,31 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example chat + \title D-Bus Chat Example +*/ diff --git a/examples/dbus/doc/src/complexpingpong.qdoc b/examples/dbus/doc/src/complexpingpong.qdoc new file mode 100644 index 0000000000..60b0e10feb --- /dev/null +++ b/examples/dbus/doc/src/complexpingpong.qdoc @@ -0,0 +1,31 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example complexpingpong + \title D-Bus Complex Ping Pong Example +*/ diff --git a/examples/dbus/doc/src/listnames.qdoc b/examples/dbus/doc/src/listnames.qdoc new file mode 100644 index 0000000000..e5dc2671dd --- /dev/null +++ b/examples/dbus/doc/src/listnames.qdoc @@ -0,0 +1,31 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example listnames + \title D-Bus List Names Example +*/ diff --git a/examples/dbus/doc/src/pingpong.qdoc b/examples/dbus/doc/src/pingpong.qdoc new file mode 100644 index 0000000000..f16ecb9c98 --- /dev/null +++ b/examples/dbus/doc/src/pingpong.qdoc @@ -0,0 +1,31 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example pingpong + \title D-Bus Ping Pong Example +*/ diff --git a/examples/dbus/doc/src/remotecontrolledcar.qdoc b/examples/dbus/doc/src/remotecontrolledcar.qdoc new file mode 100644 index 0000000000..cb91ac28b6 --- /dev/null +++ b/examples/dbus/doc/src/remotecontrolledcar.qdoc @@ -0,0 +1,31 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example remotecontrolledcar + \title D-Bus Remote Controlled Car Example +*/ diff --git a/examples/dbus/pingpong/pingpong.pro b/examples/dbus/pingpong/pingpong.pro index 701e778676..07fca74c9a 100644 --- a/examples/dbus/pingpong/pingpong.pro +++ b/examples/dbus/pingpong/pingpong.pro @@ -2,4 +2,3 @@ TEMPLATE = subdirs CONFIG += ordered win32:CONFIG += console SUBDIRS = ping.pro pong.pro -QT += widgets diff --git a/examples/dbus/remotecontrolledcar/doc/images/remotecontrolledcar-car-example.png b/examples/dbus/remotecontrolledcar/doc/images/remotecontrolledcar-car-example.png Binary files differnew file mode 100644 index 0000000000..7e08340c80 --- /dev/null +++ b/examples/dbus/remotecontrolledcar/doc/images/remotecontrolledcar-car-example.png diff --git a/examples/dbus/remotecontrolledcar/doc/src/dbus-remotecontrolledcar.qdoc b/examples/dbus/remotecontrolledcar/doc/src/dbus-remotecontrolledcar.qdoc new file mode 100644 index 0000000000..05c750803e --- /dev/null +++ b/examples/dbus/remotecontrolledcar/doc/src/dbus-remotecontrolledcar.qdoc @@ -0,0 +1,36 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example dbus/remotecontrolledcar + \title D-Bus Remote Controlled Car Example + + The Remote Controlled Car example shows how to use D-Bus to control one + application using another. + + \image remotecontrolledcar-car-example.png +*/ diff --git a/examples/dbus/remotecontrolledcar/remotecontrolledcar.pro b/examples/dbus/remotecontrolledcar/remotecontrolledcar.pro index f5a0c27435..2a1fddb500 100644 --- a/examples/dbus/remotecontrolledcar/remotecontrolledcar.pro +++ b/examples/dbus/remotecontrolledcar/remotecontrolledcar.pro @@ -1,5 +1,3 @@ TEMPLATE = subdirs SUBDIRS = car \ controller - -QT += widgets diff --git a/examples/embedded/embedded.pro b/examples/embedded/embedded.pro index aa01bda368..d7d69d3efe 100644 --- a/examples/embedded/embedded.pro +++ b/examples/embedded/embedded.pro @@ -3,5 +3,3 @@ SUBDIRS = styleexample raycasting flickable digiflip SUBDIRS += lightmaps SUBDIRS += flightinfo - -QT += widgets widgets diff --git a/examples/embedded/flickable/flickable.pro b/examples/embedded/flickable/flickable.pro index 3bc86c661f..5929207414 100644 --- a/examples/embedded/flickable/flickable.pro +++ b/examples/embedded/flickable/flickable.pro @@ -1,6 +1,7 @@ +QT += widgets + SOURCES = flickable.cpp main.cpp HEADERS = flickable.h target.path = $$[QT_INSTALL_EXAMPLES]/embedded/flickable INSTALLS += target -QT += widgets widgets diff --git a/examples/embedded/raycasting/raycasting.pro b/examples/embedded/raycasting/raycasting.pro index 79b560ffeb..51bf4bf4b0 100644 --- a/examples/embedded/raycasting/raycasting.pro +++ b/examples/embedded/raycasting/raycasting.pro @@ -1,7 +1,7 @@ TEMPLATE = app +QT += widgets SOURCES = raycasting.cpp RESOURCES += raycasting.qrc target.path = $$[QT_INSTALL_EXAMPLES]/embedded/raycasting INSTALLS += target -QT += widgets widgets diff --git a/examples/examples.pro b/examples/examples.pro index 7c149ff7ac..e66226703e 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -8,19 +8,24 @@ SUBDIRS = \ xml \ qpa -!contains(QT_CONFIG, no-widgets) { +qtHaveModule(widgets) { SUBDIRS += widgets \ ipc \ - linguist \ sql \ tools \ touch \ gestures } -wince*|embedded|x11:!contains(QT_CONFIG, no-gui): SUBDIRS += embedded +wince*|embedded|x11:qtHaveModule(gui): SUBDIRS += embedded -contains(QT_BUILD_PARTS, tools):!contains(QT_CONFIG, no-gui):!contains(QT_CONFIG, no-widgets):SUBDIRS += qtestlib -contains(QT_CONFIG, opengl):!contains(QT_CONFIG, no-widgets):SUBDIRS += opengl -contains(QT_CONFIG, dbus): SUBDIRS += dbus -contains(QT_CONFIG, concurrent): SUBDIRS += qtconcurrent +contains(QT_BUILD_PARTS, tools):qtHaveModule(gui):qtHaveModule(widgets): SUBDIRS += qtestlib +qtHaveModule(opengl):qtHaveModule(widgets): SUBDIRS += opengl +qtHaveModule(dbus): SUBDIRS += dbus +qtHaveModule(concurrent): SUBDIRS += qtconcurrent + +aggregate.files = aggregate/examples.pro +aggregate.path = $$[QT_INSTALL_EXAMPLES] +readme.files = README +readme.path = $$[QT_INSTALL_EXAMPLES] +INSTALLS += aggregate readme diff --git a/examples/gestures/gestures.pro b/examples/gestures/gestures.pro index 678fbc5829..35b60bef38 100644 --- a/examples/gestures/gestures.pro +++ b/examples/gestures/gestures.pro @@ -2,5 +2,3 @@ TEMPLATE = \ subdirs SUBDIRS = \ imagegestures - -QT += widgets diff --git a/examples/gestures/imagegestures/imagegestures.pro b/examples/gestures/imagegestures/imagegestures.pro index 7844cc2ea1..c40c29564f 100644 --- a/examples/gestures/imagegestures/imagegestures.pro +++ b/examples/gestures/imagegestures/imagegestures.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = imagewidget.h \ mainwidget.h SOURCES = imagewidget.cpp \ @@ -8,5 +10,3 @@ SOURCES = imagewidget.cpp \ target.path = $$[QT_INSTALL_EXAMPLES]/gestures/imagegestures INSTALLS += target -QT += widgets - diff --git a/examples/gui/analogclock/analogclock.pro b/examples/gui/analogclock/analogclock.pro index 7e0360d28a..eef17274f5 100644 --- a/examples/gui/analogclock/analogclock.pro +++ b/examples/gui/analogclock/analogclock.pro @@ -1,4 +1,10 @@ include(../rasterwindow/rasterwindow.pri) +# work-around for QTBUG-13496 +CONFIG += no_batch + SOURCES += \ main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/gui/analogclock +INSTALLS += target diff --git a/examples/gui/doc/images/openglwindow-example.png b/examples/gui/doc/images/openglwindow-example.png Binary files differnew file mode 100644 index 0000000000..63ba4ed2f4 --- /dev/null +++ b/examples/gui/doc/images/openglwindow-example.png diff --git a/examples/gui/doc/analogclockwindow.qdoc b/examples/gui/doc/src/analogclockwindow.qdoc index ebe9f9a418..ff361a27b1 100644 --- a/examples/gui/doc/analogclockwindow.qdoc +++ b/examples/gui/doc/src/analogclockwindow.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example gui/analogclock + \example analogclock \title Analog Clock Window Example \brief The Analog Clock Window example shows how to draw the contents of diff --git a/examples/gui/doc/openglwindow.qdoc b/examples/gui/doc/src/openglwindow.qdoc index 9d693bc50e..d26fd477af 100644 --- a/examples/gui/doc/openglwindow.qdoc +++ b/examples/gui/doc/src/openglwindow.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example gui/openglwindow + \example openglwindow \title OpenGL Window Example \brief This example shows how to create a minimal QWindow based application @@ -105,8 +105,8 @@ QOpenGLContext::functions(). QOpenGLFunctions gives access to all the OpenGL ES 2.0 level OpenGL calls that are not already standard in both OpenGL ES 2.0 and desktop OpenGL. For more information about the OpenGL and - OpenGL ES APIs, refer to the official \l{OpenGL Registry} and - \l{Khronos OpenGL ES API Registry}. + OpenGL ES APIs, refer to the official \l{http://www.opengl.org/registry/}{OpenGL Registry} and + \l {http://www.khronos.org/registry/gles/}{Khronos OpenGL ES API Registry}. If animation has been enabled with OpenGLWindow::setAnimating(true), we call renderLater() to put another update request on the event loop. diff --git a/examples/gui/doc/rasterwindow.qdoc b/examples/gui/doc/src/rasterwindow.qdoc index 971b921d30..f246533c4f 100644 --- a/examples/gui/doc/rasterwindow.qdoc +++ b/examples/gui/doc/src/rasterwindow.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example gui/rasterwindow + \example rasterwindow \title Raster Window Example \brief This example shows how to create a minimal QWindow based diff --git a/examples/gui/openglwindow/openglwindow.pro b/examples/gui/openglwindow/openglwindow.pro index 6a664f9a96..93f18f3d3f 100644 --- a/examples/gui/openglwindow/openglwindow.pro +++ b/examples/gui/openglwindow/openglwindow.pro @@ -2,3 +2,6 @@ include(openglwindow.pri) SOURCES += \ main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/gui/openglwindow +INSTALLS += target diff --git a/examples/gui/rasterwindow/rasterwindow.pro b/examples/gui/rasterwindow/rasterwindow.pro index 0ea830b037..8ca4f7a89d 100644 --- a/examples/gui/rasterwindow/rasterwindow.pro +++ b/examples/gui/rasterwindow/rasterwindow.pro @@ -2,3 +2,6 @@ include(rasterwindow.pri) SOURCES += \ main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/gui/rasterwindow +INSTALLS += target diff --git a/examples/ipc/ipc.pro b/examples/ipc/ipc.pro index ba3990d869..ffa313beef 100644 --- a/examples/ipc/ipc.pro +++ b/examples/ipc/ipc.pro @@ -2,5 +2,3 @@ TEMPLATE = subdirs # no QSharedMemory !vxworks:!qnx:SUBDIRS = sharedmemory !wince*: SUBDIRS += localfortuneserver localfortuneclient - -QT += widgets diff --git a/examples/ipc/sharedmemory/sharedmemory.pro b/examples/ipc/sharedmemory/sharedmemory.pro index f6f2fc3c42..0d25a30b1b 100644 --- a/examples/ipc/sharedmemory/sharedmemory.pro +++ b/examples/ipc/sharedmemory/sharedmemory.pro @@ -1,3 +1,5 @@ +QT += widgets + SOURCES += main.cpp \ dialog.cpp @@ -12,6 +14,4 @@ EXAMPLE_FILES = *.png target.path = $$[QT_INSTALL_EXAMPLES]/ipc/sharedmemory INSTALLS += target -QT += widgets - simulator: warning(This example does not work on Simulator platform) diff --git a/examples/ja_JP/linguist/hellotr/hellotr.pro b/examples/ja_JP/linguist/hellotr/hellotr.pro deleted file mode 100644 index e4a1ee11bb..0000000000 --- a/examples/ja_JP/linguist/hellotr/hellotr.pro +++ /dev/null @@ -1,11 +0,0 @@ -#! [0] -SOURCES = main.cpp -#! [0] #! [1] -TRANSLATIONS = hellotr_ja.ts -#! [1] - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/linguist/hellotr -INSTALLS += target - -QT += widgets diff --git a/examples/ja_JP/linguist/hellotr/main.cpp b/examples/ja_JP/linguist/hellotr/main.cpp deleted file mode 100644 index df4546f4b5..0000000000 --- a/examples/ja_JP/linguist/hellotr/main.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Digia Plc and its Subsidiary(-ies) 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 <QApplication> -#include <QPushButton> -//! [0] -#include <QTranslator> -//! [0] - -//! [1] //! [2] -int main(int argc, char *argv[]) -//! [1] //! [3] //! [4] -{ - QApplication app(argc, argv); -//! [3] - -//! [5] - QTranslator translator; -//! [5] //! [6] - translator.load("hellotr_ja"); -//! [6] //! [7] - app.installTranslator(&translator); -//! [4] //! [7] - -//! [8] - QPushButton hello(QPushButton::tr("Hello world!")); -//! [8] - hello.resize(100, 30); - - hello.show(); - return app.exec(); -} -//! [2] diff --git a/examples/linguist/README b/examples/linguist/README deleted file mode 100644 index 15817742da..0000000000 --- a/examples/linguist/README +++ /dev/null @@ -1,6 +0,0 @@ -Internationalization is a core feature of Qt. These examples show how to -access translation and localization facilities at run-time. - - -Documentation for these examples can be found via the Examples -link in the main Qt documentation. diff --git a/examples/linguist/arrowpad/arrowpad.cpp b/examples/linguist/arrowpad/arrowpad.cpp deleted file mode 100644 index 7b33238295..0000000000 --- a/examples/linguist/arrowpad/arrowpad.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Digia Plc and its Subsidiary(-ies) 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 <QtWidgets> - -#include "arrowpad.h" - -ArrowPad::ArrowPad(QWidget *parent) - : QWidget(parent) -{ -//! [0] - upButton = new QPushButton(tr("&Up")); -//! [0] //! [1] - downButton = new QPushButton(tr("&Down")); -//! [1] //! [2] - leftButton = new QPushButton(tr("&Left")); -//! [2] //! [3] - rightButton = new QPushButton(tr("&Right")); -//! [3] - - QGridLayout *mainLayout = new QGridLayout; - mainLayout->addWidget(upButton, 0, 1); - mainLayout->addWidget(leftButton, 1, 0); - mainLayout->addWidget(rightButton, 1, 2); - mainLayout->addWidget(downButton, 2, 1); - setLayout(mainLayout); -} diff --git a/examples/linguist/arrowpad/arrowpad.h b/examples/linguist/arrowpad/arrowpad.h deleted file mode 100644 index 30ebf98e92..0000000000 --- a/examples/linguist/arrowpad/arrowpad.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Digia Plc and its Subsidiary(-ies) 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 ARROWPAD_H -#define ARROWPAD_H - -#include <QWidget> - -QT_BEGIN_NAMESPACE -class QPushButton; -QT_END_NAMESPACE - -//! [0] -class ArrowPad : public QWidget -//! [0] //! [1] -{ -//! [1] //! [2] - Q_OBJECT -//! [2] - -public: - ArrowPad(QWidget *parent = 0); - -private: - QPushButton *upButton; - QPushButton *downButton; - QPushButton *leftButton; - QPushButton *rightButton; -}; - -#endif diff --git a/examples/linguist/arrowpad/arrowpad.pro b/examples/linguist/arrowpad/arrowpad.pro deleted file mode 100644 index 3b5916684b..0000000000 --- a/examples/linguist/arrowpad/arrowpad.pro +++ /dev/null @@ -1,18 +0,0 @@ -#! [0] -HEADERS = arrowpad.h \ - mainwindow.h -SOURCES = arrowpad.cpp \ - main.cpp \ - mainwindow.cpp -#! [0] #! [1] -TRANSLATIONS = arrowpad_fr.ts \ - arrowpad_nl.ts -#! [1] - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/linguist/arrowpad -INSTALLS += target - -QT += widgets - -simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/linguist/arrowpad/main.cpp b/examples/linguist/arrowpad/main.cpp deleted file mode 100644 index c43b17556f..0000000000 --- a/examples/linguist/arrowpad/main.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Digia Plc and its Subsidiary(-ies) 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 <QtWidgets> - -#include "mainwindow.h" - -//! [0] -int main(int argc, char *argv[]) -//! [0] //! [1] -{ - QApplication app(argc, argv); - - QString locale = QLocale::system().name(); - -//! [2] - QTranslator translator; -//! [2] //! [3] - translator.load(QString("arrowpad_") + locale); - app.installTranslator(&translator); -//! [1] //! [3] - - MainWindow mainWindow; - mainWindow.show(); - return app.exec(); -} diff --git a/examples/linguist/arrowpad/mainwindow.cpp b/examples/linguist/arrowpad/mainwindow.cpp deleted file mode 100644 index 75a489e518..0000000000 --- a/examples/linguist/arrowpad/mainwindow.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Digia Plc and its Subsidiary(-ies) 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 <QtWidgets> - -#include "arrowpad.h" -#include "mainwindow.h" - -MainWindow::MainWindow() -{ -//! [0] - arrowPad = new ArrowPad; -//! [0] - setCentralWidget(arrowPad); - -//! [1] - exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcuts(QKeySequence::Quit); - connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); -//! [1] - - fileMenu = menuBar()->addMenu(tr("&File")); - fileMenu->addAction(exitAct); -} diff --git a/examples/linguist/arrowpad/mainwindow.h b/examples/linguist/arrowpad/mainwindow.h deleted file mode 100644 index 7ccac6ac59..0000000000 --- a/examples/linguist/arrowpad/mainwindow.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Digia Plc and its Subsidiary(-ies) 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 MAINWINDOW_H -#define MAINWINDOW_H - -#include <QMainWindow> - -QT_BEGIN_NAMESPACE -class QAction; -class QMenu; -QT_END_NAMESPACE -class ArrowPad; - -//! [0] -class MainWindow : public QMainWindow -//! [0] //! [1] -{ - Q_OBJECT -//! [1] - -public: - MainWindow(); - -private: - ArrowPad *arrowPad; - QMenu *fileMenu; - QAction *exitAct; -}; - -#endif diff --git a/examples/linguist/hellotr/hellotr.pro b/examples/linguist/hellotr/hellotr.pro deleted file mode 100644 index 38e5a5b366..0000000000 --- a/examples/linguist/hellotr/hellotr.pro +++ /dev/null @@ -1,13 +0,0 @@ -#! [0] -SOURCES = main.cpp -#! [0] #! [1] -TRANSLATIONS = hellotr_la.ts -#! [1] - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/linguist/hellotr -INSTALLS += target - -QT += widgets - -simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/linguist/hellotr/main.cpp b/examples/linguist/hellotr/main.cpp deleted file mode 100644 index 12433f8414..0000000000 --- a/examples/linguist/hellotr/main.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Digia Plc and its Subsidiary(-ies) 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 <QApplication> -#include <QPushButton> -//! [0] -#include <QTranslator> -//! [0] - -//! [1] //! [2] -int main(int argc, char *argv[]) -//! [1] //! [3] //! [4] -{ - QApplication app(argc, argv); -//! [3] - -//! [5] - QTranslator translator; -//! [5] //! [6] - translator.load("hellotr_la"); -//! [6] //! [7] - app.installTranslator(&translator); -//! [4] //! [7] - -//! [8] - QPushButton hello(QPushButton::tr("Hello world!")); -//! [8] - hello.resize(100, 30); - - hello.show(); - return app.exec(); -} -//! [2] diff --git a/examples/linguist/linguist.pro b/examples/linguist/linguist.pro deleted file mode 100644 index 6109ef0045..0000000000 --- a/examples/linguist/linguist.pro +++ /dev/null @@ -1,6 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = arrowpad \ - hellotr \ - trollprint - -QT += widgets diff --git a/examples/linguist/trollprint/main.cpp b/examples/linguist/trollprint/main.cpp deleted file mode 100644 index 9438d987b2..0000000000 --- a/examples/linguist/trollprint/main.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Digia Plc and its Subsidiary(-ies) 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 <QtWidgets> - -#include "mainwindow.h" - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - QString locale = QLocale::system().name(); - -//! [0] - QTranslator translator; - translator.load(QString("trollprint_") + locale); - app.installTranslator(&translator); -//! [0] - - MainWindow mainWindow; - mainWindow.show(); - return app.exec(); -} diff --git a/examples/linguist/trollprint/mainwindow.cpp b/examples/linguist/trollprint/mainwindow.cpp deleted file mode 100644 index d98aba6f3d..0000000000 --- a/examples/linguist/trollprint/mainwindow.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Digia Plc and its Subsidiary(-ies) 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 <QtWidgets> - -#include "mainwindow.h" -#include "printpanel.h" - -MainWindow::MainWindow() -{ - printPanel = new PrintPanel; - setCentralWidget(printPanel); - - createActions(); - createMenus(); - -//! [0] - setWindowTitle(tr("Troll Print 1.0")); -//! [0] -} - -void MainWindow::about() -{ - QMessageBox::information(this, tr("About Troll Print 1.0"), - tr("Troll Print 1.0.\n\n" - "Copyright 1999 Software, Inc.")); -} - -//! [1] -void MainWindow::createActions() -{ -//! [2] - exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q", "Quit")); -//! [2] - connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); - - aboutAct = new QAction(tr("&About"), this); - aboutAct->setShortcut(Qt::Key_F1); - connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); - - aboutQtAct = new QAction(tr("About &Qt"), this); - connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); -} - -void MainWindow::createMenus() -//! [1] //! [3] -{ - QMenu *fileMenu = menuBar()->addMenu(tr("&File")); - fileMenu->addAction(exitAct); - - menuBar()->addSeparator(); - - QMenu *helpMenu = menuBar()->addMenu(tr("&Help")); - helpMenu->addAction(aboutAct); - helpMenu->addAction(aboutQtAct); -} -//! [3] diff --git a/examples/linguist/trollprint/mainwindow.h b/examples/linguist/trollprint/mainwindow.h deleted file mode 100644 index d55d6fb897..0000000000 --- a/examples/linguist/trollprint/mainwindow.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Digia Plc and its Subsidiary(-ies) 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 MAINWINDOW_H -#define MAINWINDOW_H - -#include <QMainWindow> - -QT_BEGIN_NAMESPACE -class QAction; -class QMenu; -QT_END_NAMESPACE -class PrintPanel; - -class MainWindow : public QMainWindow -{ - Q_OBJECT - -public: - MainWindow(); - -private slots: - void about(); - -private: - void createActions(); - void createMenus(); - - PrintPanel *printPanel; - QMenu *fileMenu; - QMenu *helpMenu; - QAction *exitAct; - QAction *aboutAct; - QAction *aboutQtAct; -}; - -#endif diff --git a/examples/linguist/trollprint/printpanel.cpp b/examples/linguist/trollprint/printpanel.cpp deleted file mode 100644 index 163fc6de11..0000000000 --- a/examples/linguist/trollprint/printpanel.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Digia Plc and its Subsidiary(-ies) 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 <QtWidgets> - -#include "printpanel.h" - -//! [0] -PrintPanel::PrintPanel(QWidget *parent) - : QWidget(parent) -{ -/* - QLabel *label = new QLabel(tr("<b>TROLL PRINT</b>")); - label->setAlignment(Qt::AlignCenter); -*/ -//! [0] - -//! [1] - twoSidedGroupBox = new QGroupBox(tr("2-sided")); - twoSidedEnabledRadio = new QRadioButton(tr("Enabled")); - twoSidedDisabledRadio = new QRadioButton(tr("Disabled")); -//! [1] //! [2] - twoSidedDisabledRadio->setChecked(true); - - colorsGroupBox = new QGroupBox(tr("Colors")); - colorsEnabledRadio = new QRadioButton(tr("Enabled")); - colorsDisabledRadio = new QRadioButton(tr("Disabled")); -//! [2] - colorsDisabledRadio->setChecked(true); - - QHBoxLayout *twoSidedLayout = new QHBoxLayout; - twoSidedLayout->addWidget(twoSidedEnabledRadio); - twoSidedLayout->addWidget(twoSidedDisabledRadio); - twoSidedGroupBox->setLayout(twoSidedLayout); - - QHBoxLayout *colorsLayout = new QHBoxLayout; - colorsLayout->addWidget(colorsEnabledRadio); - colorsLayout->addWidget(colorsDisabledRadio); - colorsGroupBox->setLayout(colorsLayout); - - QVBoxLayout *mainLayout = new QVBoxLayout; -/* - mainLayout->addWidget(label); -*/ - mainLayout->addWidget(twoSidedGroupBox); - mainLayout->addWidget(colorsGroupBox); - setLayout(mainLayout); -} diff --git a/examples/linguist/trollprint/printpanel.h b/examples/linguist/trollprint/printpanel.h deleted file mode 100644 index a773a29700..0000000000 --- a/examples/linguist/trollprint/printpanel.h +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Digia Plc and its Subsidiary(-ies) 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 PRINTPANEL_H -#define PRINTPANEL_H - -#include <QWidget> - -QT_BEGIN_NAMESPACE -class QGroupBox; -class QRadioButton; -QT_END_NAMESPACE - -//! [0] -class PrintPanel : public QWidget -{ - Q_OBJECT -//! [0] - -public: - PrintPanel(QWidget *parent = 0); - -private: - QGroupBox *twoSidedGroupBox; - QGroupBox *colorsGroupBox; - QRadioButton *twoSidedEnabledRadio; - QRadioButton *twoSidedDisabledRadio; - QRadioButton *colorsEnabledRadio; - QRadioButton *colorsDisabledRadio; -}; - -#endif diff --git a/examples/linguist/trollprint/trollprint.pro b/examples/linguist/trollprint/trollprint.pro deleted file mode 100644 index f4f60c41cf..0000000000 --- a/examples/linguist/trollprint/trollprint.pro +++ /dev/null @@ -1,14 +0,0 @@ -HEADERS = mainwindow.h \ - printpanel.h -SOURCES = main.cpp \ - mainwindow.cpp \ - printpanel.cpp -TRANSLATIONS = trollprint_pt.ts - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/linguist/trollprint -INSTALLS += target - -QT += widgets - -simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/linguist/trollprint/trollprint_pt.ts b/examples/linguist/trollprint/trollprint_pt.ts deleted file mode 100644 index e5871bd087..0000000000 --- a/examples/linguist/trollprint/trollprint_pt.ts +++ /dev/null @@ -1,65 +0,0 @@ -<!DOCTYPE TS><TS> -<context> - <name>MainWindow</name> - <message> - <source>Troll Print 1.0</source> - <translation>Troll Imprimir 1.0</translation> - </message> - <message> - <source>E&xit</source> - <translation>&Sair</translation> - </message> - <message> - <source>&About</source> - <translation>&Sobre</translation> - </message> - <message> - <source>About &Qt</source> - <translation>Sobre &Qt</translation> - </message> - <message> - <source>&File</source> - <translation>&Arquivo</translation> - </message> - <message> - <source>&Help</source> - <translation>A&juda</translation> - </message> - <message> - <source>About Troll Print 1.0</source> - <translation>Sobre Troll Imprimir 1.0</translation> - </message> - <message> - <source>Troll Print 1.0. - -Copyright 1999 Software, Inc.</source> - <translation>Troll Imprimir 1.0 - -Copyright 1999 Software, Inc.</translation> - </message> - <message> - <source>Ctrl+Q</source> - <comment>Quit</comment> - <translation>Ctrl+Q</translation> - </message> -</context> -<context> - <name>PrintPanel</name> - <message> - <source>2-sided</source> - <translation>2-lados</translation> - </message> - <message> - <source>Enabled</source> - <translation>Ativado</translation> - </message> - <message> - <source>Disabled</source> - <translation>Desativado</translation> - </message> - <message> - <source>Colors</source> - <translation>Cores</translation> - </message> -</context> -</TS> diff --git a/examples/network/blockingfortuneclient/blockingfortuneclient.pro b/examples/network/blockingfortuneclient/blockingfortuneclient.pro index bcf5346d35..2bd1f78c14 100644 --- a/examples/network/blockingfortuneclient/blockingfortuneclient.pro +++ b/examples/network/blockingfortuneclient/blockingfortuneclient.pro @@ -1,11 +1,10 @@ -QT += widgets +QT += network widgets HEADERS = blockingclient.h \ fortunethread.h SOURCES = blockingclient.cpp \ main.cpp \ fortunethread.cpp -QT += network # install target.path = $$[QT_INSTALL_EXAMPLES]/network/blockingfortuneclient diff --git a/examples/network/broadcastreceiver/broadcastreceiver.pro b/examples/network/broadcastreceiver/broadcastreceiver.pro index e1708f36da..edadf1c28d 100644 --- a/examples/network/broadcastreceiver/broadcastreceiver.pro +++ b/examples/network/broadcastreceiver/broadcastreceiver.pro @@ -1,9 +1,8 @@ -QT += widgets +QT += network widgets HEADERS = receiver.h SOURCES = receiver.cpp \ main.cpp -QT += network # install target.path = $$[QT_INSTALL_EXAMPLES]/network/broadcastreceiver diff --git a/examples/network/broadcastsender/broadcastsender.pro b/examples/network/broadcastsender/broadcastsender.pro index 611b617471..4c5af7f849 100644 --- a/examples/network/broadcastsender/broadcastsender.pro +++ b/examples/network/broadcastsender/broadcastsender.pro @@ -1,9 +1,8 @@ -QT += widgets +QT += network widgets HEADERS = sender.h SOURCES = sender.cpp \ main.cpp -QT += network # install target.path = $$[QT_INSTALL_EXAMPLES]/network/broadcastsender diff --git a/examples/network/doc/src/blockingfortuneclient.qdoc b/examples/network/doc/src/blockingfortuneclient.qdoc index 581cbe6699..c16fd60248 100644 --- a/examples/network/doc/src/blockingfortuneclient.qdoc +++ b/examples/network/doc/src/blockingfortuneclient.qdoc @@ -28,9 +28,8 @@ /*! \example blockingfortuneclient \title Blocking Fortune Client Example - - \brief The Blocking Fortune Client example shows how to create a client for a - network service using QTcpSocket's synchronous API in a non-GUI thread. + \ingroup examples-network + \brief Demonstrates how to create a client for a network service \image blockingfortuneclient-example.png diff --git a/examples/network/doc/src/broadcastreceiver.qdoc b/examples/network/doc/src/broadcastreceiver.qdoc index 99a4cd3823..2ab3c6be67 100644 --- a/examples/network/doc/src/broadcastreceiver.qdoc +++ b/examples/network/doc/src/broadcastreceiver.qdoc @@ -28,9 +28,11 @@ /*! \example broadcastreceiver \title Broadcast Receiver Example + \ingroup examples-network + \brief Demonstrates how to receive information broadcasted over a local network. - \brief The Broadcast Receiver example shows how to receive information that is broadcasted - over a local network. + This example uses the Qt Network APIs to demonstrate how to receive + messages broadcasted over a local network. \image broadcastreceiver-example.png */ diff --git a/examples/network/doc/src/broadcastsender.qdoc b/examples/network/doc/src/broadcastsender.qdoc index dc916e3fed..a9aa1f96d8 100644 --- a/examples/network/doc/src/broadcastsender.qdoc +++ b/examples/network/doc/src/broadcastsender.qdoc @@ -28,9 +28,11 @@ /*! \example broadcastsender \title Broadcast Sender Example + \ingroup examples-network + \brief Demonstrates how to broadcast information to multiple clients on a local network. - \brief The Broadcast Sender example shows how to broadcast information to multiple clients - on a local network. + This example uses Qt Network APIs to demonstrate how to broadcast messages + to multiple clients over a local network. \image broadcastsender-example.png */ diff --git a/examples/network/doc/src/fortuneclient.qdoc b/examples/network/doc/src/fortuneclient.qdoc index 6ef9155337..1d69415f3c 100644 --- a/examples/network/doc/src/fortuneclient.qdoc +++ b/examples/network/doc/src/fortuneclient.qdoc @@ -28,9 +28,10 @@ /*! \example fortuneclient \title Fortune Client Example + \ingroup examples-network + \brief Demonstrates how to create a client for a network service - \brief The Fortune Client example shows how to create a client for a simple - network service using QTcpSocket. It is intended to be run alongside the + This example uses QTcpSocket, and is intended to be run alongside the \l{fortuneserver}{Fortune Server} example or the \l{threadedfortuneserver}{Threaded Fortune Server} example. diff --git a/examples/network/doc/src/fortuneserver.qdoc b/examples/network/doc/src/fortuneserver.qdoc index 05e96b4ded..ca04d80ade 100644 --- a/examples/network/doc/src/fortuneserver.qdoc +++ b/examples/network/doc/src/fortuneserver.qdoc @@ -28,15 +28,16 @@ /*! \example fortuneserver \title Fortune Server Example + \ingroup examples-network + \brief Demonstrates how to create a server for a network service. - \brief The Fortune Server example shows how to create a server for a simple - network service. It is intended to be run alongside the + This example is intended to be run alongside the \l{fortuneclient}{Fortune Client} example or the \l{blockingfortuneclient}{Blocking Fortune Client} example. \image fortuneserver-example.png Screenshot of the Fortune Server example - This example uses QTcpServer to accept incoming TCP connections, and a + It uses QTcpServer to accept incoming TCP connections, and a simple QDataStream based data transfer protocol to write a fortune to the connecting client (from the \l{fortuneclient}{Fortune Client} example), before closing the connection. @@ -55,7 +56,7 @@ \snippet fortuneserver/server.cpp 2 - Our server generates a list of random fortunes that is can send to + Our server generates a list of random fortunes that it can send to connecting clients. \snippet fortuneserver/server.cpp 3 diff --git a/examples/network/doc/src/googlesuggest.qdoc b/examples/network/doc/src/googlesuggest.qdoc index ff16cbf9e0..b53c394d76 100644 --- a/examples/network/doc/src/googlesuggest.qdoc +++ b/examples/network/doc/src/googlesuggest.qdoc @@ -28,10 +28,11 @@ /*! \example googlesuggest \title Google Suggest Example + \ingroup examples-network + \brief Obtains the list of search recommendations by the Google search engine - \brief The Google Suggest example demonstrates how to use the QNetworkAccessManager - class to obtain a list of suggestions from the Google search engine as the - user types into a QLineEdit. + The example uses the QNetworkAccessManager to obtain the list of search + recommendations by Google as the user types into a QLineEdit. \image googlesuggest-example.png diff --git a/examples/network/doc/src/http.qdoc b/examples/network/doc/src/http.qdoc index 67bdbdb558..62cfffd603 100644 --- a/examples/network/doc/src/http.qdoc +++ b/examples/network/doc/src/http.qdoc @@ -28,9 +28,11 @@ /*! \example http \title HTTP Example + \ingroup examples-network + \brief Demonstrates a simple HTTP client - \brief The HTTP example demonstrates a simple HTTP client that shows how to fetch files - specified by URLs from remote hosts. + This example demonstrates how a simple HTTP client can fetch files + from remote hosts. \image http-example.png */ diff --git a/examples/network/doc/src/loopback.qdoc b/examples/network/doc/src/loopback.qdoc index 52518a0028..6d74a187fd 100644 --- a/examples/network/doc/src/loopback.qdoc +++ b/examples/network/doc/src/loopback.qdoc @@ -28,9 +28,11 @@ /*! \example loopback \title Loopback Example + \ingroup examples-network + \brief Demonstrates the client-server communication on a local host - \brief The Loopback example shows how to communicate between simple clients and servers on a local - host. + The example demonstrates how the clients and servers on a local host + communicate with each other. \image loopback-example.png */ diff --git a/examples/network/doc/src/multicastreceiver.qdoc b/examples/network/doc/src/multicastreceiver.qdoc index fddbafe788..62174f5d4d 100644 --- a/examples/network/doc/src/multicastreceiver.qdoc +++ b/examples/network/doc/src/multicastreceiver.qdoc @@ -28,9 +28,9 @@ /*! \example multicastreceiver \title Multicast Receiver Example + \ingroup examples-network + \brief Demonstrates how to receive information sent to a multicast group - \brief The Multicast Receiever example shows how to receive information that is - sent to a multicast group. - + This example demonstrates how to receive messages sent to a multicast group \image multicastreceiver-example.png */ diff --git a/examples/network/doc/src/multicastsender.qdoc b/examples/network/doc/src/multicastsender.qdoc index 8d8a400769..c4b93ea0a6 100644 --- a/examples/network/doc/src/multicastsender.qdoc +++ b/examples/network/doc/src/multicastsender.qdoc @@ -28,9 +28,11 @@ /*! \example multicastsender \title Multicast Sender Example + \ingroup examples-network + \brief Demonstrates how to send messages to a multicast group - \brief The Multicast Sender example shows how to send information to multiple - clients in a multicast group. + This example demonstrates how to send messages to the clients of a + multicast group. \image multicastsender-example.png */ diff --git a/examples/network/doc/src/network-chat.qdoc b/examples/network/doc/src/network-chat.qdoc index 0430b5219d..b95a13098f 100644 --- a/examples/network/doc/src/network-chat.qdoc +++ b/examples/network/doc/src/network-chat.qdoc @@ -28,10 +28,11 @@ /*! \example network-chat \title Network Chat Example + \ingroup examples-network + \brief Demonstrates a stateful peer-to-peer Chat client - \brief The Network Chat example demonstrates a stateful peer-to-peer Chat client - that uses broadcasting with QUdpSocket and QNetworkInterface to discover - its peers. + This example uses broadcasting with QUdpSocket and QNetworkInterface to + discover its peers. \image network-chat-example.png */ diff --git a/examples/network/doc/src/network-download.qdoc b/examples/network/doc/src/network-download.qdoc new file mode 100644 index 0000000000..1144361fb5 --- /dev/null +++ b/examples/network/doc/src/network-download.qdoc @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example network/download + \title Network Download Example + \brief Demonstrates how to use networking APIs for multiple downloads + \ingroup examples-network + + The Network Download example shows how to perform multiple downloads in + parallel using the QNetworkAccessManager class. + + This example is designed to be run from the command-line. + + The \l{Network Download Manager Example} implements a more complex system + that places files in a queue for sequential downloading. +*/ diff --git a/examples/network/doc/src/network-downloadmanager.qdoc b/examples/network/doc/src/network-downloadmanager.qdoc new file mode 100644 index 0000000000..9722996d30 --- /dev/null +++ b/examples/network/doc/src/network-downloadmanager.qdoc @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example network/downloadmanager + \title Network Download Manager Example + \brief Demonstrates how to use the networking APIs for multiple downloads + \ingroup examples-network + + The Network Download example shows how to implement a queue for multiple + downloads using the QNetworkAccessManager class. + + This example is designed to be run from the command-line. + + See the \l{Network Download Example} for a simpler version of this example + that obtains multiple files in parallel. +*/ diff --git a/examples/network/doc/src/securesocketclient.qdoc b/examples/network/doc/src/securesocketclient.qdoc index 16986292af..e025b51931 100644 --- a/examples/network/doc/src/securesocketclient.qdoc +++ b/examples/network/doc/src/securesocketclient.qdoc @@ -28,11 +28,12 @@ /*! \example securesocketclient \title Secure Socket Client Example + \ingroup examples-network + \brief Demonstrates how to communicate over an encrypted (SSL) connection - \brief The Secure Socket Client example shows how to use QSslSocket to - communicate over an encrypted (SSL) connection. It also demonstrates how - to deal with authenticity problems, and how to display security and - certificate information. + This example uses QSslSocket to demonstrate how to communicate over an + encrypted connection, deal with authenticity problems, and display security + and certificate information. \image securesocketclient.png \image securesocketclient2.png diff --git a/examples/network/doc/src/threadedfortuneserver.qdoc b/examples/network/doc/src/threadedfortuneserver.qdoc index f8441bcc2f..43a7e88241 100644 --- a/examples/network/doc/src/threadedfortuneserver.qdoc +++ b/examples/network/doc/src/threadedfortuneserver.qdoc @@ -28,6 +28,7 @@ /*! \example threadedfortuneserver \title Threaded Fortune Server Example + \ingroup examples-network \brief The Threaded Fortune Server example shows how to create a server for a simple network service that uses threads to handle requests from different diff --git a/examples/network/doc/src/torrent.qdoc b/examples/network/doc/src/torrent.qdoc index ef13ef6ed9..4bd70eed97 100644 --- a/examples/network/doc/src/torrent.qdoc +++ b/examples/network/doc/src/torrent.qdoc @@ -28,16 +28,18 @@ /*! \example torrent \title Torrent Example + \ingroup examples-network + \brief Demonstrates complex TCP/IP operations - \brief The Torrent example is a functional BitTorrent client that - illustrates how to write a complex TCP/IP application using Qt. + This example demonstrates some of the complex TCP/IP operations + supported by the Qt Network APIs. \image torrent-example.png \section1 License Information The implementation of the US Secure Hash Algorithm 1 (SHA1) in this example is - derived from the original description in \l{RFC 3174}. + derived from the original description in \l{http://www.rfc-editor.org/rfc/rfc3174.txt}{RFC 3174}. \legalese Copyright (C) The Internet Society (2001). All Rights Reserved. diff --git a/examples/network/fortuneclient/fortuneclient.pro b/examples/network/fortuneclient/fortuneclient.pro index b921941da3..8b376d9c53 100644 --- a/examples/network/fortuneclient/fortuneclient.pro +++ b/examples/network/fortuneclient/fortuneclient.pro @@ -1,9 +1,8 @@ -QT += widgets +QT += network widgets HEADERS = client.h SOURCES = client.cpp \ main.cpp -QT += network # install target.path = $$[QT_INSTALL_EXAMPLES]/network/fortuneclient diff --git a/examples/network/fortuneserver/fortuneserver.pro b/examples/network/fortuneserver/fortuneserver.pro index cfcf680f81..8c8ad3f0d3 100644 --- a/examples/network/fortuneserver/fortuneserver.pro +++ b/examples/network/fortuneserver/fortuneserver.pro @@ -1,9 +1,8 @@ -QT += widgets +QT += network widgets HEADERS = server.h SOURCES = server.cpp \ main.cpp -QT += network # install target.path = $$[QT_INSTALL_EXAMPLES]/network/fortuneserver diff --git a/examples/network/http/http.pro b/examples/network/http/http.pro index 1543584cf5..2f2d3b00ae 100644 --- a/examples/network/http/http.pro +++ b/examples/network/http/http.pro @@ -1,10 +1,9 @@ -QT += widgets +QT += network widgets HEADERS += httpwindow.h SOURCES += httpwindow.cpp \ main.cpp FORMS += authenticationdialog.ui -QT += network # install target.path = $$[QT_INSTALL_EXAMPLES]/network/http diff --git a/examples/network/loopback/loopback.pro b/examples/network/loopback/loopback.pro index c7b8d060b8..14b22daa57 100644 --- a/examples/network/loopback/loopback.pro +++ b/examples/network/loopback/loopback.pro @@ -1,9 +1,8 @@ -QT += widgets +QT += network widgets HEADERS = dialog.h SOURCES = dialog.cpp \ main.cpp -QT += network # install target.path = $$[QT_INSTALL_EXAMPLES]/network/loopback diff --git a/examples/network/multicastreceiver/multicastreceiver.pro b/examples/network/multicastreceiver/multicastreceiver.pro index bbba25a626..6906fc6cb5 100644 --- a/examples/network/multicastreceiver/multicastreceiver.pro +++ b/examples/network/multicastreceiver/multicastreceiver.pro @@ -1,9 +1,8 @@ -QT += widgets +QT += network widgets HEADERS = receiver.h SOURCES = receiver.cpp \ main.cpp -QT += network # install target.path = $$[QT_INSTALL_EXAMPLES]/network/multicastreceiver diff --git a/examples/network/network.pro b/examples/network/network.pro index f473a112f6..342297528b 100644 --- a/examples/network/network.pro +++ b/examples/network/network.pro @@ -4,7 +4,7 @@ SUBDIRS = \ download \ downloadmanager -!contains(QT_CONFIG, no-widgets) { +qtHaveModule(widgets) { SUBDIRS += \ blockingfortuneclient \ broadcastreceiver \ diff --git a/examples/network/threadedfortuneserver/threadedfortuneserver.pro b/examples/network/threadedfortuneserver/threadedfortuneserver.pro index cb6be41d33..2538701b94 100644 --- a/examples/network/threadedfortuneserver/threadedfortuneserver.pro +++ b/examples/network/threadedfortuneserver/threadedfortuneserver.pro @@ -1,4 +1,4 @@ -QT += widgets +QT += network widgets HEADERS = dialog.h \ fortuneserver.h \ @@ -7,7 +7,6 @@ SOURCES = dialog.cpp \ fortuneserver.cpp \ fortunethread.cpp \ main.cpp -QT += network # install target.path = $$[QT_INSTALL_EXAMPLES]/network/threadedfortuneserver diff --git a/examples/network/torrent/mainwindow.cpp b/examples/network/torrent/mainwindow.cpp index 1b10241f6e..b574429808 100644 --- a/examples/network/torrent/mainwindow.cpp +++ b/examples/network/torrent/mainwindow.cpp @@ -52,12 +52,14 @@ class TorrentView : public QTreeWidget public: TorrentView(QWidget *parent = 0); +#ifndef QT_NO_DRAGANDDROP signals: void fileDropped(const QString &fileName); protected: void dragMoveEvent(QDragMoveEvent *event); void dropEvent(QDropEvent *event); +#endif }; // TorrentViewDelegate is used to draw the progress bars. @@ -688,9 +690,12 @@ void MainWindow::closeEvent(QCloseEvent *) TorrentView::TorrentView(QWidget *parent) : QTreeWidget(parent) { +#ifndef QT_NO_DRAGANDDROP setAcceptDrops(true); +#endif } +#ifndef QT_NO_DRAGANDDROP void TorrentView::dragMoveEvent(QDragMoveEvent *event) { // Accept file actions with a '.torrent' extension. @@ -708,5 +713,6 @@ void TorrentView::dropEvent(QDropEvent *event) if (QFile::exists(fileName) && fileName.toLower().endsWith(".torrent")) emit fileDropped(fileName); } +#endif #include "mainwindow.moc" diff --git a/examples/network/torrent/torrent.pro b/examples/network/torrent/torrent.pro index a080ec07e2..76887ae649 100644 --- a/examples/network/torrent/torrent.pro +++ b/examples/network/torrent/torrent.pro @@ -1,4 +1,4 @@ -QT += widgets +QT += network widgets HEADERS += addtorrentdialog.h \ bencodeparser.h \ @@ -29,8 +29,6 @@ SOURCES += main.cpp \ FORMS += forms/addtorrentform.ui RESOURCES += icons.qrc -QT += network - # install target.path = $$[QT_INSTALL_EXAMPLES]/network/torrent INSTALLS += target diff --git a/examples/opengl/2dpainting/glwidget.cpp b/examples/opengl/2dpainting/glwidget.cpp index 23065a0b42..e1e40ea84c 100644 --- a/examples/opengl/2dpainting/glwidget.cpp +++ b/examples/opengl/2dpainting/glwidget.cpp @@ -38,10 +38,11 @@ ** ****************************************************************************/ -#include <QtWidgets> #include "glwidget.h" #include "helper.h" +#include <QTimer> + //! [0] GLWidget::GLWidget(Helper *helper, QWidget *parent) : QGLWidget(QGLFormat(QGL::SampleBuffers), parent), helper(helper) diff --git a/examples/opengl/2dpainting/glwidget.h b/examples/opengl/2dpainting/glwidget.h index f8e44f8a3e..3540810983 100644 --- a/examples/opengl/2dpainting/glwidget.h +++ b/examples/opengl/2dpainting/glwidget.h @@ -45,10 +45,6 @@ //! [0] class Helper; -QT_BEGIN_NAMESPACE -class QPaintEvent; -class QWidget; -QT_END_NAMESPACE class GLWidget : public QGLWidget { diff --git a/examples/opengl/2dpainting/helper.cpp b/examples/opengl/2dpainting/helper.cpp index b412dc11dc..168df2aff3 100644 --- a/examples/opengl/2dpainting/helper.cpp +++ b/examples/opengl/2dpainting/helper.cpp @@ -38,9 +38,12 @@ ** ****************************************************************************/ -#include <QtWidgets> #include "helper.h" +#include <QPainter> +#include <QPaintEvent> +#include <QWidget> + //! [0] Helper::Helper() { @@ -70,14 +73,15 @@ void Helper::paint(QPainter *painter, QPaintEvent *event, int elapsed) painter->setPen(circlePen); painter->rotate(elapsed * 0.030); - qreal r = elapsed/1000.0; + qreal r = elapsed / 1000.0; int n = 30; for (int i = 0; i < n; ++i) { painter->rotate(30); - qreal radius = 0 + 120.0*((i+r)/n); - qreal circleRadius = 1 + ((i+r)/n)*20; + qreal factor = (i + r) / n; + qreal radius = 0 + 120.0 * factor; + qreal circleRadius = 1 + factor * 20; painter->drawEllipse(QRectF(radius, -circleRadius, - circleRadius*2, circleRadius*2)); + circleRadius * 2, circleRadius * 2)); } painter->restore(); //! [2] @@ -85,6 +89,6 @@ void Helper::paint(QPainter *painter, QPaintEvent *event, int elapsed) //! [3] painter->setPen(textPen); painter->setFont(textFont); - painter->drawText(QRect(-50, -50, 100, 100), Qt::AlignCenter, "Qt"); + painter->drawText(QRect(-50, -50, 100, 100), Qt::AlignCenter, QStringLiteral("Qt")); } //! [3] diff --git a/examples/opengl/2dpainting/helper.h b/examples/opengl/2dpainting/helper.h index 10bb2a5a9c..47f4c96639 100644 --- a/examples/opengl/2dpainting/helper.h +++ b/examples/opengl/2dpainting/helper.h @@ -44,11 +44,7 @@ #include <QBrush> #include <QFont> #include <QPen> - -QT_BEGIN_NAMESPACE -class QPainter; -class QPaintEvent; -QT_END_NAMESPACE +#include <QWidget> //! [0] class Helper diff --git a/examples/opengl/2dpainting/main.cpp b/examples/opengl/2dpainting/main.cpp index 3374e57964..903795685f 100644 --- a/examples/opengl/2dpainting/main.cpp +++ b/examples/opengl/2dpainting/main.cpp @@ -38,9 +38,10 @@ ** ****************************************************************************/ -#include <QApplication> #include "window.h" +#include <QApplication> + int main(int argc, char *argv[]) { QApplication app(argc, argv); diff --git a/examples/opengl/2dpainting/widget.cpp b/examples/opengl/2dpainting/widget.cpp index 49ce8b1329..832f37eb36 100644 --- a/examples/opengl/2dpainting/widget.cpp +++ b/examples/opengl/2dpainting/widget.cpp @@ -38,10 +38,11 @@ ** ****************************************************************************/ -#include <QtWidgets> #include "widget.h" #include "helper.h" +#include <QPainter> +#include <QTimer> //! [0] Widget::Widget(Helper *helper, QWidget *parent) diff --git a/examples/opengl/2dpainting/widget.h b/examples/opengl/2dpainting/widget.h index 7d665b3952..ccf424330c 100644 --- a/examples/opengl/2dpainting/widget.h +++ b/examples/opengl/2dpainting/widget.h @@ -45,9 +45,6 @@ //! [0] class Helper; -QT_BEGIN_NAMESPACE -class QPaintEvent; -QT_END_NAMESPACE class Widget : public QWidget { diff --git a/examples/opengl/2dpainting/window.cpp b/examples/opengl/2dpainting/window.cpp index 700d0caaa8..b6aba2a945 100644 --- a/examples/opengl/2dpainting/window.cpp +++ b/examples/opengl/2dpainting/window.cpp @@ -38,15 +38,19 @@ ** ****************************************************************************/ -#include <QtWidgets> #include "glwidget.h" #include "widget.h" #include "window.h" +#include <QGridLayout> +#include <QLabel> +#include <QTimer> + //! [0] Window::Window() - : QWidget() { + setWindowTitle(tr("2D Painting on Native and OpenGL Widgets")); + Widget *native = new Widget(&helper, this); GLWidget *openGL = new GLWidget(&helper, this); QLabel *nativeLabel = new QLabel(tr("Native")); @@ -65,7 +69,5 @@ Window::Window() connect(timer, SIGNAL(timeout()), native, SLOT(animate())); connect(timer, SIGNAL(timeout()), openGL, SLOT(animate())); timer->start(50); - - setWindowTitle(tr("2D Painting on Native and OpenGL Widgets")); } //! [0] diff --git a/examples/opengl/2dpainting/window.h b/examples/opengl/2dpainting/window.h index 263572637e..acded9895f 100644 --- a/examples/opengl/2dpainting/window.h +++ b/examples/opengl/2dpainting/window.h @@ -41,14 +41,9 @@ #ifndef WINDOW_H #define WINDOW_H -#include <QWidget> - #include "helper.h" -QT_BEGIN_NAMESPACE -class QLabel; -class QWidget; -QT_END_NAMESPACE +#include <QWidget> //! [0] class Window : public QWidget diff --git a/examples/opengl/cube/cube.pro b/examples/opengl/cube/cube.pro index aaa933c1e2..710b4442c7 100644 --- a/examples/opengl/cube/cube.pro +++ b/examples/opengl/cube/cube.pro @@ -5,7 +5,7 @@ TEMPLATE = app SOURCES += main.cpp -contains(QT_CONFIG, opengl) { +qtHaveModule(opengl) { QT += opengl SOURCES += mainwidget.cpp \ diff --git a/examples/opengl/cube/geometryengine.cpp b/examples/opengl/cube/geometryengine.cpp index d8dfeab822..277a6e9cfc 100644 --- a/examples/opengl/cube/geometryengine.cpp +++ b/examples/opengl/cube/geometryengine.cpp @@ -49,14 +49,13 @@ struct VertexData QVector2D texCoord; }; -GeometryEngine::GeometryEngine() : vboIds(new GLuint[2]) +GeometryEngine::GeometryEngine() { } GeometryEngine::~GeometryEngine() { glDeleteBuffers(2, vboIds); - delete[] vboIds; } void GeometryEngine::init() diff --git a/examples/opengl/cube/geometryengine.h b/examples/opengl/cube/geometryengine.h index 2716b05c2b..6a15c3ce03 100644 --- a/examples/opengl/cube/geometryengine.h +++ b/examples/opengl/cube/geometryengine.h @@ -41,8 +41,8 @@ #ifndef GEOMETRYENGINE_H #define GEOMETRYENGINE_H -#include <QtOpenGL/QGLFunctions> -#include <QtOpenGL/QGLShaderProgram> +#include <QGLFunctions> +#include <QGLShaderProgram> class GeometryEngine : protected QGLFunctions { @@ -51,14 +51,12 @@ public: virtual ~GeometryEngine(); void init(); - void drawCubeGeometry(QGLShaderProgram *program); private: void initCubeGeometry(); - GLuint *vboIds; - + GLuint vboIds[2]; }; #endif // GEOMETRYENGINE_H diff --git a/examples/opengl/cube/main.cpp b/examples/opengl/cube/main.cpp index fbc1d93e4a..fdae1caa16 100644 --- a/examples/opengl/cube/main.cpp +++ b/examples/opengl/cube/main.cpp @@ -47,16 +47,15 @@ int main(int argc, char *argv[]) { - QApplication a(argc, argv); - a.setApplicationName("cube"); - a.setApplicationVersion("0.1"); -#ifndef QT_NO_OPENGL - MainWidget w; - w.resize(640, 480); - w.show(); + QApplication app(argc, argv); + app.setApplicationName("cube"); + app.setApplicationVersion("0.1"); +#ifdef QT_NO_OPENGL + MainWidget widget; + widget.show(); #else - QLabel * notifyLabel = new QLabel("OpenGL Support required"); - notifyLabel->show(); + QLabel note("OpenGL Support required"); + note.show(); #endif - return a.exec(); + return app.exec(); } diff --git a/examples/opengl/cube/mainwidget.cpp b/examples/opengl/cube/mainwidget.cpp index 055dcf49cf..4a42eca159 100644 --- a/examples/opengl/cube/mainwidget.cpp +++ b/examples/opengl/cube/mainwidget.cpp @@ -40,39 +40,26 @@ #include "mainwidget.h" -#include "geometryengine.h" - -#include <QtOpenGL/QGLShaderProgram> - -#include <QBasicTimer> #include <QMouseEvent> -#include <QDebug> #include <math.h> #include <locale.h> MainWidget::MainWidget(QWidget *parent) : QGLWidget(parent), - timer(new QBasicTimer), - program(new QGLShaderProgram), - geometries(new GeometryEngine), angularSpeed(0) { } MainWidget::~MainWidget() { - delete timer; timer = 0; - delete program; program = 0; - delete geometries; geometries = 0; - deleteTexture(texture); } //! [0] void MainWidget::mousePressEvent(QMouseEvent *e) { - // Saving mouse press position + // Save mouse press position mousePressPosition = QVector2D(e->localPos()); } @@ -97,17 +84,15 @@ void MainWidget::mouseReleaseEvent(QMouseEvent *e) //! [0] //! [1] -void MainWidget::timerEvent(QTimerEvent *e) +void MainWidget::timerEvent(QTimerEvent *) { - Q_UNUSED(e); - // Decrease angular speed (friction) angularSpeed *= 0.99; // Stop rotation when speed goes below threshold - if (angularSpeed < 0.01) + if (angularSpeed < 0.01) { angularSpeed = 0.0; - else { + } else { // Update rotation rotation = QQuaternion::fromAxisAndAngle(rotationAxis, angularSpeed) * rotation; @@ -120,13 +105,8 @@ void MainWidget::timerEvent(QTimerEvent *e) void MainWidget::initializeGL() { initializeGLFunctions(); - qglClearColor(Qt::black); - - qDebug() << "Initializing shaders..."; initShaders(); - - qDebug() << "Initializing textures..."; initTextures(); //! [2] @@ -137,33 +117,32 @@ void MainWidget::initializeGL() glEnable(GL_CULL_FACE); //! [2] - qDebug() << "Initializing geometries..."; - geometries->init(); + geometries.init(); - // using QBasicTimer because its faster that QTimer - timer->start(12, this); + // Use QBasicTimer because its faster than QTimer + timer.start(12, this); } //! [3] void MainWidget::initShaders() { - // Overriding system locale until shaders are compiled + // Override system locale until shaders are compiled setlocale(LC_NUMERIC, "C"); - // Compiling vertex shader - if (!program->addShaderFromSourceFile(QGLShader::Vertex, ":/vshader.glsl")) + // Compile vertex shader + if (!program.addShaderFromSourceFile(QGLShader::Vertex, ":/vshader.glsl")) close(); - // Compiling fragment shader - if (!program->addShaderFromSourceFile(QGLShader::Fragment, ":/fshader.glsl")) + // Compile fragment shader + if (!program.addShaderFromSourceFile(QGLShader::Fragment, ":/fshader.glsl")) close(); - // Linking shader pipeline - if (!program->link()) + // Link shader pipeline + if (!program.link()) close(); - // Binding shader pipeline for use - if (!program->bind()) + // Bind shader pipeline for use + if (!program.bind()) close(); // Restore system locale @@ -174,7 +153,7 @@ void MainWidget::initShaders() //! [4] void MainWidget::initTextures() { - // Loading cube.png + // Load cube.png image glEnable(GL_TEXTURE_2D); texture = bindTexture(QImage(":/cube.png")); @@ -198,7 +177,7 @@ void MainWidget::resizeGL(int w, int h) glViewport(0, 0, w, h); // Calculate aspect ratio - qreal aspect = (qreal)w / ((qreal)h?h:1); + qreal aspect = qreal(w) / qreal(h ? h : 1); // Set near plane to 3.0, far plane to 7.0, field of view 45 degrees const qreal zNear = 3.0, zFar = 7.0, fov = 45.0; @@ -223,12 +202,12 @@ void MainWidget::paintGL() matrix.rotate(rotation); // Set modelview-projection matrix - program->setUniformValue("mvp_matrix", projection * matrix); + program.setUniformValue("mvp_matrix", projection * matrix); //! [6] - // Using texture unit 0 which contains cube.png - program->setUniformValue("texture", 0); + // Use texture unit 0 which contains cube.png + program.setUniformValue("texture", 0); // Draw cube geometry - geometries->drawCubeGeometry(program); + geometries.drawCubeGeometry(&program); } diff --git a/examples/opengl/cube/mainwidget.h b/examples/opengl/cube/mainwidget.h index bd30ea93a0..cebfb30999 100644 --- a/examples/opengl/cube/mainwidget.h +++ b/examples/opengl/cube/mainwidget.h @@ -41,30 +41,26 @@ #ifndef MAINWIDGET_H #define MAINWIDGET_H -#include <QtOpenGL/QGLWidget> -#include <QtOpenGL/QGLFunctions> +#include "geometryengine.h" +#include <QGLWidget> +#include <QGLFunctions> #include <QMatrix4x4> #include <QQuaternion> #include <QVector2D> +#include <QBasicTimer> +#include <QGLShaderProgram> -QT_BEGIN_NAMESPACE -class QBasicTimer; -class QGLShaderProgram; -QT_END_NAMESPACE class GeometryEngine; class MainWidget : public QGLWidget, protected QGLFunctions { Q_OBJECT + public: explicit MainWidget(QWidget *parent = 0); - virtual ~MainWidget(); - -signals: - -public slots: + ~MainWidget(); protected: void mousePressEvent(QMouseEvent *e); @@ -79,9 +75,9 @@ protected: void initTextures(); private: - QBasicTimer *timer; - QGLShaderProgram *program; - GeometryEngine *geometries; + QBasicTimer timer; + QGLShaderProgram program; + GeometryEngine geometries; GLuint texture; diff --git a/examples/opengl/framebufferobject2/framebufferobject2.pro b/examples/opengl/framebufferobject2/framebufferobject2.pro index d26751ab0e..3a0dbb4446 100644 --- a/examples/opengl/framebufferobject2/framebufferobject2.pro +++ b/examples/opengl/framebufferobject2/framebufferobject2.pro @@ -10,3 +10,9 @@ INSTALLS += target simulator: warning(This example might not fully work on Simulator platform) + +contains(QT_CONFIG, opengles.) { + contains(QT_CONFIG, angle): \ + warning("Qt was built with ANGLE, which provides only OpenGL ES 2.0 on top of DirectX 9.0c") + error("This example requires Qt to be configured with -opengl desktop") +} diff --git a/examples/opengl/grabber/glwidget.cpp b/examples/opengl/grabber/glwidget.cpp index 6d8ef0049f..00964c1a0f 100644 --- a/examples/opengl/grabber/glwidget.cpp +++ b/examples/opengl/grabber/glwidget.cpp @@ -38,12 +38,12 @@ ** ****************************************************************************/ -#include <QtWidgets> -#include <QtOpenGL> +#include "glwidget.h" -#include <math.h> +#include <QMouseEvent> +#include <QTimer> -#include "glwidget.h" +#include <math.h> GLWidget::GLWidget(QWidget *parent) : QGLWidget(parent) @@ -191,57 +191,52 @@ GLuint GLWidget::makeGear(const GLfloat *reflectance, GLdouble innerRadius, GLdouble r2 = outerRadius + toothSize / 2.0; GLdouble delta = (2.0 * Pi / toothCount) / 4.0; GLdouble z = thickness / 2.0; - int i, j; glShadeModel(GL_FLAT); - for (i = 0; i < 2; ++i) { + for (int i = 0; i < 2; ++i) { GLdouble sign = (i == 0) ? +1.0 : -1.0; glNormal3d(0.0, 0.0, sign); glBegin(GL_QUAD_STRIP); - for (j = 0; j <= toothCount; ++j) { + for (int j = 0; j <= toothCount; ++j) { GLdouble angle = 2.0 * Pi * j / toothCount; - glVertex3d(r0 * cos(angle), r0 * sin(angle), sign * z); - glVertex3d(r1 * cos(angle), r1 * sin(angle), sign * z); - glVertex3d(r0 * cos(angle), r0 * sin(angle), sign * z); - glVertex3d(r1 * cos(angle + 3 * delta), r1 * sin(angle + 3 * delta), - sign * z); + glVertex3d(r0 * cos(angle), r0 * sin(angle), sign * z); + glVertex3d(r1 * cos(angle), r1 * sin(angle), sign * z); + glVertex3d(r0 * cos(angle), r0 * sin(angle), sign * z); + glVertex3d(r1 * cos(angle + 3 * delta), r1 * sin(angle + 3 * delta), sign * z); } glEnd(); glBegin(GL_QUADS); - for (j = 0; j < toothCount; ++j) { + for (int j = 0; j < toothCount; ++j) { GLdouble angle = 2.0 * Pi * j / toothCount; - glVertex3d(r1 * cos(angle), r1 * sin(angle), sign * z); - glVertex3d(r2 * cos(angle + delta), r2 * sin(angle + delta), - sign * z); - glVertex3d(r2 * cos(angle + 2 * delta), r2 * sin(angle + 2 * delta), - sign * z); - glVertex3d(r1 * cos(angle + 3 * delta), r1 * sin(angle + 3 * delta), - sign * z); + glVertex3d(r1 * cos(angle), r1 * sin(angle), sign * z); + glVertex3d(r2 * cos(angle + delta), r2 * sin(angle + delta), sign * z); + glVertex3d(r2 * cos(angle + 2 * delta), r2 * sin(angle + 2 * delta), sign * z); + glVertex3d(r1 * cos(angle + 3 * delta), r1 * sin(angle + 3 * delta), sign * z); } glEnd(); } glBegin(GL_QUAD_STRIP); - for (i = 0; i < toothCount; ++i) { - for (j = 0; j < 2; ++j) { - GLdouble angle = 2.0 * Pi * (i + (j / 2.0)) / toothCount; + for (int i = 0; i < toothCount; ++i) { + for (int j = 0; j < 2; ++j) { + GLdouble angle = 2.0 * Pi * (i + j / 2.0) / toothCount; GLdouble s1 = r1; GLdouble s2 = r2; if (j == 1) qSwap(s1, s2); - glNormal3d(cos(angle), sin(angle), 0.0); - glVertex3d(s1 * cos(angle), s1 * sin(angle), +z); - glVertex3d(s1 * cos(angle), s1 * sin(angle), -z); + glNormal3d(cos(angle), sin(angle), 0.0); + glVertex3d(s1 * cos(angle), s1 * sin(angle), +z); + glVertex3d(s1 * cos(angle), s1 * sin(angle), -z); - glNormal3d(s2 * sin(angle + delta) - s1 * sin(angle), + glNormal3d(s2 * sin(angle + delta) - s1 * sin(angle), s1 * cos(angle) - s2 * cos(angle + delta), 0.0); - glVertex3d(s2 * cos(angle + delta), s2 * sin(angle + delta), +z); - glVertex3d(s2 * cos(angle + delta), s2 * sin(angle + delta), -z); + glVertex3d(s2 * cos(angle + delta), s2 * sin(angle + delta), +z); + glVertex3d(s2 * cos(angle + delta), s2 * sin(angle + delta), -z); } } glVertex3d(r1, 0.0, +z); @@ -251,11 +246,11 @@ GLuint GLWidget::makeGear(const GLfloat *reflectance, GLdouble innerRadius, glShadeModel(GL_SMOOTH); glBegin(GL_QUAD_STRIP); - for (i = 0; i <= toothCount; ++i) { - GLdouble angle = i * 2.0 * Pi / toothCount; - glNormal3d(-cos(angle), -sin(angle), 0.0); - glVertex3d(r0 * cos(angle), r0 * sin(angle), +z); - glVertex3d(r0 * cos(angle), r0 * sin(angle), -z); + for (int i = 0; i <= toothCount; ++i) { + GLdouble angle = i * 2.0 * Pi / toothCount; + glNormal3d(-cos(angle), -sin(angle), 0.0); + glVertex3d(r0 * cos(angle), r0 * sin(angle), +z); + glVertex3d(r0 * cos(angle), r0 * sin(angle), -z); } glEnd(); diff --git a/examples/opengl/grabber/glwidget.h b/examples/opengl/grabber/glwidget.h index 88a97ac8b0..6f48102111 100644 --- a/examples/opengl/grabber/glwidget.h +++ b/examples/opengl/grabber/glwidget.h @@ -94,4 +94,4 @@ private: QPoint lastPos; }; -#endif +#endif // GLWIDGET_H diff --git a/examples/opengl/grabber/grabber.pro b/examples/opengl/grabber/grabber.pro index a60dbbe2dc..c4c54c7c32 100644 --- a/examples/opengl/grabber/grabber.pro +++ b/examples/opengl/grabber/grabber.pro @@ -11,3 +11,9 @@ INSTALLS += target simulator: warning(This example might not fully work on Simulator platform) + +contains(QT_CONFIG, opengles.) { + contains(QT_CONFIG, angle): \ + warning("Qt was built with ANGLE, which provides only OpenGL ES 2.0 on top of DirectX 9.0c") + error("This example requires Qt to be configured with -opengl desktop") +} diff --git a/examples/opengl/grabber/main.cpp b/examples/opengl/grabber/main.cpp index f03543e449..be0e7b11cc 100644 --- a/examples/opengl/grabber/main.cpp +++ b/examples/opengl/grabber/main.cpp @@ -38,14 +38,14 @@ ** ****************************************************************************/ -#include <QApplication> - #include "mainwindow.h" +#include <QApplication> + int main(int argc, char *argv[]) { QApplication app(argc, argv); - MainWindow mainWin; - mainWin.show(); + MainWindow window; + window.show(); return app.exec(); } diff --git a/examples/opengl/grabber/mainwindow.cpp b/examples/opengl/grabber/mainwindow.cpp index a559649c55..e521b39dab 100644 --- a/examples/opengl/grabber/mainwindow.cpp +++ b/examples/opengl/grabber/mainwindow.cpp @@ -38,12 +38,11 @@ ** ****************************************************************************/ -#include <QtWidgets> -#include <QtOpenGL> - #include "glwidget.h" #include "mainwindow.h" +#include <QtWidgets> + MainWindow::MainWindow() { centralWidget = new QWidget; diff --git a/examples/opengl/grabber/mainwindow.h b/examples/opengl/grabber/mainwindow.h index 6f981c5381..552f902c07 100644 --- a/examples/opengl/grabber/mainwindow.h +++ b/examples/opengl/grabber/mainwindow.h @@ -44,12 +44,12 @@ #include <QMainWindow> QT_BEGIN_NAMESPACE -class QAction; class QLabel; class QMenu; class QScrollArea; class QSlider; QT_END_NAMESPACE + class GLWidget; class MainWindow : public QMainWindow @@ -91,4 +91,4 @@ private: QAction *aboutQtAct; }; -#endif +#endif // MAINWINDOW_H diff --git a/examples/opengl/hellogl/hellogl.pro b/examples/opengl/hellogl/hellogl.pro index acaca35635..42913835a2 100644 --- a/examples/opengl/hellogl/hellogl.pro +++ b/examples/opengl/hellogl/hellogl.pro @@ -16,3 +16,9 @@ INSTALLS += target simulator: warning(This example might not fully work on Simulator platform) + +contains(QT_CONFIG, opengles.) { + contains(QT_CONFIG, angle): \ + warning("Qt was built with ANGLE, which provides only OpenGL ES 2.0 on top of DirectX 9.0c") + error("This example requires Qt to be configured with -opengl desktop") +} diff --git a/examples/opengl/hellogl_es2/bubble.h b/examples/opengl/hellogl_es2/bubble.h index cd4c8d91cc..b913d3620d 100644 --- a/examples/opengl/hellogl_es2/bubble.h +++ b/examples/opengl/hellogl_es2/bubble.h @@ -47,7 +47,7 @@ #include <QRect> #include <QRectF> -class QPainter; +QT_FORWARD_DECLARE_CLASS(QPainter) class Bubble { diff --git a/examples/opengl/hellogl_es2/mainwindow.h b/examples/opengl/hellogl_es2/mainwindow.h index 7e16a6b6a7..4aac220692 100644 --- a/examples/opengl/hellogl_es2/mainwindow.h +++ b/examples/opengl/hellogl_es2/mainwindow.h @@ -43,9 +43,6 @@ #include <QMainWindow> -class QSlider; -class GLWidget; - class MainWindow : public QMainWindow { Q_OBJECT diff --git a/examples/opengl/hellowindow/hellowindow.cpp b/examples/opengl/hellowindow/hellowindow.cpp index b5166abe50..b1140c4f1d 100644 --- a/examples/opengl/hellowindow/hellowindow.cpp +++ b/examples/opengl/hellowindow/hellowindow.cpp @@ -41,9 +41,6 @@ #include "hellowindow.h" #include <QOpenGLContext> - -#include <QTimer> - #include <qmath.h> Renderer::Renderer(const QSurfaceFormat &format, Renderer *share, QScreen *screen) @@ -77,10 +74,8 @@ HelloWindow::HelloWindow(const QSharedPointer<Renderer> &renderer) updateColor(); } -void HelloWindow::exposeEvent(QExposeEvent *event) +void HelloWindow::exposeEvent(QExposeEvent *) { - Q_UNUSED(event); - render(); if (!m_timer) { @@ -109,10 +104,7 @@ void HelloWindow::updateColor() }; m_color = colors[m_colorIndex]; - - m_colorIndex++; - if (m_colorIndex >= int(sizeof(colors) / sizeof(colors[0]))) - m_colorIndex = 0; + m_colorIndex = 1 - m_colorIndex; } void Renderer::render(QSurface *surface, const QColor &color, const QSize &viewSize) @@ -171,31 +163,29 @@ void Renderer::initialize() glClearColor(0.1f, 0.1f, 0.2f, 1.0f); QOpenGLShader *vshader = new QOpenGLShader(QOpenGLShader::Vertex, this); - const char *vsrc = - "attribute highp vec4 vertex;\n" - "attribute mediump vec3 normal;\n" - "uniform mediump mat4 matrix;\n" - "uniform lowp vec4 sourceColor;\n" - "varying mediump vec4 color;\n" - "void main(void)\n" - "{\n" - " vec3 toLight = normalize(vec3(0.0, 0.3, 1.0));\n" - " float angle = max(dot(normal, toLight), 0.0);\n" - " vec3 col = sourceColor.rgb;\n" - " color = vec4(col * 0.2 + col * 0.8 * angle, 1.0);\n" - " color = clamp(color, 0.0, 1.0);\n" - " gl_Position = matrix * vertex;\n" - "}\n"; - vshader->compileSourceCode(vsrc); + vshader->compileSourceCode( + "attribute highp vec4 vertex;" + "attribute mediump vec3 normal;" + "uniform mediump mat4 matrix;" + "uniform lowp vec4 sourceColor;" + "varying mediump vec4 color;" + "void main(void)" + "{" + " vec3 toLight = normalize(vec3(0.0, 0.3, 1.0));" + " float angle = max(dot(normal, toLight), 0.0);" + " vec3 col = sourceColor.rgb;" + " color = vec4(col * 0.2 + col * 0.8 * angle, 1.0);" + " color = clamp(color, 0.0, 1.0);" + " gl_Position = matrix * vertex;" + "}"); QOpenGLShader *fshader = new QOpenGLShader(QOpenGLShader::Fragment, this); - const char *fsrc = - "varying mediump vec4 color;\n" - "void main(void)\n" - "{\n" - " gl_FragColor = color;\n" - "}\n"; - fshader->compileSourceCode(fsrc); + fshader->compileSourceCode( + "varying mediump vec4 color;" + "void main(void)" + "{" + " gl_FragColor = color;" + "}"); m_program = new QOpenGLShaderProgram(this); m_program->addShader(vshader); diff --git a/examples/opengl/hellowindow/hellowindow.h b/examples/opengl/hellowindow/hellowindow.h index adb85c1a6e..27cae4be7d 100644 --- a/examples/opengl/hellowindow/hellowindow.h +++ b/examples/opengl/hellowindow/hellowindow.h @@ -40,21 +40,15 @@ #include <QWindow> -#include <QtGui/qopengl.h> -#include <QtGui/qopenglshaderprogram.h> - #include <QColor> -#include <QTime> +#include <QOpenGLShaderProgram> #include <QSharedPointer> - -QT_BEGIN_NAMESPACE -class QOpenGLContext; -class QTimer; -QT_END_NAMESPACE +#include <QTimer> class Renderer : public QObject { Q_OBJECT + public: explicit Renderer(const QSurfaceFormat &format, Renderer *share = 0, QScreen *screen = 0); @@ -89,6 +83,7 @@ private: class HelloWindow : public QWindow { Q_OBJECT + public: explicit HelloWindow(const QSharedPointer<Renderer> &renderer); diff --git a/examples/opengl/hellowindow/main.cpp b/examples/opengl/hellowindow/main.cpp index 343160f755..e63b27d093 100644 --- a/examples/opengl/hellowindow/main.cpp +++ b/examples/opengl/hellowindow/main.cpp @@ -38,21 +38,22 @@ ** ****************************************************************************/ -#include <QGuiApplication> +#include "hellowindow.h" + #include <qpa/qplatformintegration.h> #include <private/qguiapplication_p.h> + +#include <QGuiApplication> #include <QScreen> #include <QThread> -#include "hellowindow.h" - -int main(int argc, char **argv) +int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); const bool multipleWindows = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedOpenGL) - && !QGuiApplication::arguments().contains(QLatin1String("--single")); + && !QGuiApplication::arguments().contains(QStringLiteral("--single")); QScreen *screen = QGuiApplication::primaryScreen(); @@ -71,7 +72,7 @@ int main(int argc, char **argv) HelloWindow *windowA = new HelloWindow(rendererA); windowA->setGeometry(QRect(center, windowSize).translated(-windowSize.width() - delta / 2, 0)); - windowA->setTitle(QLatin1String("Thread A - Context A")); + windowA->setTitle(QStringLiteral("Thread A - Context A")); windowA->setVisible(true); windows.prepend(windowA); @@ -85,13 +86,13 @@ int main(int argc, char **argv) HelloWindow *windowB = new HelloWindow(rendererA); windowB->setGeometry(QRect(center, windowSize).translated(delta / 2, 0)); - windowB->setTitle(QLatin1String("Thread A - Context A")); + windowB->setTitle(QStringLiteral("Thread A - Context A")); windowB->setVisible(true); windows.prepend(windowB); HelloWindow *windowC = new HelloWindow(rendererB); windowC->setGeometry(QRect(center, windowSize).translated(-windowSize.width() / 2, windowSize.height() + delta)); - windowC->setTitle(QLatin1String("Thread B - Context B")); + windowC->setTitle(QStringLiteral("Thread B - Context B")); windowC->setVisible(true); windows.prepend(windowC); @@ -113,7 +114,7 @@ int main(int argc, char **argv) window->setGeometry(QRect(center, windowSize).translated(-windowSize.width() / 2, -windowSize.height() / 2)); QChar id = QChar('B' + i); - window->setTitle(QLatin1String("Thread ") + id + QLatin1String(" - Context ") + id); + window->setTitle(QStringLiteral("Thread ") + id + QStringLiteral(" - Context ") + id); window->setVisible(true); windows.prepend(window); } @@ -128,6 +129,7 @@ int main(int argc, char **argv) for (int i = 0; i < renderThreads.size(); ++i) renderThreads.at(i)->wait(); + qDeleteAll(windows); qDeleteAll(renderThreads); diff --git a/examples/opengl/opengl.pro b/examples/opengl/opengl.pro index 1a6ac3aeb2..25c337fdad 100644 --- a/examples/opengl/opengl.pro +++ b/examples/opengl/opengl.pro @@ -26,5 +26,3 @@ SUBDIRS += hellowindow \ paintedwindow EXAMPLE_FILES = shared - -QT += widgets diff --git a/examples/opengl/overpainting/bubble.cpp b/examples/opengl/overpainting/bubble.cpp index 5f0e9710ea..0b3e3b8778 100644 --- a/examples/opengl/overpainting/bubble.cpp +++ b/examples/opengl/overpainting/bubble.cpp @@ -38,8 +38,6 @@ ** ****************************************************************************/ -#include <QtWidgets> - #include "bubble.h" Bubble::Bubble(const QPointF &position, qreal radius, const QPointF &velocity) diff --git a/examples/opengl/overpainting/bubble.h b/examples/opengl/overpainting/bubble.h index 2a3d27480b..42dedc6e8f 100644 --- a/examples/opengl/overpainting/bubble.h +++ b/examples/opengl/overpainting/bubble.h @@ -41,15 +41,7 @@ #ifndef BUBBLE_H #define BUBBLE_H -#include <QBrush> -#include <QColor> -#include <QPointF> -#include <QRect> -#include <QRectF> - -QT_BEGIN_NAMESPACE -class QPainter; -QT_END_NAMESPACE +#include <QPainter> class Bubble { @@ -72,4 +64,4 @@ private: QColor outerColor; }; -#endif +#endif // BUBBLE_H diff --git a/examples/opengl/overpainting/glwidget.cpp b/examples/opengl/overpainting/glwidget.cpp index df546a125b..ea29325b6c 100644 --- a/examples/opengl/overpainting/glwidget.cpp +++ b/examples/opengl/overpainting/glwidget.cpp @@ -38,16 +38,16 @@ ** ****************************************************************************/ -#include <QtWidgets> -#include <QtOpenGL> -#include <stdlib.h> - -#include <math.h> - #include "bubble.h" #include "qtlogo.h" #include "glwidget.h" +#include <QMouseEvent> +#include <QTime> + +#include <math.h> +#include <stdlib.h> + #ifndef GL_MULTISAMPLE #define GL_MULTISAMPLE 0x809D #endif diff --git a/examples/opengl/overpainting/glwidget.h b/examples/opengl/overpainting/glwidget.h index ce2b29d7f3..497d5e1ac4 100644 --- a/examples/opengl/overpainting/glwidget.h +++ b/examples/opengl/overpainting/glwidget.h @@ -41,19 +41,11 @@ #ifndef GLWIDGET_H #define GLWIDGET_H -#include <QBrush> -#include <QFont> -#include <QImage> -#include <QPen> #include <QGLWidget> #include <QTimer> class Bubble; class QtLogo; -QT_BEGIN_NAMESPACE -class QPaintEvent; -class QWidget; -QT_END_NAMESPACE //! [0] class GLWidget : public QGLWidget @@ -108,4 +100,4 @@ private: //! [4] }; -#endif +#endif // GLWIDGET_H diff --git a/examples/opengl/overpainting/main.cpp b/examples/opengl/overpainting/main.cpp index c4758956ba..2d40a7f76b 100644 --- a/examples/opengl/overpainting/main.cpp +++ b/examples/opengl/overpainting/main.cpp @@ -38,9 +38,10 @@ ** ****************************************************************************/ -#include <QApplication> #include "glwidget.h" +#include <QApplication> + int main(int argc, char *argv[]) { QApplication app(argc, argv); diff --git a/examples/opengl/overpainting/overpainting.pro b/examples/opengl/overpainting/overpainting.pro index 08fe9b3dae..aecc14751b 100644 --- a/examples/opengl/overpainting/overpainting.pro +++ b/examples/opengl/overpainting/overpainting.pro @@ -1,10 +1,12 @@ +QT += opengl widgets + VPATH += ../shared INCLUDEPATH += ../shared -QT += opengl widgets HEADERS = bubble.h \ glwidget.h \ qtlogo.h + SOURCES = bubble.cpp \ glwidget.cpp \ main.cpp \ @@ -15,3 +17,9 @@ target.path = $$[QT_INSTALL_EXAMPLES]/opengl/overpainting INSTALLS += target simulator: warning(This example might not fully work on Simulator platform) + +contains(QT_CONFIG, opengles.) { + contains(QT_CONFIG, angle): \ + warning("Qt was built with ANGLE, which provides only OpenGL ES 2.0 on top of DirectX 9.0c") + error("This example requires Qt to be configured with -opengl desktop") +} diff --git a/examples/opengl/paintedwindow/paintedwindow.cpp b/examples/opengl/paintedwindow/paintedwindow.cpp index 0920e6e89d..3aa21a04b6 100644 --- a/examples/opengl/paintedwindow/paintedwindow.cpp +++ b/examples/opengl/paintedwindow/paintedwindow.cpp @@ -70,12 +70,10 @@ PaintedWindow::PaintedWindow() m_animation->setEndValue(qreal(1)); m_animation->setDuration(500); - requestOrientation(Qt::PortraitOrientation); - QRect screenGeometry = screen()->availableGeometry(); QPoint center = screenGeometry.center(); - QRect windowRect = screen()->isLandscape(orientation()) ? QRect(0, 0, 640, 480) : QRect(0, 0, 480, 640); + QRect windowRect = screen()->isLandscape(screen()->orientation()) ? QRect(0, 0, 640, 480) : QRect(0, 0, 480, 640); setGeometry(QRect(center - windowRect.center(), windowRect.size())); m_rotation = 0; @@ -142,13 +140,13 @@ void PaintedWindow::orientationChanged(Qt::ScreenOrientation newOrientation) QPainter p; p.begin(&m_prevImage); - p.setTransform(screen()->transformBetween(contentOrientation(), orientation(), rect)); - paint(&p, screen()->mapBetween(contentOrientation(), orientation(), rect)); + p.setTransform(screen()->transformBetween(contentOrientation(), screen()->orientation(), rect)); + paint(&p, screen()->mapBetween(contentOrientation(), screen()->orientation(), rect)); p.end(); p.begin(&m_nextImage); - p.setTransform(screen()->transformBetween(newOrientation, orientation(), rect)); - paint(&p, screen()->mapBetween(newOrientation, orientation(), rect)); + p.setTransform(screen()->transformBetween(newOrientation, screen()->orientation(), rect)); + paint(&p, screen()->mapBetween(newOrientation, screen()->orientation(), rect)); p.end(); m_deltaRotation = screen()->angleBetween(newOrientation, contentOrientation()); @@ -207,9 +205,9 @@ void PaintedWindow::paint() painter.setOpacity(m_rotation); painter.drawImage(0, 0, m_nextImage); } else { - QRect mapped = screen()->mapBetween(contentOrientation(), orientation(), rect); + QRect mapped = screen()->mapBetween(contentOrientation(), screen()->orientation(), rect); - painter.setTransform(screen()->transformBetween(contentOrientation(), orientation(), rect)); + painter.setTransform(screen()->transformBetween(contentOrientation(), screen()->orientation(), rect)); paint(&painter, mapped); painter.end(); } diff --git a/examples/opengl/pbuffers/pbuffers.pro b/examples/opengl/pbuffers/pbuffers.pro index 1a9882c45d..57bb3aa32a 100644 --- a/examples/opengl/pbuffers/pbuffers.pro +++ b/examples/opengl/pbuffers/pbuffers.pro @@ -11,3 +11,9 @@ target.path = $$[QT_INSTALL_EXAMPLES]/opengl/pbuffers INSTALLS += target simulator: warning(This example might not fully work on Simulator platform) + +contains(QT_CONFIG, opengles.) { + contains(QT_CONFIG, angle): \ + warning("Qt was built with ANGLE, which provides only OpenGL ES 2.0 on top of DirectX 9.0c") + error("This example requires Qt to be configured with -opengl desktop") +} diff --git a/examples/opengl/pbuffers2/pbuffers2.pro b/examples/opengl/pbuffers2/pbuffers2.pro index 31fd22cced..c53309d1fa 100644 --- a/examples/opengl/pbuffers2/pbuffers2.pro +++ b/examples/opengl/pbuffers2/pbuffers2.pro @@ -9,3 +9,9 @@ target.path = $$[QT_INSTALL_EXAMPLES]/opengl/pbuffers2 INSTALLS += target simulator: warning(This example might not fully work on Simulator platform) + +contains(QT_CONFIG, opengles.) { + contains(QT_CONFIG, angle): \ + warning("Qt was built with ANGLE, which provides only OpenGL ES 2.0 on top of DirectX 9.0c") + error("This example requires Qt to be configured with -opengl desktop") +} diff --git a/examples/opengl/samplebuffers/samplebuffers.pro b/examples/opengl/samplebuffers/samplebuffers.pro index 5793ea3e68..d16993adfe 100644 --- a/examples/opengl/samplebuffers/samplebuffers.pro +++ b/examples/opengl/samplebuffers/samplebuffers.pro @@ -9,3 +9,9 @@ INSTALLS += target simulator: warning(This example might not fully work on Simulator platform) + +contains(QT_CONFIG, opengles.) { + contains(QT_CONFIG, angle): \ + warning("Qt was built with ANGLE, which provides only OpenGL ES 2.0 on top of DirectX 9.0c") + error("This example requires Qt to be configured with -opengl desktop") +} diff --git a/examples/opengl/shared/qtlogo.cpp b/examples/opengl/shared/qtlogo.cpp index fa3d91c840..e49ed7e67c 100644 --- a/examples/opengl/shared/qtlogo.cpp +++ b/examples/opengl/shared/qtlogo.cpp @@ -38,14 +38,14 @@ ** ****************************************************************************/ +#include "qtlogo.h" + #include <QGLWidget> #include <QMatrix4x4> #include <QVector3D> #include <qmath.h> -#include "qtlogo.h" - static const qreal tee_height = 0.311126; static const qreal cross_width = 0.25; static const qreal bar_thickness = 0.113137; @@ -117,7 +117,7 @@ void Geometry::finalize() void Geometry::appendSmooth(const QVector3D &a, const QVector3D &n, int from) { - // Smooth normals are acheived by averaging the normals for faces meeting + // Smooth normals are achieved by averaging the normals for faces meeting // at a point. First find the point in geometry already generated // (working backwards, since most often the points shared are between faces // recently added). @@ -125,28 +125,27 @@ void Geometry::appendSmooth(const QVector3D &a, const QVector3D &n, int from) for ( ; v >= from; --v) if (qFuzzyCompare(vertices[v], a)) break; - if (v < from) - { - // The vert was not found so add it as a new one, and initialize + + if (v < from) { + // The vertex was not found so add it as a new one, and initialize // its corresponding normal v = vertices.count(); vertices.append(a); normals.append(n); - } - else - { + } else { // Vert found, accumulate normals into corresponding normal slot. // Must call finalize once finished accumulating normals normals[v] += n; } - // In both cases (found or not) reference the vert via its index + + // In both cases (found or not) reference the vertex via its index faces.append(v); } void Geometry::appendFaceted(const QVector3D &a, const QVector3D &n) { - // Faceted normals are achieved by duplicating the vert for every - // normal, so that faces meeting at a vert get a sharp edge. + // Faceted normals are achieved by duplicating the vertex for every + // normal, so that faces meeting at a vertex get a sharp edge. int v = vertices.count(); vertices.append(a); normals.append(n); @@ -189,32 +188,29 @@ void Patch::draw() const void Patch::addTri(const QVector3D &a, const QVector3D &b, const QVector3D &c, const QVector3D &n) { QVector3D norm = n.isNull() ? QVector3D::normal(a, b, c) : n; - if (sm == Smooth) - { + + if (sm == Smooth) { geom->appendSmooth(a, norm, initv); geom->appendSmooth(b, norm, initv); geom->appendSmooth(c, norm, initv); - } - else - { + } else { geom->appendFaceted(a, norm); geom->appendFaceted(b, norm); geom->appendFaceted(c, norm); } + count += 3; } void Patch::addQuad(const QVector3D &a, const QVector3D &b, const QVector3D &c, const QVector3D &d) { QVector3D norm = QVector3D::normal(a, b, c); - if (sm == Smooth) - { + + if (sm == Smooth) { addTri(a, b, c, norm); addTri(a, c, d, norm); - } - else - { - // If faceted share the two common verts + } else { + // If faceted share the two common vertices addTri(a, b, c, norm); int k = geom->vertices.count(); geom->appendSmooth(a, norm, k); @@ -224,9 +220,9 @@ void Patch::addQuad(const QVector3D &a, const QVector3D &b, const QVector3D &c, } } -static inline QVector<QVector3D> extrude(const QVector<QVector3D> &verts, qreal depth) +static inline QVector<QVector3D> extrude(const QVector<QVector3D> &vertices, qreal depth) { - QVector<QVector3D> extr = verts; + QVector<QVector3D> extr = vertices; for (int v = 0; v < extr.count(); ++v) extr[v].setZ(extr[v].z() - depth); return extr; @@ -240,6 +236,7 @@ public: for (int i = 0; i < parts.count(); ++i) parts[i]->translate(t); } + void rotate(qreal deg, QVector3D axis) { for (int i = 0; i < parts.count(); ++i) @@ -248,7 +245,7 @@ public: // No special Rectoid destructor - the parts are fetched out of this member // variable, and destroyed by the new owner - QList<Patch*> parts; + QList<Patch *> parts; }; class RectPrism : public Rectoid diff --git a/examples/opengl/textures/glwidget.h b/examples/opengl/textures/glwidget.h index 11a9818e19..757a7df627 100644 --- a/examples/opengl/textures/glwidget.h +++ b/examples/opengl/textures/glwidget.h @@ -44,7 +44,7 @@ #include <QtWidgets> #include <QGLWidget> -class QGLShaderProgram; +QT_FORWARD_DECLARE_CLASS(QGLShaderProgram); class GLWidget : public QGLWidget { diff --git a/examples/qmake/precompile/precompile.pro b/examples/qmake/precompile/precompile.pro index b51677023a..6a23d82c32 100644 --- a/examples/qmake/precompile/precompile.pro +++ b/examples/qmake/precompile/precompile.pro @@ -8,6 +8,7 @@ TEMPLATE = app LANGUAGE = C++ CONFIG += console precompile_header CONFIG -= app_bundle +QT += widgets # Use Precompiled headers (PCH) PRECOMPILED_HEADER = stable.h @@ -21,4 +22,3 @@ SOURCES = main.cpp \ util.cpp FORMS = mydialog.ui #! [0] -QT += widgets diff --git a/examples/qtconcurrent/imagescaling/doc/images/imagescaling_example.png b/examples/qtconcurrent/imagescaling/doc/images/imagescaling_example.png Binary files differnew file mode 100644 index 0000000000..7c6794132a --- /dev/null +++ b/examples/qtconcurrent/imagescaling/doc/images/imagescaling_example.png diff --git a/examples/qtconcurrent/imagescaling/doc/src/qtconcurrent-imagescaling.qdoc b/examples/qtconcurrent/imagescaling/doc/src/qtconcurrent-imagescaling.qdoc new file mode 100644 index 0000000000..c270bda102 --- /dev/null +++ b/examples/qtconcurrent/imagescaling/doc/src/qtconcurrent-imagescaling.qdoc @@ -0,0 +1,37 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example qtconcurrent/imagescaling + \title Image Scaling Example + \brief Demonstrates how to asynchronously scale images. + \ingroup qtconcurrentexamples + \image imagescaling_example.png + + The QtConcurrent Map example shows how to use the asynchronous + QtConcurrent API to load and scale a collection of images. +*/ diff --git a/examples/qtconcurrent/map/doc/src/qtconcurrent-map.qdoc b/examples/qtconcurrent/map/doc/src/qtconcurrent-map.qdoc new file mode 100644 index 0000000000..7522baf2c4 --- /dev/null +++ b/examples/qtconcurrent/map/doc/src/qtconcurrent-map.qdoc @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example qtconcurrent/map + \title Map Example + \brief Demonstrates how to scale images synchronously. + \ingroup qtconcurrentexamples + + The QtConcurrent Map example shows how to use the synchronous (blocking) + QtConcurrent API to scale a collection of images. + + This is a command-line application. +*/ diff --git a/examples/qtconcurrent/progressdialog/doc/images/qtconcurrent-progressdialog.png b/examples/qtconcurrent/progressdialog/doc/images/qtconcurrent-progressdialog.png Binary files differnew file mode 100644 index 0000000000..2e8b7735ad --- /dev/null +++ b/examples/qtconcurrent/progressdialog/doc/images/qtconcurrent-progressdialog.png diff --git a/examples/qtconcurrent/progressdialog/doc/src/qtconcurrent-progressdialog.qdoc b/examples/qtconcurrent/progressdialog/doc/src/qtconcurrent-progressdialog.qdoc new file mode 100644 index 0000000000..aa5cd517a5 --- /dev/null +++ b/examples/qtconcurrent/progressdialog/doc/src/qtconcurrent-progressdialog.qdoc @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example qtconcurrent/progressdialog + \title QtConcurrent Progress Dialog Example + \brief Demonstrates how to monitor the progress of the active processes. + \ingroup qtconcurrentexamples + + The QtConcurrent Progress Dialog example shows how to use the + QFutureWatcher class to monitor the progress of a long-running operation. + + \image qtconcurrent-progressdialog.png +*/ diff --git a/examples/qtconcurrent/qtconcurrent.pro b/examples/qtconcurrent/qtconcurrent.pro index 72220b1ab3..dafbabb5c3 100644 --- a/examples/qtconcurrent/qtconcurrent.pro +++ b/examples/qtconcurrent/qtconcurrent.pro @@ -8,7 +8,7 @@ SUBDIRS = imagescaling \ SUBDIRS += progressdialog } -contains(QT_CONFIG, no-widgets) { +!qtHaveModule(widgets) { SUBDIRS -= \ imagescaling \ progressdialog \ diff --git a/examples/qtconcurrent/runfunction/doc/src/qtconcurrent-runfunction.qdoc b/examples/qtconcurrent/runfunction/doc/src/qtconcurrent-runfunction.qdoc new file mode 100644 index 0000000000..1c4e367240 --- /dev/null +++ b/examples/qtconcurrent/runfunction/doc/src/qtconcurrent-runfunction.qdoc @@ -0,0 +1,39 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example qtconcurrent/runfunction + \title Run Function Example + \brief Demonstrates how to run standard functions concurrently. + \ingroup qtconcurrentexamples + + The QtConcurrent Run Function example shows how to apply concurrency to + a standard function, using QFuture instances to retrieve return values + at a later time. + + This is a command-line application. +*/ diff --git a/examples/qtconcurrent/wordcount/doc/src/qtconcurrent-wordcount.qdoc b/examples/qtconcurrent/wordcount/doc/src/qtconcurrent-wordcount.qdoc new file mode 100644 index 0000000000..b8d04fa553 --- /dev/null +++ b/examples/qtconcurrent/wordcount/doc/src/qtconcurrent-wordcount.qdoc @@ -0,0 +1,39 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example qtconcurrent/wordcount + \title QtConcurrent Word Count Example + \brief Demonstrates how to use the map-reduce algorithm + \ingroup qtconcurrentexamples + + The QtConcurrent Word Count example demonstrates the use of the map-reduce + algorithm when applied to the problem of counting words in a collection + of files. + + This is a command-line application. +*/ diff --git a/examples/qtestlib/tutorial1/tutorial1.pro b/examples/qtestlib/tutorial1/tutorial1.pro index 8e77a9c5ff..d0d45ceb04 100644 --- a/examples/qtestlib/tutorial1/tutorial1.pro +++ b/examples/qtestlib/tutorial1/tutorial1.pro @@ -1,8 +1,7 @@ +QT += widgets testlib + SOURCES = testqstring.cpp -QT += testlib # install target.path = $$[QT_INSTALL_EXAMPLES]/qtestlib/tutorial1 INSTALLS += target - -QT += widgets diff --git a/examples/qtestlib/tutorial2/tutorial2.pro b/examples/qtestlib/tutorial2/tutorial2.pro index 58e70d4508..039c047fa8 100644 --- a/examples/qtestlib/tutorial2/tutorial2.pro +++ b/examples/qtestlib/tutorial2/tutorial2.pro @@ -1,8 +1,7 @@ +QT += widgets testlib + SOURCES = testqstring.cpp -QT += testlib # install target.path = $$[QT_INSTALL_EXAMPLES]/qtestlib/tutorial2 INSTALLS += target - -QT += widgets diff --git a/examples/qtestlib/tutorial3/tutorial3.pro b/examples/qtestlib/tutorial3/tutorial3.pro index 918dbf1187..297b0c9926 100644 --- a/examples/qtestlib/tutorial3/tutorial3.pro +++ b/examples/qtestlib/tutorial3/tutorial3.pro @@ -1,8 +1,7 @@ +QT += widgets testlib + SOURCES = testgui.cpp -QT += testlib # install target.path = $$[QT_INSTALL_EXAMPLES]/qtestlib/tutorial3 INSTALLS += target - -QT += widgets diff --git a/examples/qtestlib/tutorial4/tutorial4.pro b/examples/qtestlib/tutorial4/tutorial4.pro index f7b40dd4ca..4c1f431563 100644 --- a/examples/qtestlib/tutorial4/tutorial4.pro +++ b/examples/qtestlib/tutorial4/tutorial4.pro @@ -1,8 +1,7 @@ +QT += widgets testlib + SOURCES = testgui.cpp -QT += testlib # install target.path = $$[QT_INSTALL_EXAMPLES]/qtestlib/tutorial4 INSTALLS += target - -QT += widgets diff --git a/examples/qtestlib/tutorial5/tutorial5.pro b/examples/qtestlib/tutorial5/tutorial5.pro index facb21ea14..8499fd2085 100644 --- a/examples/qtestlib/tutorial5/tutorial5.pro +++ b/examples/qtestlib/tutorial5/tutorial5.pro @@ -1,8 +1,7 @@ +QT += widgets testlib + SOURCES = benchmarking.cpp -QT += testlib # install target.path = $$[QT_INSTALL_EXAMPLES]/qtestlib/tutorial5 INSTALLS += target - -QT += widgets diff --git a/examples/threads/doc/src/mandelbrot.qdoc b/examples/threads/doc/src/mandelbrot.qdoc index 842f4222ae..6ca0909f12 100644 --- a/examples/threads/doc/src/mandelbrot.qdoc +++ b/examples/threads/doc/src/mandelbrot.qdoc @@ -26,21 +26,23 @@ ****************************************************************************/ /*! - \example threads/mandelbrot + \example mandelbrot \title Mandelbrot Example + \ingroup qtconcurrent-mtexamples - The Mandelbrot example shows how to use a worker thread to + \brief The Mandelbrot example demonstrates multi-thread programming + using Qt. It shows how to use a worker thread to perform heavy computations without blocking the main thread's event loop. + \image mandelbrot-example.png Screenshot of the Mandelbrot example + The heavy computation here is the Mandelbrot set, probably the world's most famous fractal. These days, while sophisticated - programs such as \l{XaoS} that provide real-time zooming in the + programs such as \l{http://xaos.sourceforge.net/}{XaoS} that provide real-time zooming in the Mandelbrot set, the standard Mandelbrot algorithm is just slow enough for our purposes. - \image mandelbrot-example.png Screenshot of the Mandelbrot example - In real life, the approach described here is applicable to a large set of problems, including synchronous network I/O and database access, where the user interface must remain responsive diff --git a/examples/threads/doc/src/queuedcustomtype.qdoc b/examples/threads/doc/src/queuedcustomtype.qdoc index a1f2d54a21..df825b2db3 100644 --- a/examples/threads/doc/src/queuedcustomtype.qdoc +++ b/examples/threads/doc/src/queuedcustomtype.qdoc @@ -26,10 +26,12 @@ ****************************************************************************/ /*! - \example threads/queuedcustomtype + \example queuedcustomtype \title Queued Custom Type Example + \brief Demonstrates multi-thread programming using Qt + \ingroup qtconcurrent-mtexamples - The Queued Custom Type example shows how to send custom types between + \brief The Queued Custom Type example shows how to send custom types between threads with queued signals and slots. \image queuedcustomtype-example.png diff --git a/examples/threads/doc/src/semaphores.qdoc b/examples/threads/doc/src/semaphores.qdoc index a712cb6414..4cfccf00f8 100644 --- a/examples/threads/doc/src/semaphores.qdoc +++ b/examples/threads/doc/src/semaphores.qdoc @@ -26,10 +26,12 @@ ****************************************************************************/ /*! - \example threads/semaphores + \example semaphores \title Semaphores Example + \brief Demonstrates multi-thread programming using Qt + \ingroup qtconcurrent-mtexamples - The Semaphores example shows how to use QSemaphore to control + \brief The Semaphores example shows how to use QSemaphore to control access to a circular buffer shared by a producer thread and a consumer thread. diff --git a/examples/threads/doc/src/waitconditions.qdoc b/examples/threads/doc/src/waitconditions.qdoc index 3ca1970685..6969e46491 100644 --- a/examples/threads/doc/src/waitconditions.qdoc +++ b/examples/threads/doc/src/waitconditions.qdoc @@ -26,10 +26,12 @@ ****************************************************************************/ /*! - \example threads/waitconditions + \example waitconditions \title Wait Conditions Example + \brief Demonstrates multi-thread programming using Qt + \ingroup qtconcurrent-mtexamples - The Wait Conditions example shows how to use QWaitCondition and + \brief The Wait Conditions example shows how to use QWaitCondition and QMutex to control access to a circular buffer shared by a producer thread and a consumer thread. diff --git a/examples/threads/mandelbrot/mandelbrot.pro b/examples/threads/mandelbrot/mandelbrot.pro index 08c320fff6..45f21baf08 100644 --- a/examples/threads/mandelbrot/mandelbrot.pro +++ b/examples/threads/mandelbrot/mandelbrot.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = mandelbrotwidget.h \ renderthread.h SOURCES = main.cpp \ @@ -9,5 +11,3 @@ unix:!mac:!vxworks:!integrity:LIBS += -lm # install target.path = $$[QT_INSTALL_EXAMPLES]/threads/mandelbrot INSTALLS += target - -QT += widgets diff --git a/examples/threads/mandelbrot/mandelbrotwidget.cpp b/examples/threads/mandelbrot/mandelbrotwidget.cpp index c1ec029548..3a10a7a726 100644 --- a/examples/threads/mandelbrot/mandelbrotwidget.cpp +++ b/examples/threads/mandelbrot/mandelbrotwidget.cpp @@ -162,6 +162,7 @@ void MandelbrotWidget::keyPressEvent(QKeyEvent *event) } //! [11] +#ifndef QT_NO_WHEELEVENT //! [12] void MandelbrotWidget::wheelEvent(QWheelEvent *event) { @@ -170,6 +171,7 @@ void MandelbrotWidget::wheelEvent(QWheelEvent *event) zoom(pow(ZoomInFactor, numSteps)); } //! [12] +#endif //! [13] void MandelbrotWidget::mousePressEvent(QMouseEvent *event) diff --git a/examples/threads/mandelbrot/mandelbrotwidget.h b/examples/threads/mandelbrot/mandelbrotwidget.h index ea5fdc53c1..238a2bdca1 100644 --- a/examples/threads/mandelbrot/mandelbrotwidget.h +++ b/examples/threads/mandelbrot/mandelbrotwidget.h @@ -58,7 +58,9 @@ protected: void paintEvent(QPaintEvent *event); void resizeEvent(QResizeEvent *event); void keyPressEvent(QKeyEvent *event); +#ifndef QT_NO_WHEELEVENT void wheelEvent(QWheelEvent *event); +#endif void mousePressEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event); diff --git a/examples/threads/threads.pro b/examples/threads/threads.pro index 027d4c2ebb..e47da84a06 100644 --- a/examples/threads/threads.pro +++ b/examples/threads/threads.pro @@ -4,4 +4,4 @@ CONFIG += no_docs_target SUBDIRS = semaphores \ waitconditions -!contains(QT_CONFIG, no-widgets):SUBDIRS += mandelbrot +qtHaveModule(widgets): SUBDIRS += mandelbrot diff --git a/examples/tools/contiguouscache/contiguouscache.pro b/examples/tools/contiguouscache/contiguouscache.pro index 62cf862795..71130389be 100644 --- a/examples/tools/contiguouscache/contiguouscache.pro +++ b/examples/tools/contiguouscache/contiguouscache.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = randomlistmodel.h SOURCES = randomlistmodel.cpp \ main.cpp @@ -5,7 +7,5 @@ SOURCES = randomlistmodel.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/tools/contiguouscache INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/tools/doc/textfinder.qdoc b/examples/tools/doc/textfinder.qdoc deleted file mode 100644 index f958cf8623..0000000000 --- a/examples/tools/doc/textfinder.qdoc +++ /dev/null @@ -1,159 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \example uitools/textfinder - \title Text Finder Example - - \brief The Text Finder example demonstrates how to dynamically process forms - using the QtUiTools module. Dynamic form processing enables a form to - be processed at run-time only by changing the UI file for the project. - The program allows the user to look up a particular word within the - contents of a text file. This text file is included in the project's - resource and is loaded into the display at startup. - - \table - \row \li \inlineimage textfinder-example-find.png - \li \inlineimage textfinder-example-find2.png - \endtable - - \section1 Setting Up The Resource File - - The resources required for Text Finder are: - \list - \li \e{textfinder.ui} - the user interface file created in QtDesigner - \li \e{input.txt} - a text file containing some text to be displayed - in the QTextEdit - \endlist - - \e{textfinder.ui} contains all the necessary QWidget objects for the - Text Finder. A QLineEdit is used for the user input, a QTextEdit is - used to display the contents of \e{input.txt}, a QLabel is used to - display the text "Keyword", and a QPushButton is used for the "Find" - button. The screenshot below shows the preview obtained in QtDesigner. - - \image textfinder-example-userinterface.png - - A \e{textfinder.qrc} file is used to store both the \e{textfinder.ui} - and \e{input.txt} in the application's executable. The file contains - the following code: - - \quotefile examples/uitools/textfinder/textfinder.qrc - - For more information on resource files, see \l{The Qt Resource System}. - - To generate a form at run-time, the example is linked against the - QtUiTools module library. This is done in the \c{textfinder.pro} file - that contains the following lines: - - \snippet doc/src/snippets/code/doc_src_examples_textfinder.pro 0 - - \section1 TextFinder Class Definition - - The \c TextFinder class is a subclass of QWidget and it hosts the - \l{QWidget}s we need to access in the user interface. The QLabel in the - user interface is not declared here as we do not need to access it. - - \snippet examples/uitools/textfinder/textfinder.h 0 - - The slot \c{on_findButton_clicked()} is a slot named according to the - \l{Using a Designer UI File in Your Application#Automatic Connections} - {Automatic Connection} naming convention required - by \c uic. - - \section1 TextFinder Class Implementation - - The \c TextFinder class's constructor calls the \c loadUiFile() function - and then uses \c qFindChild() to access the user interface's - \l{QWidget}s. - - \snippet examples/uitools/textfinder/textfinder.cpp 0 - - We then use QMetaObject's system to enable signal and slot connections. - - \snippet examples/uitools/textfinder/textfinder.cpp 2 - - The loadTextFile() function is called to load \c{input.txt} into - QTextEdit to displays its contents. - - \snippet examples/uitools/textfinder/textfinder.cpp 3a - - The \c{TextFinder}'s layout is set with \l{QWidget::}{setLayout()}. - - \snippet examples/uitools/textfinder/textfinder.cpp 3b - - Finally, the window title is set to \e {Text Finder} and \c isFirstTime is - set to true. - - \c isFirstTime is used as a flag to indicate whether the search operation - has been performed more than once. This is further explained with the - \c{on_findButton_clicked()} function. - - The \c{loadUiFile()} function is used to load the user interface file - previously created in QtDesigner. The QUiLoader class is instantiated - and its \c load() function is used to load the form into \c{formWidget} - that acts as a place holder for the user interface. The function then - returns \c{formWidget} to its caller. - - \snippet examples/uitools/textfinder/textfinder.cpp 4 - - As mentioned earlier, the loadTextFile() function loads \e{input.txt} - into QTextEdit to display its contents. Data is read using QTextStream - into a QString object, \c line with the QTextStream::readAll() function. - The contents of \c line are then appended to \c{ui_textEdit}. - - \snippet examples/uitools/textfinder/textfinder.cpp 5 - - The \c{on_findButton_clicked()} function is a slot that is connected to - \c{ui_findButton}'s \c clicked() signal. The \c searchString is extracted - from the \c ui_lineEdit and the \c document is extracted from \c textEdit. - In event there is an empty \c searchString, a QMessageBox is used, - requesting the user to enter a word. Otherwise, we traverse through the - words in \c ui_textEdit, and highlight all ocurrences of the - \c searchString . Two QTextCursor objects are used: One to traverse through - the words in \c line and another to keep track of the edit blocks. - - \snippet examples/uitools/textfinder/textfinder.cpp 7 - - The \c isFirstTime flag is set to false the moment \c findButton is - clicked. This is necessary to undo the previous text highlight before - highlighting the user's next search string. Also, the \c found flag - is used to indicate if the \c searchString was found within the contents - of \c ui_textEdit. If it was not found, a QMessageBox is used - to inform the user. - - \snippet examples/uitools/textfinder/textfinder.cpp 9 - - \section1 \c main() Function - - \snippet examples/uitools/textfinder/main.cpp 0 - - The \c main() function initialises the \e{textfinder.qrc} resource file - and instantiates as well as displays \c TextFinder. - - \sa {Calculator Builder Example}, {World Time Clock Builder Example} - */ diff --git a/examples/touch/dials/dials.pro b/examples/touch/dials/dials.pro index 0da1103432..aeba956892 100644 --- a/examples/touch/dials/dials.pro +++ b/examples/touch/dials/dials.pro @@ -1,10 +1,10 @@ +QT += widgets + SOURCES += main.cpp FORMS += dials.ui # install target.path = $$[QT_INSTALL_EXAMPLES]/touch/dials INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/touch/dials/doc/images/touch-dials-example.png b/examples/touch/dials/doc/images/touch-dials-example.png Binary files differnew file mode 100644 index 0000000000..60e1776fc3 --- /dev/null +++ b/examples/touch/dials/doc/images/touch-dials-example.png diff --git a/examples/touch/dials/doc/src/touch-dials.qdoc b/examples/touch/dials/doc/src/touch-dials.qdoc new file mode 100644 index 0000000000..c18d068e3f --- /dev/null +++ b/examples/touch/dials/doc/src/touch-dials.qdoc @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example touch/dials + \title Touch Dials Example + \ingroup touchinputexamples + \brief Shows how to apply touch to a set of standard Qt widgets + + The Touch Dials example shows how to apply touch to a set of + standard Qt widgets. + + \image touch-dials-example.png +*/ diff --git a/examples/touch/fingerpaint/fingerpaint.pro b/examples/touch/fingerpaint/fingerpaint.pro index a9083b39ca..5391897af7 100644 --- a/examples/touch/fingerpaint/fingerpaint.pro +++ b/examples/touch/fingerpaint/fingerpaint.pro @@ -1,3 +1,6 @@ +QT += widgets +qtHaveModule(printsupport): QT += printsupport + HEADERS = mainwindow.h \ scribblearea.h SOURCES = main.cpp \ @@ -8,7 +11,4 @@ SOURCES = main.cpp \ target.path = $$[QT_INSTALL_EXAMPLES]/touch/fingerpaint INSTALLS += target -QT += widgets -!isEmpty(QT.printsupport.name): QT += printsupport - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/touch/knobs/doc/images/touch-knobs-example.png b/examples/touch/knobs/doc/images/touch-knobs-example.png Binary files differnew file mode 100644 index 0000000000..1cbd90d101 --- /dev/null +++ b/examples/touch/knobs/doc/images/touch-knobs-example.png diff --git a/examples/touch/knobs/doc/src/touch-knobs.qdoc b/examples/touch/knobs/doc/src/touch-knobs.qdoc new file mode 100644 index 0000000000..548b0bad05 --- /dev/null +++ b/examples/touch/knobs/doc/src/touch-knobs.qdoc @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example touch/knobs + \title Touch Knobs Example + \ingroup touchinputexamples + \brief Shows how to create custom controls that accept touch input + + The Touch Knobs example shows how to create custom controls that + accept touch input. + + \image touch-knobs-example.png +*/ diff --git a/examples/touch/knobs/knobs.pro b/examples/touch/knobs/knobs.pro index 7540a4b2cf..6a10a0776f 100644 --- a/examples/touch/knobs/knobs.pro +++ b/examples/touch/knobs/knobs.pro @@ -1,10 +1,10 @@ +QT += widgets + HEADERS = knob.h SOURCES = main.cpp knob.cpp # install target.path = $$[QT_INSTALL_EXAMPLES]/touch/knobs INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/touch/pinchzoom/pinchzoom.pro b/examples/touch/pinchzoom/pinchzoom.pro index df7ce246c3..5c101b2f5c 100644 --- a/examples/touch/pinchzoom/pinchzoom.pro +++ b/examples/touch/pinchzoom/pinchzoom.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS += \ mouse.h \ graphicsview.h @@ -12,7 +14,5 @@ RESOURCES += \ # install target.path = $$[QT_INSTALL_EXAMPLES]/touch/pinchzoom INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/webkit/webkit-guide/webkit-guide.pro b/examples/webkit/webkit-guide/webkit-guide.pro index 6614b6d52c..a2c2dd4a20 100644 --- a/examples/webkit/webkit-guide/webkit-guide.pro +++ b/examples/webkit/webkit-guide/webkit-guide.pro @@ -254,5 +254,3 @@ js/form_tapper.js \ js/mob_condjs.js \ js/mobile.js \ js/storage.js \ - -QT += widgets diff --git a/examples/widgets/animation/animatedtiles/animatedtiles.pro b/examples/widgets/animation/animatedtiles/animatedtiles.pro index c4e2553224..04c2b8f3d0 100644 --- a/examples/widgets/animation/animatedtiles/animatedtiles.pro +++ b/examples/widgets/animation/animatedtiles/animatedtiles.pro @@ -1,8 +1,8 @@ +QT += widgets + SOURCES = main.cpp RESOURCES = animatedtiles.qrc # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/animation/animatedtiles INSTALLS += target - -QT += widgets diff --git a/examples/widgets/animation/animation.pro b/examples/widgets/animation/animation.pro index 575fed4ead..a13f8bb65a 100644 --- a/examples/widgets/animation/animation.pro +++ b/examples/widgets/animation/animation.pro @@ -8,5 +8,3 @@ SUBDIRS += \ states \ stickman \ sub-attaq \ - -QT += widgets diff --git a/examples/widgets/animation/appchooser/appchooser.pro b/examples/widgets/animation/appchooser/appchooser.pro index 8560db2c4c..674e623b2d 100644 --- a/examples/widgets/animation/appchooser/appchooser.pro +++ b/examples/widgets/animation/appchooser/appchooser.pro @@ -1,8 +1,8 @@ +QT += widgets + SOURCES = main.cpp RESOURCES = appchooser.qrc # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/animation/appchooser INSTALLS += target - -QT += widgets diff --git a/examples/widgets/animation/easing/easing.pro b/examples/widgets/animation/easing/easing.pro index 0e430df1ba..498180c0bb 100644 --- a/examples/widgets/animation/easing/easing.pro +++ b/examples/widgets/animation/easing/easing.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = window.h \ animation.h SOURCES = main.cpp \ @@ -10,6 +12,3 @@ RESOURCES = easing.qrc # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/animation/easing INSTALLS += target - -QT += widgets - diff --git a/examples/widgets/animation/moveblocks/moveblocks.pro b/examples/widgets/animation/moveblocks/moveblocks.pro index 2992315064..1397246b3f 100644 --- a/examples/widgets/animation/moveblocks/moveblocks.pro +++ b/examples/widgets/animation/moveblocks/moveblocks.pro @@ -1,7 +1,7 @@ +QT += widgets + SOURCES = main.cpp # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/animation/moveblocks INSTALLS += target - -QT += widgets diff --git a/examples/widgets/animation/states/states.pro b/examples/widgets/animation/states/states.pro index 563160ce9f..491d557a8d 100644 --- a/examples/widgets/animation/states/states.pro +++ b/examples/widgets/animation/states/states.pro @@ -1,8 +1,8 @@ +QT += widgets + SOURCES += main.cpp RESOURCES += states.qrc # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/animation/states INSTALLS += target - -QT += widgets diff --git a/examples/widgets/animation/stickman/stickman.pro b/examples/widgets/animation/stickman/stickman.pro index 145a9a18f9..a803acf624 100644 --- a/examples/widgets/animation/stickman/stickman.pro +++ b/examples/widgets/animation/stickman/stickman.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS += stickman.h \ animation.h \ node.h \ @@ -17,5 +19,3 @@ RESOURCES += stickman.qrc # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/animation/stickman INSTALLS += target - -QT += widgets diff --git a/examples/widgets/animation/sub-attaq/sub-attaq.pro b/examples/widgets/animation/sub-attaq/sub-attaq.pro index 3ed823d1e6..ac79fd4249 100644 --- a/examples/widgets/animation/sub-attaq/sub-attaq.pro +++ b/examples/widgets/animation/sub-attaq/sub-attaq.pro @@ -1,5 +1,5 @@ QT += widgets -contains(QT_CONFIG, opengl):QT += opengl +qtHaveModule(opengl): QT += opengl HEADERS += boat.h \ bomb.h \ mainwindow.h \ diff --git a/examples/widgets/desktop/desktop.pro b/examples/widgets/desktop/desktop.pro index 5da59599d4..db518c1c7a 100644 --- a/examples/widgets/desktop/desktop.pro +++ b/examples/widgets/desktop/desktop.pro @@ -1,5 +1,3 @@ TEMPLATE = subdirs CONFIG += ordered SUBDIRS = screenshot systray - -QT += widgets diff --git a/examples/widgets/desktop/screenshot/screenshot.pro b/examples/widgets/desktop/screenshot/screenshot.pro index 31ea646af0..f12bc82ca7 100644 --- a/examples/widgets/desktop/screenshot/screenshot.pro +++ b/examples/widgets/desktop/screenshot/screenshot.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = screenshot.h SOURCES = main.cpp \ screenshot.cpp @@ -6,5 +8,4 @@ SOURCES = main.cpp \ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/desktop/screenshot INSTALLS += target -QT += widgets simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/desktop/systray/main.cpp b/examples/widgets/desktop/systray/main.cpp index bb81bb78e4..ece04524b8 100644 --- a/examples/widgets/desktop/systray/main.cpp +++ b/examples/widgets/desktop/systray/main.cpp @@ -39,8 +39,10 @@ ****************************************************************************/ #include <QApplication> -#include <QMessageBox> +#ifndef QT_NO_SYSTEMTRAYICON + +#include <QMessageBox> #include "window.h" int main(int argc, char *argv[]) @@ -61,3 +63,24 @@ int main(int argc, char *argv[]) window.show(); return app.exec(); } + +#else + +#include <QLabel> +#include <QDebug> + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + QString text("QSystemTrayIcon is not supported on this platform"); + + QLabel *label = new QLabel(text); + label->setWordWrap(true); + + label->show(); + qDebug() << text; + + app.exec(); +} + +#endif diff --git a/examples/widgets/desktop/systray/window.cpp b/examples/widgets/desktop/systray/window.cpp index 8de1f5843e..a7ea3b471e 100644 --- a/examples/widgets/desktop/systray/window.cpp +++ b/examples/widgets/desktop/systray/window.cpp @@ -39,6 +39,9 @@ ****************************************************************************/ #include "window.h" + +#ifndef QT_NO_SYSTEMTRAYICON + #include <QtGui> #include <QAction> @@ -265,3 +268,5 @@ void Window::createTrayIcon() trayIcon = new QSystemTrayIcon(this); trayIcon->setContextMenu(trayIconMenu); } + +#endif diff --git a/examples/widgets/desktop/systray/window.h b/examples/widgets/desktop/systray/window.h index 2c33812778..08919e8a49 100644 --- a/examples/widgets/desktop/systray/window.h +++ b/examples/widgets/desktop/systray/window.h @@ -42,6 +42,9 @@ #define WINDOW_H #include <QSystemTrayIcon> + +#ifndef QT_NO_SYSTEMTRAYICON + #include <QDialog> QT_BEGIN_NAMESPACE @@ -109,4 +112,6 @@ private: }; //! [0] +#endif // QT_NO_SYSTEMTRAYICON + #endif diff --git a/examples/widgets/dialogs/classwizard/classwizard.pro b/examples/widgets/dialogs/classwizard/classwizard.pro index 9b272b9d3f..5226b38b7c 100644 --- a/examples/widgets/dialogs/classwizard/classwizard.pro +++ b/examples/widgets/dialogs/classwizard/classwizard.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = classwizard.h SOURCES = classwizard.cpp \ main.cpp @@ -7,5 +9,4 @@ RESOURCES = classwizard.qrc target.path = $$[QT_INSTALL_EXAMPLES]/widgets/dialogs/classwizard INSTALLS += target -QT += widgets simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/dialogs/classwizard/main.cpp b/examples/widgets/dialogs/classwizard/main.cpp index ec95d9d8d3..55fdf0fbb6 100644 --- a/examples/widgets/dialogs/classwizard/main.cpp +++ b/examples/widgets/dialogs/classwizard/main.cpp @@ -51,11 +51,13 @@ int main(int argc, char *argv[]) QApplication app(argc, argv); +#ifndef QT_NO_TRANSLATION QString translatorFileName = QLatin1String("qt_"); translatorFileName += QLocale::system().name(); QTranslator *translator = new QTranslator(&app); if (translator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) app.installTranslator(translator); +#endif ClassWizard wizard; wizard.show(); diff --git a/examples/widgets/dialogs/configdialog/configdialog.pro b/examples/widgets/dialogs/configdialog/configdialog.pro index 616b5fd650..6e5b1e2725 100644 --- a/examples/widgets/dialogs/configdialog/configdialog.pro +++ b/examples/widgets/dialogs/configdialog/configdialog.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = configdialog.h \ pages.h SOURCES = configdialog.cpp \ @@ -11,5 +13,4 @@ INSTALLS += target wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib -QT += widgets simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/dialogs/configdialog/main.cpp b/examples/widgets/dialogs/configdialog/main.cpp index 20a2709a1e..b23c64a56f 100644 --- a/examples/widgets/dialogs/configdialog/main.cpp +++ b/examples/widgets/dialogs/configdialog/main.cpp @@ -47,6 +47,7 @@ int main(int argc, char *argv[]) Q_INIT_RESOURCE(configdialog); QApplication app(argc, argv); + app.setApplicationDisplayName("Qt Example"); ConfigDialog dialog; return dialog.exec(); } diff --git a/examples/widgets/dialogs/dialogs.pro b/examples/widgets/dialogs/dialogs.pro index 0a4922eeaf..c31c37222d 100644 --- a/examples/widgets/dialogs/dialogs.pro +++ b/examples/widgets/dialogs/dialogs.pro @@ -11,5 +11,3 @@ SUBDIRS = classwizard \ contains(DEFINES, QT_NO_WIZARD): SUBDIRS -= trivialwizard licensewizard classwizard wince*: SUBDIRS += sipdialog - -QT += widgets diff --git a/examples/widgets/dialogs/extension/extension.pro b/examples/widgets/dialogs/extension/extension.pro index e7cf493128..327eeff1f3 100644 --- a/examples/widgets/dialogs/extension/extension.pro +++ b/examples/widgets/dialogs/extension/extension.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = finddialog.h SOURCES = finddialog.cpp \ main.cpp @@ -6,5 +8,4 @@ SOURCES = finddialog.cpp \ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/dialogs/extension INSTALLS += target -QT += widgets simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/dialogs/findfiles/findfiles.pro b/examples/widgets/dialogs/findfiles/findfiles.pro index f02ec69e4c..2dd058ac5c 100644 --- a/examples/widgets/dialogs/findfiles/findfiles.pro +++ b/examples/widgets/dialogs/findfiles/findfiles.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = window.h SOURCES = main.cpp \ window.cpp @@ -5,5 +7,3 @@ SOURCES = main.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/dialogs/findfiles INSTALLS += target - -QT += widgets diff --git a/examples/widgets/dialogs/licensewizard/licensewizard.pro b/examples/widgets/dialogs/licensewizard/licensewizard.pro index 4bcfdad384..8a4b251737 100644 --- a/examples/widgets/dialogs/licensewizard/licensewizard.pro +++ b/examples/widgets/dialogs/licensewizard/licensewizard.pro @@ -1,3 +1,5 @@ +QT += widgets printsupport + HEADERS = licensewizard.h SOURCES = licensewizard.cpp \ main.cpp @@ -7,5 +9,4 @@ RESOURCES = licensewizard.qrc target.path = $$[QT_INSTALL_EXAMPLES]/widgets/dialogs/licensewizard INSTALLS += target -QT += widgets printsupport simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/dialogs/licensewizard/main.cpp b/examples/widgets/dialogs/licensewizard/main.cpp index 9217d4f49e..a84c6241d4 100644 --- a/examples/widgets/dialogs/licensewizard/main.cpp +++ b/examples/widgets/dialogs/licensewizard/main.cpp @@ -51,12 +51,14 @@ int main(int argc, char *argv[]) QApplication app(argc, argv); +#ifndef QT_NO_TRANSLATION QString translatorFileName = QLatin1String("qt_"); translatorFileName += QLocale::system().name(); QTranslator *translator = new QTranslator(&app); if (translator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) app.installTranslator(translator); - +#endif + LicenseWizard wizard; wizard.show(); return app.exec(); diff --git a/examples/widgets/dialogs/sipdialog/sipdialog.pro b/examples/widgets/dialogs/sipdialog/sipdialog.pro index 5e24335e8c..a7c82a0ebc 100644 --- a/examples/widgets/dialogs/sipdialog/sipdialog.pro +++ b/examples/widgets/dialogs/sipdialog/sipdialog.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = dialog.h SOURCES = main.cpp \ dialog.cpp @@ -8,6 +10,4 @@ INSTALLS += target wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/dialogs/standarddialogs/main.cpp b/examples/widgets/dialogs/standarddialogs/main.cpp index 15f18d7af1..96863e3aab 100644 --- a/examples/widgets/dialogs/standarddialogs/main.cpp +++ b/examples/widgets/dialogs/standarddialogs/main.cpp @@ -49,11 +49,13 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); +#ifndef QT_NO_TRANSLATION QString translatorFileName = QLatin1String("qt_"); translatorFileName += QLocale::system().name(); QTranslator *translator = new QTranslator(&app); if (translator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) app.installTranslator(translator); +#endif Dialog dialog; dialog.show(); diff --git a/examples/widgets/dialogs/standarddialogs/standarddialogs.pro b/examples/widgets/dialogs/standarddialogs/standarddialogs.pro index 89d0ad9a39..12a814cb69 100644 --- a/examples/widgets/dialogs/standarddialogs/standarddialogs.pro +++ b/examples/widgets/dialogs/standarddialogs/standarddialogs.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = dialog.h SOURCES = dialog.cpp \ main.cpp @@ -7,5 +9,3 @@ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/dialogs/standarddialogs INSTALLS += target wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib - -QT += widgets diff --git a/examples/widgets/dialogs/tabdialog/tabdialog.pro b/examples/widgets/dialogs/tabdialog/tabdialog.pro index 656c661844..c282505ac1 100644 --- a/examples/widgets/dialogs/tabdialog/tabdialog.pro +++ b/examples/widgets/dialogs/tabdialog/tabdialog.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = tabdialog.h SOURCES = main.cpp \ tabdialog.cpp @@ -7,4 +9,3 @@ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/dialogs/tabdialog INSTALLS += target wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib -QT += widgets diff --git a/examples/widgets/dialogs/trivialwizard/trivialwizard.cpp b/examples/widgets/dialogs/trivialwizard/trivialwizard.cpp index a49e17e104..f302c0e390 100644 --- a/examples/widgets/dialogs/trivialwizard/trivialwizard.cpp +++ b/examples/widgets/dialogs/trivialwizard/trivialwizard.cpp @@ -115,12 +115,13 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); +#ifndef QT_NO_TRANSLATION QString translatorFileName = QLatin1String("qt_"); translatorFileName += QLocale::system().name(); QTranslator *translator = new QTranslator(&app); if (translator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) app.installTranslator(translator); - +#endif QWizard wizard; wizard.addPage(createIntroPage()); diff --git a/examples/widgets/dialogs/trivialwizard/trivialwizard.pro b/examples/widgets/dialogs/trivialwizard/trivialwizard.pro index 63831e8576..d85826132c 100644 --- a/examples/widgets/dialogs/trivialwizard/trivialwizard.pro +++ b/examples/widgets/dialogs/trivialwizard/trivialwizard.pro @@ -1,8 +1,9 @@ +QT += widgets + SOURCES = trivialwizard.cpp # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/dialogs/trivialwizard INSTALLS += target -QT += widgets simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/doc/images/calendar-example.png b/examples/widgets/doc/images/calendar-example.png Binary files differnew file mode 100644 index 0000000000..895ce76b09 --- /dev/null +++ b/examples/widgets/doc/images/calendar-example.png diff --git a/examples/widgets/doc/images/collidingmice-example.png b/examples/widgets/doc/images/collidingmice-example.png Binary files differnew file mode 100644 index 0000000000..41561de394 --- /dev/null +++ b/examples/widgets/doc/images/collidingmice-example.png diff --git a/examples/widgets/doc/images/graphicsanchorlayout-example.png b/examples/widgets/doc/images/graphicsanchorlayout-example.png Binary files differnew file mode 100644 index 0000000000..d30d6839d9 --- /dev/null +++ b/examples/widgets/doc/images/graphicsanchorlayout-example.png diff --git a/examples/widgets/doc/images/graphicsflowlayout-example.png b/examples/widgets/doc/images/graphicsflowlayout-example.png Binary files differnew file mode 100644 index 0000000000..a5f9b3dc40 --- /dev/null +++ b/examples/widgets/doc/images/graphicsflowlayout-example.png diff --git a/examples/widgets/doc/images/graphicssimpleanchorlayout-example.png b/examples/widgets/doc/images/graphicssimpleanchorlayout-example.png Binary files differnew file mode 100644 index 0000000000..d073b12c0c --- /dev/null +++ b/examples/widgets/doc/images/graphicssimpleanchorlayout-example.png diff --git a/examples/widgets/doc/images/itemviews-editabletreemodel.png b/examples/widgets/doc/images/itemviews-editabletreemodel.png Binary files differnew file mode 100644 index 0000000000..a151ea857f --- /dev/null +++ b/examples/widgets/doc/images/itemviews-editabletreemodel.png diff --git a/examples/widgets/doc/images/orderform-example.png b/examples/widgets/doc/images/orderform-example.png Binary files differnew file mode 100644 index 0000000000..c8545ad23a --- /dev/null +++ b/examples/widgets/doc/images/orderform-example.png diff --git a/examples/widgets/doc/images/textedit-demo.png b/examples/widgets/doc/images/textedit-demo.png Binary files differnew file mode 100644 index 0000000000..3cf2883a12 --- /dev/null +++ b/examples/widgets/doc/images/textedit-demo.png diff --git a/examples/widgets/doc/images/textfinder-example-userinterface.png b/examples/widgets/doc/images/textfinder-example-userinterface.png Binary files differdeleted file mode 100644 index 2bebe2e9dd..0000000000 --- a/examples/widgets/doc/images/textfinder-example-userinterface.png +++ /dev/null diff --git a/examples/widgets/doc/images/weatheranchorlayout-example.png b/examples/widgets/doc/images/weatheranchorlayout-example.png Binary files differnew file mode 100644 index 0000000000..59d3b55b7a --- /dev/null +++ b/examples/widgets/doc/images/weatheranchorlayout-example.png diff --git a/examples/widgets/doc/src/addressbook.qdoc b/examples/widgets/doc/src/addressbook.qdoc index 65ed4b33bd..4712bf94ad 100644 --- a/examples/widgets/doc/src/addressbook.qdoc +++ b/examples/widgets/doc/src/addressbook.qdoc @@ -28,7 +28,7 @@ /*! \example itemviews/addressbook \title Address Book Example - + \ingroup examples-itemviews \brief The address book example shows how to use proxy models to display different views onto data from a single model. diff --git a/examples/widgets/doc/src/application.qdoc b/examples/widgets/doc/src/application.qdoc index bd0f8fd09f..e6c135e138 100644 --- a/examples/widgets/doc/src/application.qdoc +++ b/examples/widgets/doc/src/application.qdoc @@ -28,6 +28,7 @@ /*! \example mainwindows/application \title Application Example + \ingroup examples-mainwindow \brief The Application example shows how to implement a standard GUI application with menus, toolbars, and a status bar. The example diff --git a/examples/widgets/doc/src/basicgraphicslayouts.qdoc b/examples/widgets/doc/src/basicgraphicslayouts.qdoc index 36ce914018..70f92a838a 100644 --- a/examples/widgets/doc/src/basicgraphicslayouts.qdoc +++ b/examples/widgets/doc/src/basicgraphicslayouts.qdoc @@ -28,8 +28,10 @@ /*! \example graphicsview/basicgraphicslayouts \title Basic Graphics Layouts Example + \ingroup examples-graphicsview-layout + \brief Demonstrates how to create basic graphics layout - \brief The Basic Graphics Layouts example shows how to use the layout classes + The Basic Graphics Layouts example shows how to use the layout classes in QGraphicsView: QGraphicsLinearLayout and QGraphicsGridLayout. In addition to that it shows how to write your own custom layout item. diff --git a/examples/widgets/doc/src/basicsortfiltermodel.qdoc b/examples/widgets/doc/src/basicsortfiltermodel.qdoc index f9a3b94ba6..16f9fa61a2 100644 --- a/examples/widgets/doc/src/basicsortfiltermodel.qdoc +++ b/examples/widgets/doc/src/basicsortfiltermodel.qdoc @@ -28,7 +28,7 @@ /*! \example itemviews/basicsortfiltermodel \title Basic Sort/Filter Model Example - + \ingroup examples-itemviews \brief The Basic Sort/Filter Model example illustrates how to use QSortFilterProxyModel to perform basic sorting and filtering. diff --git a/examples/widgets/doc/src/blurpicker.qdoc b/examples/widgets/doc/src/blurpicker.qdoc index aa89ba3cd8..06426c2ab3 100644 --- a/examples/widgets/doc/src/blurpicker.qdoc +++ b/examples/widgets/doc/src/blurpicker.qdoc @@ -28,6 +28,8 @@ /*! \example effects/blurpicker \title Blur Picker Effect Example + \ingroup examples-graphicsview-graphicseffects + \brief Demonstrates how to apply graphical effects on items in the view \image blurpickereffect-example.png */ diff --git a/examples/widgets/doc/src/boxes.qdoc b/examples/widgets/doc/src/boxes.qdoc index 96238f1efd..6ad50fff9f 100644 --- a/examples/widgets/doc/src/boxes.qdoc +++ b/examples/widgets/doc/src/boxes.qdoc @@ -28,9 +28,8 @@ /*! \example graphicsview/boxes \title Boxes - - \brief This demo shows Qt's ability to combine advanced OpenGL rendering with the - the \l{Graphics View Framework}. + \ingroup examples-graphicsview + \brief Combines advanced OpenGL rendering with the Graphics View framework \image boxes-demo.png diff --git a/examples/widgets/doc/src/chart.qdoc b/examples/widgets/doc/src/chart.qdoc index d12ee58422..a3b54f5328 100644 --- a/examples/widgets/doc/src/chart.qdoc +++ b/examples/widgets/doc/src/chart.qdoc @@ -28,7 +28,7 @@ /*! \example itemviews/chart \title Chart Example - + \ingroup examples-itemviews \brief The Chart example shows how to create a custom view for the model/view framework. \image chart-example.png diff --git a/examples/widgets/doc/src/chip.qdoc b/examples/widgets/doc/src/chip.qdoc index aa31227e43..6fd15ac09c 100644 --- a/examples/widgets/doc/src/chip.qdoc +++ b/examples/widgets/doc/src/chip.qdoc @@ -28,9 +28,10 @@ /*! \example graphicsview/chip \title 40000 Chips + \ingroup examples-graphicsview + \brief Visualizes a huge graphic view scene with 40000 chip items - \brief This demo shows how to visualize a huge scene with 40000 chip items - using Graphics View. It also shows Graphics View's powerful navigation + This examples demonstrates Graphics View's powerful navigation and interaction features, allowing you to zoom and rotate each of four views independently, and you can select and move items around the scene. diff --git a/examples/widgets/doc/src/classwizard.qdoc b/examples/widgets/doc/src/classwizard.qdoc index 038f9e19b2..b4224a182f 100644 --- a/examples/widgets/doc/src/classwizard.qdoc +++ b/examples/widgets/doc/src/classwizard.qdoc @@ -28,6 +28,7 @@ /*! \example dialogs/classwizard \title Class Wizard Example + \ingroup examples-dialogs \brief The License Wizard example shows how to implement linear wizards using QWizard. diff --git a/examples/widgets/doc/src/collidingmice-example.qdoc b/examples/widgets/doc/src/collidingmice-example.qdoc new file mode 100644 index 0000000000..b6187677b8 --- /dev/null +++ b/examples/widgets/doc/src/collidingmice-example.qdoc @@ -0,0 +1,273 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example graphicsview/collidingmice + \title Colliding Mice Example + \brief Demonstrates how to animate items on a graphics view + \ingroup examples-graphicsview + + The Colliding Mice example shows how to use the Graphics View + framework to implement animated items and detect collision between + items. + + \image collidingmice-example.png + + Graphics View provides the QGraphicsScene class for managing and + interacting with a large number of custom-made 2D graphical items + derived from the QGraphicsItem class, and a QGraphicsView widget + for visualizing the items, with support for zooming and rotation. + + The example consists of an item class and a main function: + the \c Mouse class represents the individual mice extending + QGraphicsItem, and the \c main() function provides the main + application window. + + We will first review the \c Mouse class to see how to animate + items and detect item collision, and then we will review the \c + main() function to see how to put the items into a scene and how to + implement the corresponding view. + + \section1 Mouse Class Definition + + The \c mouse class inherits from QGraphicsItem. The + QGraphicsItem class is the base class for all graphical items in + the Graphics View framework, and provides a light-weight + foundation for writing your own custom items. + + \snippet graphicsview/collidingmice/mouse.h 0 + + When writing a custom graphics item, you must implement + QGraphicsItem's two pure virtual public functions: \l + {QGraphicsItem::}{boundingRect()}, which returns an estimate of + the area painted by the item, and \l {QGraphicsItem::}{paint()}, + which implements the actual painting. In addition, we reimplement + the \l {QGraphicsItem::}{shape()} and \l {QGraphicsItem::}{advance()}. + We reimplement \l {QGraphicsItem::}{shape()} to return an accurate + shape of our mouse item; the default implementation simply returns + the item's bounding rectangle. We reimplement \l {QGraphicsItem::}{advance()} + to handle the animation so it all happens on one update. + + \section1 Mouse Class Definition + + When constructing a mouse item, we first ensure that all the item's + private variables are properly initialized: + + \snippet graphicsview/collidingmice/mouse.cpp 0 + + To calculate the various components of the mouse's color, we use + the global qrand() function which is a thread-safe version of the + standard C++ rand() function. + + Then we call the \l {QGraphicsItem::setRotation()}{setRotation()} function + inherited from QGraphicsItem. Items live in their own local + coordinate system. Their coordinates are usually centered around + (0, 0), and this is also the center for all transformations. By + calling the item's \l {QGraphicsItem::setRotation()}{setRotation()} function + we alter the direction in which the mouse will start moving. + + When the QGraphicsScene decides to advance the scene a frame it will + call QGraphicsItem::advance() on each of the items. This enables us to + animate our mouse using our reimplementation of the advance() function. + + \snippet graphicsview/collidingmice/mouse.cpp 4 + \snippet graphicsview/collidingmice/mouse.cpp 5 + \snippet graphicsview/collidingmice/mouse.cpp 6 + + First, we don't bother doing any advance if the step is 0 since we want to our advance in + the actual advance (advance() is called twice, once with step == 0 indicating that items + are about to advance and with step == 1 for the actual advance). We also ensure that the + mice stays within a circle with a radius of 150 pixels. + + Note the \l {QGraphicsItem::mapFromScene()}{mapFromScene()} + function provided by QGraphicsItem. This function maps a position + given in \e scene coordinates, to the item's coordinate system. + + \snippet graphicsview/collidingmice/mouse.cpp 7 + \snippet graphicsview/collidingmice/mouse.cpp 8 + \snippet graphicsview/collidingmice/mouse.cpp 9 + \codeline + \snippet graphicsview/collidingmice/mouse.cpp 10 + + Then we try to avoid colliding with other mice. + + \snippet graphicsview/collidingmice/mouse.cpp 11 + + Finally, we calculate the mouse's speed and its eye direction (for + use when painting the mouse), and set its new position. + + The position of an item describes its origin (local coordinate (0, + 0)) in the parent coordinates. The \l {QGraphicsItem::setPos()} + function sets the position of the item to the given position in + the parent's coordinate system. For items with no parent, the + given position is interpreted as scene coordinates. QGraphicsItem + also provides a \l {QGraphicsItem::}{mapToParent()} function to + map a position given in item coordinates, to the parent's + coordinate system. If the item has no parent, the position will be + mapped to the scene's coordinate system instead. + + Then it is time to provide an implementation for the pure virtual + functions inherited from QGraphicsItem. Let's first take a look at + the \l {QGraphicsItem::}{boundingRect()} function: + + \snippet graphicsview/collidingmice/mouse.cpp 1 + + The \l {QGraphicsItem::boundingRect()}{boundingRect()} function + defines the outer bounds of the item as a rectangle. Note that the + Graphics View framework uses the bounding rectangle to determine + whether the item requires redrawing, so all painting must be + restricted inside this rectangle. + + \snippet graphicsview/collidingmice/mouse.cpp 3 + + The Graphics View framework calls the \l + {QGraphicsItem::paint()}{paint()} function to paint the contents + of the item; the function paints the item in local coordinates. + + Note the painting of the ears: Whenever a mouse item collides with + other mice items its ears are filled with red; otherwise they are + filled with dark yellow. We use the + QGraphicsScene::collidingItems() function to check if there are + any colliding mice. The actual collision detection is handled by + the Graphics View framework using shape-shape intersection. All we + have to do is to ensure that the QGraphicsItem::shape() function + returns an accurate shape for our item: + + \snippet graphicsview/collidingmice/mouse.cpp 2 + + Because the complexity of arbitrary shape-shape intersection grows + with an order of magnitude when the shapes are complex, this + operation can be noticably time consuming. An alternative approach + is to reimplement the \l + {QGraphicsItem::collidesWithItem()}{collidesWithItem()} function + to provide your own custom item and shape collision algorithm. + + This completes the \c Mouse class implementation, it is now ready + for use. Let's take a look at the \c main() function to see how to + implement a scene for the mice and a view for displaying the + contents of the scene. + + \section1 The Main() Function + + In this example we have chosen to let the \c main() function + provide the main application window, creating the items and the + scene, putting the items into the scene and creating a + corresponding view. + + \snippet graphicsview/collidingmice/main.cpp 0 + + First, we create an application object and call the global + qsrand() function to specify the seed used to generate a new + random number sequence of pseudo random integers with the + previously mentioned qrand() function. + + Then it is time to create the scene: + + \snippet graphicsview/collidingmice/main.cpp 1 + + The QGraphicsScene class serves as a container for + QGraphicsItems. It also provides functionality that lets you + efficiently determine the location of items as well as determining + which items that are visible within an arbitrary area on the + scene. + + When creating a scene it is recommended to set the scene's + rectangle, i.e., the rectangle that defines the extent of the + scene. It is primarily used by QGraphicsView to determine the + view's default scrollable area, and by QGraphicsScene to manage + item indexing. If not explicitly set, the scene's default + rectangle will be the largest bounding rectangle of all the items + on the scene since the scene was created (i.e., the rectangle will + grow when items are added or moved in the scene, but it will never + shrink). + + \snippet graphicsview/collidingmice/main.cpp 2 + + The item index function is used to speed up item discovery. \l + {QGraphicsScene::NoIndex}{NoIndex} implies that item location is + of linear complexity, as all items on the scene are + searched. Adding, moving and removing items, however, is done in + constant time. This approach is ideal for dynamic scenes, where + many items are added, moved or removed continuously. The + alternative is \l {QGraphicsScene::BspTreeIndex}{BspTreeIndex} + which makes use of binary search resulting in item location + algorithms that are of an order closer to logarithmic complexity. + + \snippet graphicsview/collidingmice/main.cpp 3 + + Then we add the mice to the scene. + + \snippet graphicsview/collidingmice/main.cpp 4 + + To be able to view the scene we must also create a QGraphicsView + widget. The QGraphicsView class visualizes the contents of a scene + in a scrollable viewport. We also ensure that the contents is + rendered using antialiasing, and we create the cheese background + by setting the view's background brush. + + The image used for the background is stored as a binary file in + the application's executable using Qt's \l {The Qt Resource + System}{resource system}. The QPixmap constructor accepts both + file names that refer to actual files on disk and file names that + refer to the application's embedded resources. + + \snippet graphicsview/collidingmice/main.cpp 5 + + Then we set the cache mode; QGraphicsView can cache pre-rendered + content in a pixmap, which is then drawn onto the viewport. The + purpose of such caching is to speed up the total rendering time + for areas that are slow to render, e.g., texture, gradient and + alpha blended backgrounds. The \l + {QGraphicsView::CacheMode}{CacheMode} property holds which parts + of the view that are cached, and the \l + {QGraphicsView::CacheBackground}{CacheBackground} flag enables + caching of the view's background. + + By setting the \l {QGraphicsView::dragMode}{dragMode} property we + define what should happen when the user clicks on the scene + background and drags the mouse. The \l + {QGraphicsView::ScrollHandDrag}{ScrollHandDrag} flag makes the + cursor change into a pointing hand, and dragging the mouse around + will scroll the scrollbars. + + \snippet graphicsview/collidingmice/main.cpp 6 + + In the end, we set the application window's title and size before + we enter the main event loop using the QApplication::exec() + function. + + Finally, we create a QTimer and connect its timeout() signal to the + advance() slot of the scene. Every time the timer fires, the scene + will advance one frame. + + We then tell the timer to fire every 1000/33 millisecond. This will + give us a frame rate of 30 frames a second, which is fast enough for most + animations. Doing the animation with a single timer connect to advance the + scene ensures that all the mice are moved at one point and, more + importantly, only one update is sent to the screen after all the mice have + moved. +*/ diff --git a/examples/widgets/doc/src/coloreditorfactory.qdoc b/examples/widgets/doc/src/coloreditorfactory.qdoc index 377491939e..f34622f37e 100644 --- a/examples/widgets/doc/src/coloreditorfactory.qdoc +++ b/examples/widgets/doc/src/coloreditorfactory.qdoc @@ -28,7 +28,7 @@ /*! \example itemviews/coloreditorfactory \title Color Editor Factory Example - + \ingroup examples-itemviews \brief This example shows how to create an editor that can be used by a QItemDelegate. diff --git a/examples/widgets/doc/src/combowidgetmapper.qdoc b/examples/widgets/doc/src/combowidgetmapper.qdoc index df0d893f64..187934a816 100644 --- a/examples/widgets/doc/src/combowidgetmapper.qdoc +++ b/examples/widgets/doc/src/combowidgetmapper.qdoc @@ -28,7 +28,7 @@ /*! \example itemviews/combowidgetmapper \title Combo Widget Mapper Example - + \ingroup examples-itemviews \brief The Combo Widget Mapper example shows how to use a custom delegate to map information from a model to specific widgets on a form. diff --git a/examples/widgets/doc/src/configdialog.qdoc b/examples/widgets/doc/src/configdialog.qdoc index 0fdbc5ddd0..18c14b79e3 100644 --- a/examples/widgets/doc/src/configdialog.qdoc +++ b/examples/widgets/doc/src/configdialog.qdoc @@ -28,6 +28,7 @@ /*! \example dialogs/configdialog \title Config Dialog Example + \ingroup examples-dialogs \brief The Config Dialog examples shows how a configuration dialog can be created by using an icon view with a stacked widget. diff --git a/examples/widgets/doc/src/customsortfiltermodel.qdoc b/examples/widgets/doc/src/customsortfiltermodel.qdoc index 2003dc767a..82f124606e 100644 --- a/examples/widgets/doc/src/customsortfiltermodel.qdoc +++ b/examples/widgets/doc/src/customsortfiltermodel.qdoc @@ -28,7 +28,7 @@ /*! \example itemviews/customsortfiltermodel \title Custom Sort/Filter Model Example - + \ingroup examples-itemviews \brief The Custom Sort/Filter Model example illustrates how to subclass QSortFilterProxyModel to perform advanced sorting and filtering. diff --git a/examples/widgets/doc/src/diagramscene.qdoc b/examples/widgets/doc/src/diagramscene.qdoc index 9b94ca2ab1..4ad74cfee9 100644 --- a/examples/widgets/doc/src/diagramscene.qdoc +++ b/examples/widgets/doc/src/diagramscene.qdoc @@ -28,8 +28,8 @@ /*! \example graphicsview/diagramscene \title Diagram Scene Example - - \brief This example shows use of Qt's graphics framework. + \ingroup examples-graphicsview + \brief Demonstrate how to use the Graphics View framework \image diagramscene.png diff --git a/examples/widgets/doc/src/dirview.qdoc b/examples/widgets/doc/src/dirview.qdoc index 8f860fd036..5deabcbb19 100644 --- a/examples/widgets/doc/src/dirview.qdoc +++ b/examples/widgets/doc/src/dirview.qdoc @@ -28,6 +28,8 @@ /*! \example itemviews/dirview \title Dir View Example + \ingroup examples-itemviews + \brief This example demonstrates the usage of a tree view. \brief The Dir View example shows a tree view onto the local filing system. It uses the QDirModel class to provide file and directory information. diff --git a/examples/widgets/doc/src/dockwidgets.qdoc b/examples/widgets/doc/src/dockwidgets.qdoc index 8f83c80417..88dc146c7e 100644 --- a/examples/widgets/doc/src/dockwidgets.qdoc +++ b/examples/widgets/doc/src/dockwidgets.qdoc @@ -28,6 +28,7 @@ /*! \example mainwindows/dockwidgets \title Dock Widgets Example + \ingroup examples-mainwindow \brief The Dock Widgets example shows how to add dock windows to an application. It also shows how to use Qt's rich text engine. diff --git a/examples/widgets/doc/src/dragdroprobot.qdoc b/examples/widgets/doc/src/dragdroprobot.qdoc index cc5e6bd07d..f58f3cfdf2 100644 --- a/examples/widgets/doc/src/dragdroprobot.qdoc +++ b/examples/widgets/doc/src/dragdroprobot.qdoc @@ -28,8 +28,10 @@ /*! \example graphicsview/dragdroprobot \title Drag and Drop Robot Example + \ingroup examples-graphicsview + \brief Demonstrates how to drag and drop items in a graphics view - \brief The Drag and Drop Robot example shows how to implement Drag and Drop in a + The Drag and Drop Robot example shows how to implement Drag and Drop in a QGraphicsItem subclass, as well as how to animate items using Qt's \l{Animation Framework}. diff --git a/examples/widgets/doc/src/editabletreemodel.qdoc b/examples/widgets/doc/src/editabletreemodel.qdoc index fa72b77506..8c4c7cb89c 100644 --- a/examples/widgets/doc/src/editabletreemodel.qdoc +++ b/examples/widgets/doc/src/editabletreemodel.qdoc @@ -28,7 +28,7 @@ /*! \example itemviews/editabletreemodel \title Editable Tree Model Example - + \ingroup examples-itemviews \brief This example shows how to implement a simple item-based tree model that can be used with other classes the model/view framework. diff --git a/examples/widgets/doc/src/elasticnodes.qdoc b/examples/widgets/doc/src/elasticnodes.qdoc index 2c081613bc..bfca70d2f1 100644 --- a/examples/widgets/doc/src/elasticnodes.qdoc +++ b/examples/widgets/doc/src/elasticnodes.qdoc @@ -28,8 +28,10 @@ /*! \example graphicsview/elasticnodes \title Elastic Nodes Example + \ingroup examples-graphicsview + \brief Demonstrates how to interact with graphical items in a scene - \brief The Elastic Nodes example shows how to implement edges between nodes in a + The Elastic Nodes example shows how to implement edges between nodes in a graph, with basic interaction. You can click to drag a node around, and zoom in and out using the mouse wheel or the keyboard. Hitting the space bar will randomize the nodes. The example is also resolution independent; diff --git a/examples/widgets/doc/src/embeddeddialogs.qdoc b/examples/widgets/doc/src/embeddeddialogs.qdoc index 878bb9f54a..34e800d75a 100644 --- a/examples/widgets/doc/src/embeddeddialogs.qdoc +++ b/examples/widgets/doc/src/embeddeddialogs.qdoc @@ -28,8 +28,10 @@ /*! \example graphicsview/embeddeddialogs \title Embedded Dialogs + \ingroup examples-graphicsview-layout + \brief Demonstrates how to embed dialogs into a graphics view - \brief This example shows how to embed standard dialogs into + This example shows how to embed standard dialogs into Graphics View. It also shows how you can customize the proxy class and add window shadows. diff --git a/examples/widgets/doc/src/extension.qdoc b/examples/widgets/doc/src/extension.qdoc index 0ba1d0738e..423a829167 100644 --- a/examples/widgets/doc/src/extension.qdoc +++ b/examples/widgets/doc/src/extension.qdoc @@ -28,6 +28,7 @@ /*! \example dialogs/extension \title Extension Example + \ingroup examples-dialogs \brief The Extension example shows how to add an extension to a QDialog using the QAbstractButton::toggled() signal and the diff --git a/examples/widgets/doc/src/fademessage.qdoc b/examples/widgets/doc/src/fademessage.qdoc index e50f434e56..dcd429521d 100644 --- a/examples/widgets/doc/src/fademessage.qdoc +++ b/examples/widgets/doc/src/fademessage.qdoc @@ -28,8 +28,10 @@ /*! \example effects/fademessage \title Fade Message Effect Example + \ingroup examples-graphicsview-graphicseffects + \brief Demonstrates how to appliy effects on items in the view - \div { style="text-align: center"} + \div { style="text-align: left"} \inlineimage fademessageeffect-example.png \inlineimage fademessageeffect-example-faded.png \enddiv diff --git a/examples/widgets/doc/src/fetchmore.qdoc b/examples/widgets/doc/src/fetchmore.qdoc index 8e3ec973aa..2c9c5d5b3b 100644 --- a/examples/widgets/doc/src/fetchmore.qdoc +++ b/examples/widgets/doc/src/fetchmore.qdoc @@ -28,7 +28,7 @@ /*! \example itemviews/fetchmore \title Fetch More Example - + \ingroup examples-itemviews \brief The Fetch More example shows how two add items to an item view model on demand. diff --git a/examples/widgets/doc/src/findfiles.qdoc b/examples/widgets/doc/src/findfiles.qdoc index 27d0cacade..61dbf05581 100644 --- a/examples/widgets/doc/src/findfiles.qdoc +++ b/examples/widgets/doc/src/findfiles.qdoc @@ -28,6 +28,7 @@ /*! \example dialogs/findfiles \title Find Files Example + \ingroup examples-dialogs \brief The Find Files example shows how to use QProgressDialog to provide feedback on the progress of a slow operation. The example also diff --git a/examples/widgets/doc/src/fridgemagnets.qdoc b/examples/widgets/doc/src/fridgemagnets.qdoc index b53c94f0bd..8e0732f7dd 100644 --- a/examples/widgets/doc/src/fridgemagnets.qdoc +++ b/examples/widgets/doc/src/fridgemagnets.qdoc @@ -176,7 +176,7 @@ handler, where drag and drop operations begin: \snippet draganddrop/fridgemagnets/dragwidget.cpp 13 - \snippet examples/draganddrop/fridgemagnets/dragwidget.cpp 14 + \snippet draganddrop/fridgemagnets/dragwidget.cpp 14 Mouse events occur when a mouse button is pressed or released inside a widget, or when the mouse cursor is moved. By diff --git a/examples/widgets/doc/src/frozencolumn.qdoc b/examples/widgets/doc/src/frozencolumn.qdoc index 69e45de6df..39fe04c7bf 100644 --- a/examples/widgets/doc/src/frozencolumn.qdoc +++ b/examples/widgets/doc/src/frozencolumn.qdoc @@ -28,7 +28,7 @@ /*! \example itemviews/frozencolumn \title Frozen Column Example - + \ingroup examples-itemviews \brief This example demonstrates how to freeze a column within a QTableView. \image frozencolumn-example.png "Screenshot of the example" diff --git a/examples/widgets/doc/src/graphicsview-anchorlayout.qdoc b/examples/widgets/doc/src/graphicsview-anchorlayout.qdoc new file mode 100644 index 0000000000..98c0958918 --- /dev/null +++ b/examples/widgets/doc/src/graphicsview-anchorlayout.qdoc @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example graphicsview/anchorlayout + \title Anchor Layout Example + \ingroup examples-graphicsview-layout + \brief Demonstrates anchor layout in a graphics view scene + + The Anchor Layout example demonstrates the use of the QGraphicsAnchorLayout + class. + + \image graphicsanchorlayout-example.png +*/ diff --git a/examples/widgets/doc/src/graphicsview-flowlayout.qdoc b/examples/widgets/doc/src/graphicsview-flowlayout.qdoc new file mode 100644 index 0000000000..52d97164c3 --- /dev/null +++ b/examples/widgets/doc/src/graphicsview-flowlayout.qdoc @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example graphicsview/flowlayout + \title Graphics View Flow Layout Example + \ingroup examples-graphicsview-layout + \brief Demonstrates flow layout on a graphics view scene. + + The Graphics View Flow Layout example shows the use of a flow layout + in a Graphics View widget. + + \image graphicsflowlayout-example.png + + See the \l{Flow Layout Example} for a corresponding widget-based example. +*/ diff --git a/examples/widgets/doc/src/graphicsview-simpleanchorlayout.qdoc b/examples/widgets/doc/src/graphicsview-simpleanchorlayout.qdoc new file mode 100644 index 0000000000..480c7c4e0c --- /dev/null +++ b/examples/widgets/doc/src/graphicsview-simpleanchorlayout.qdoc @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example graphicsview/simpleanchorlayout + \title Simple Anchor Layout Example + \ingroup examples-graphicsview-layout + \brief Demonstrates anchor layout on a graphics view scene + + The Simple Anchor Layout example shows the basic use of the + QGraphicsAnchorLayout class. + + \image graphicssimpleanchorlayout-example.png +*/ diff --git a/examples/widgets/doc/src/graphicsview-weatheranchorlayout.qdoc b/examples/widgets/doc/src/graphicsview-weatheranchorlayout.qdoc new file mode 100644 index 0000000000..88a5c60fb5 --- /dev/null +++ b/examples/widgets/doc/src/graphicsview-weatheranchorlayout.qdoc @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example graphicsview/weatheranchorlayout + \title Weather Anchor Layout Example + \ingroup examples-graphicsview-layout + \brief Demonstrates anchor layout on a graphics view scene + + The Weather Anchor Layout example shows more complex use of the + QGraphicsAnchorLayout class to create a real-world window layout. + + \image weatheranchorlayout-example.png +*/ diff --git a/examples/widgets/doc/src/interview.qdoc b/examples/widgets/doc/src/interview.qdoc index 788af64f64..6528bef7d4 100644 --- a/examples/widgets/doc/src/interview.qdoc +++ b/examples/widgets/doc/src/interview.qdoc @@ -28,6 +28,8 @@ /*! \example itemviews/interview \title Interview + \ingroup examples-itemviews + \brief This example demonstrates the usage of the model/view framework. \brief The Interview example explores the flexibility and scalability of the model/view framework by presenting an infinitely deep data structure using a model diff --git a/examples/widgets/doc/src/itemviewspuzzle.qdoc b/examples/widgets/doc/src/itemviewspuzzle.qdoc index 68cbdc936d..2e37cd372c 100644 --- a/examples/widgets/doc/src/itemviewspuzzle.qdoc +++ b/examples/widgets/doc/src/itemviewspuzzle.qdoc @@ -28,7 +28,7 @@ /*! \example itemviews/puzzle \title Item Views Puzzle Example - + \ingroup examples-itemviews \brief The Puzzle example shows how to enable drag and drop with a custom model to allow items to be transferred between a view and another widget. diff --git a/examples/widgets/doc/src/licensewizard.qdoc b/examples/widgets/doc/src/licensewizard.qdoc index aee60e11fe..e45c162f29 100644 --- a/examples/widgets/doc/src/licensewizard.qdoc +++ b/examples/widgets/doc/src/licensewizard.qdoc @@ -28,6 +28,7 @@ /*! \example dialogs/licensewizard \title License Wizard Example + \ingroup examples-dialogs \brief The License Wizard example shows how to implement complex wizards in Qt. diff --git a/examples/widgets/doc/src/lighting.qdoc b/examples/widgets/doc/src/lighting.qdoc index e457d20ada..e519bacb91 100644 --- a/examples/widgets/doc/src/lighting.qdoc +++ b/examples/widgets/doc/src/lighting.qdoc @@ -28,6 +28,8 @@ /*! \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/doc/src/mainwindow.qdoc b/examples/widgets/doc/src/mainwindow.qdoc index 313b8cbc10..a0a7a43ee0 100644 --- a/examples/widgets/doc/src/mainwindow.qdoc +++ b/examples/widgets/doc/src/mainwindow.qdoc @@ -28,6 +28,7 @@ /*! \example mainwindows/mainwindow \title Main Window + \ingroup examples-mainwindow \brief The Main Window example shows Qt's extensive support for tool bars, dock windows, menus, and other standard application features. diff --git a/examples/widgets/doc/src/mdi.qdoc b/examples/widgets/doc/src/mdi.qdoc index e6b5eef4b4..fc1835c727 100644 --- a/examples/widgets/doc/src/mdi.qdoc +++ b/examples/widgets/doc/src/mdi.qdoc @@ -28,6 +28,7 @@ /*! \example mainwindows/mdi \title MDI Example + \ingroup examples-mainwindow \brief The MDI example shows how to implement a Multiple Document Interface using Qt's QMdiArea class. diff --git a/examples/widgets/doc/src/menus.qdoc b/examples/widgets/doc/src/menus.qdoc index 3b0c6079ab..09a43a1a45 100644 --- a/examples/widgets/doc/src/menus.qdoc +++ b/examples/widgets/doc/src/menus.qdoc @@ -28,6 +28,7 @@ /*! \example mainwindows/menus \title Menus Example + \ingroup examples-mainwindow \brief The Menus example demonstrates how menus can be used in a main window application. diff --git a/examples/widgets/doc/src/padnavigator.qdoc b/examples/widgets/doc/src/padnavigator.qdoc index b063d6de59..7b5e54e5ff 100644 --- a/examples/widgets/doc/src/padnavigator.qdoc +++ b/examples/widgets/doc/src/padnavigator.qdoc @@ -28,8 +28,10 @@ /*! \example graphicsview/padnavigator \title Pad Navigator Example + \ingroup examples-graphicsview + \brief Demonstrates how to create animated user interface - \brief The Pad Navigator Example shows how you can use Graphics View together with + The Pad Navigator Example shows how you can use Graphics View together with embedded widgets and Qt's \l{State Machine Framework} to create a simple but useful, dynamic, animated user interface. diff --git a/examples/widgets/doc/src/pixelator.qdoc b/examples/widgets/doc/src/pixelator.qdoc index 9eddcd9f11..ebcee4e5f9 100644 --- a/examples/widgets/doc/src/pixelator.qdoc +++ b/examples/widgets/doc/src/pixelator.qdoc @@ -28,7 +28,7 @@ /*! \example itemviews/pixelator \title Pixelator Example - + \ingroup examples-itemviews \brief The Pixelator example shows how delegates can be used to customize the way that items are rendered in standard item views. diff --git a/examples/widgets/doc/src/plugandpaint.qdoc b/examples/widgets/doc/src/plugandpaint.qdoc index 88433a5e2f..cf068e92c3 100644 --- a/examples/widgets/doc/src/plugandpaint.qdoc +++ b/examples/widgets/doc/src/plugandpaint.qdoc @@ -48,7 +48,7 @@ through plugins, we recommend that you start by reading this overview, which explains how to make an application use plugins. Afterward, you can read the - \l{plugandpaintplugins/basictools}{Basic Tools} and + \l{tools/plugandpaintplugins/basictools}{Basic Tools} and \l{plugandpaintplugins/extrafilters}{Extra Filters} overviews, which show how to implement static and dynamic plugins, respectively. @@ -287,7 +287,7 @@ \snippet tools/plugandpaint/main.cpp 0 The argument to Q_IMPORT_PLUGIN() is the plugin's name, as - specified with Q_EXPORT_PLUGIN2() in the \l{Exporting the + specified with Q_PLUGIN_METADATA() in the \l{Exporting the Plugin}{plugin}. In the \c .pro file, we need to specify the static library. @@ -324,7 +324,7 @@ \list 1 \li Declare a plugin class. \li Implement the interfaces provided by the plugin. - \li Export the plugin using the Q_EXPORT_PLUGIN2() macro. + \li Export the plugin using the Q_PLUGIN_METADATA() macro. \li Build the plugin using an adequate \c .pro file. \endlist @@ -346,6 +346,8 @@ interfaces. Without the \c Q_INTERFACES() macro, we couldn't use \l qobject_cast() in the \l{plugandpaint}{Plug & Paint} application to detect interfaces. + For an explanation for the \c Q_PLUGIN_METADATA() macro see + \l {Exporting the Plugin}. \snippet tools/plugandpaintplugins/basictools/basictoolsplugin.h 2 @@ -440,15 +442,20 @@ \section1 Exporting the Plugin - Whereas applications have a \c main() function as their entry - point, plugins need to contain exactly one occurrence of the - Q_EXPORT_PLUGIN2() macro to specify which class provides the - plugin: + To finally export your plugin you just have to add the + \c Q_PLUGIN_METADATA() macro right next to the \c Q_OBJECT() macro + into the header file of the plugin. + It must contain the plugins IID and optionally a filename pointing + to a json file containing the metadata for the plugin. + + \snippet tools/plugandpaintplugins/basictools/basictoolsplugin.h 4 - \snippet tools/plugandpaintplugins/basictools/basictoolsplugin.cpp 9 + Within this example the json file does not need to export any metadata, + so it just contains an empty json object. - This line may appear in any \c .cpp file that is part of the - plugin's source code. + \code + {} + \endcode \section1 The .pro File diff --git a/examples/widgets/doc/src/recentfiles.qdoc b/examples/widgets/doc/src/recentfiles.qdoc index 722e32f8cd..01a6975828 100644 --- a/examples/widgets/doc/src/recentfiles.qdoc +++ b/examples/widgets/doc/src/recentfiles.qdoc @@ -28,6 +28,7 @@ /*! \example mainwindows/recentfiles \title Recent Files Example + \ingroup examples-mainwindow \brief The Recent Files example shows how a standard File menu can be extended to show the most recent files loaded by a main window application. diff --git a/examples/widgets/doc/src/sdi.qdoc b/examples/widgets/doc/src/sdi.qdoc index 379f28dc08..b163930530 100644 --- a/examples/widgets/doc/src/sdi.qdoc +++ b/examples/widgets/doc/src/sdi.qdoc @@ -28,6 +28,7 @@ /*! \example mainwindows/sdi \title SDI Example + \ingroup examples-mainwindow \brief The SDI example shows how to create a Single Document Interface. It uses a number of top-level windows to display the contents of different text files. diff --git a/examples/widgets/doc/src/simpledommodel.qdoc b/examples/widgets/doc/src/simpledommodel.qdoc index 99df1e46ca..c48563f47c 100644 --- a/examples/widgets/doc/src/simpledommodel.qdoc +++ b/examples/widgets/doc/src/simpledommodel.qdoc @@ -28,7 +28,7 @@ /*! \example itemviews/simpledommodel \title Simple DOM Model Example - + \ingroup examples-itemviews \brief The Simple DOM Model example shows how an existing class can be adapted for use with the model/view framework. diff --git a/examples/widgets/doc/src/simpletreemodel.qdoc b/examples/widgets/doc/src/simpletreemodel.qdoc index 2b8884d5ca..df23617d5d 100644 --- a/examples/widgets/doc/src/simpletreemodel.qdoc +++ b/examples/widgets/doc/src/simpletreemodel.qdoc @@ -28,6 +28,9 @@ /*! \example itemviews/simpletreemodel \title Simple Tree Model Example + \ingroup examples-itemviews + \brief The Simple Tree Model example shows how to use a hierarchical model + with Qt's standard view classes. \brief The Simple Tree Model example shows how to create a basic, read-only hierarchical model to use with Qt's standard view classes. For a diff --git a/examples/widgets/doc/src/simplewidgetmapper.qdoc b/examples/widgets/doc/src/simplewidgetmapper.qdoc index ca5e47e13c..3e827a4a41 100644 --- a/examples/widgets/doc/src/simplewidgetmapper.qdoc +++ b/examples/widgets/doc/src/simplewidgetmapper.qdoc @@ -28,7 +28,7 @@ /*! \example itemviews/simplewidgetmapper \title Simple Widget Mapper Example - + \ingroup examples-itemviews \brief The Simple Widget Mapper example shows how to use a widget mapper to display data from a model in a collection of widgets. diff --git a/examples/widgets/doc/src/spinboxdelegate.qdoc b/examples/widgets/doc/src/spinboxdelegate.qdoc index f2add32286..3941afa95a 100644 --- a/examples/widgets/doc/src/spinboxdelegate.qdoc +++ b/examples/widgets/doc/src/spinboxdelegate.qdoc @@ -28,7 +28,7 @@ /*! \example itemviews/spinboxdelegate \title Spin Box Delegate Example - + \ingroup examples-itemviews \brief The Spin Box Delegate example shows how to create an editor for a custom delegate in the model/view framework by reusing a standard Qt editor widget. diff --git a/examples/widgets/doc/src/spreadsheet.qdoc b/examples/widgets/doc/src/spreadsheet.qdoc index cd94e08cec..a869c7dbe7 100644 --- a/examples/widgets/doc/src/spreadsheet.qdoc +++ b/examples/widgets/doc/src/spreadsheet.qdoc @@ -28,6 +28,8 @@ /*! \example itemviews/spreadsheet \title Spreadsheet + \ingroup examples-itemviews + \brief The Spreadsheet example shows how to create a simple spreadsheet application. \brief The Spreadsheet example shows how a table view can be used to create a simple spreadsheet application. Custom delegates are used to render different diff --git a/examples/widgets/doc/src/standarddialogs.qdoc b/examples/widgets/doc/src/standarddialogs.qdoc index f9d9372a70..4b39ac64c5 100644 --- a/examples/widgets/doc/src/standarddialogs.qdoc +++ b/examples/widgets/doc/src/standarddialogs.qdoc @@ -28,6 +28,7 @@ /*! \example dialogs/standarddialogs \title Standard Dialogs Example + \ingroup examples-dialogs \brief The Standard Dialogs example shows the standard dialogs that are provided by Qt. diff --git a/examples/widgets/doc/src/stardelegate.qdoc b/examples/widgets/doc/src/stardelegate.qdoc index 38e4cdfe22..f3da875422 100644 --- a/examples/widgets/doc/src/stardelegate.qdoc +++ b/examples/widgets/doc/src/stardelegate.qdoc @@ -28,7 +28,7 @@ /*! \example itemviews/stardelegate \title Star Delegate Example - + \ingroup examples-itemviews \brief The Star Delegate example shows how to create a delegate that can paint itself and that supports editing. diff --git a/examples/widgets/doc/src/tabdialog.qdoc b/examples/widgets/doc/src/tabdialog.qdoc index e2ac57550f..b3e74389af 100644 --- a/examples/widgets/doc/src/tabdialog.qdoc +++ b/examples/widgets/doc/src/tabdialog.qdoc @@ -28,6 +28,7 @@ /*! \example dialogs/tabdialog \title Tab Dialog Example + \ingroup examples-dialogs \brief The Tab Dialog example shows how to construct a tab dialog using the QTabWidget class. diff --git a/examples/widgets/doc/src/trivialwizard.qdoc b/examples/widgets/doc/src/trivialwizard.qdoc index c67bb09c0d..4ccee9a625 100644 --- a/examples/widgets/doc/src/trivialwizard.qdoc +++ b/examples/widgets/doc/src/trivialwizard.qdoc @@ -28,6 +28,7 @@ /*! \example dialogs/trivialwizard \title Trivial Wizard Example + \ingroup examples-dialogs \brief The Trivial Wizard example illustrates how to create a linear three-page registration wizard using three instances of QWizardPage and one instance diff --git a/examples/widgets/draganddrop/draganddrop.pro b/examples/widgets/draganddrop/draganddrop.pro index 3f2691a516..098651d2f6 100644 --- a/examples/widgets/draganddrop/draganddrop.pro +++ b/examples/widgets/draganddrop/draganddrop.pro @@ -6,4 +6,3 @@ SUBDIRS = draggableicons \ puzzle wince*: SUBDIRS -= dropsite -QT += widgets diff --git a/examples/widgets/draganddrop/draggableicons/draggableicons.pro b/examples/widgets/draganddrop/draggableicons/draggableicons.pro index 194814a8c8..f87ec4ad60 100644 --- a/examples/widgets/draganddrop/draggableicons/draggableicons.pro +++ b/examples/widgets/draganddrop/draggableicons/draggableicons.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = dragwidget.h RESOURCES = draggableicons.qrc SOURCES = dragwidget.cpp \ @@ -6,5 +8,3 @@ SOURCES = dragwidget.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/draganddrop/draggableicons INSTALLS += target - -QT += widgets diff --git a/examples/widgets/draganddrop/draggabletext/draggabletext.pro b/examples/widgets/draganddrop/draggabletext/draggabletext.pro index 1eb579a2bd..2815be1613 100644 --- a/examples/widgets/draganddrop/draggabletext/draggabletext.pro +++ b/examples/widgets/draganddrop/draggabletext/draggabletext.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = draglabel.h \ dragwidget.h RESOURCES = draggabletext.qrc @@ -8,6 +10,3 @@ SOURCES = draglabel.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/draganddrop/draggabletext INSTALLS += target - -QT += widgets - diff --git a/examples/widgets/draganddrop/dropsite/dropsite.pro b/examples/widgets/draganddrop/dropsite/dropsite.pro index 008030be85..9496cc4940 100644 --- a/examples/widgets/draganddrop/dropsite/dropsite.pro +++ b/examples/widgets/draganddrop/dropsite/dropsite.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = droparea.h \ dropsitewindow.h SOURCES = droparea.cpp \ @@ -8,5 +10,4 @@ SOURCES = droparea.cpp \ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/draganddrop/dropsite INSTALLS += target -QT += widgets simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/draganddrop/fridgemagnets/fridgemagnets.pro b/examples/widgets/draganddrop/fridgemagnets/fridgemagnets.pro index 350dee6561..2c3165d1c5 100644 --- a/examples/widgets/draganddrop/fridgemagnets/fridgemagnets.pro +++ b/examples/widgets/draganddrop/fridgemagnets/fridgemagnets.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = draglabel.h \ dragwidget.h RESOURCES = fridgemagnets.qrc @@ -8,6 +10,3 @@ SOURCES = draglabel.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/draganddrop/fridgemagnets INSTALLS += target - -QT += widgets - diff --git a/examples/widgets/draganddrop/puzzle/puzzle.pro b/examples/widgets/draganddrop/puzzle/puzzle.pro index 4d85778073..95008fc29b 100644 --- a/examples/widgets/draganddrop/puzzle/puzzle.pro +++ b/examples/widgets/draganddrop/puzzle/puzzle.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = mainwindow.h \ pieceslist.h \ puzzlewidget.h @@ -18,4 +20,3 @@ wince*: { addFile.path = . DEPLOYMENT += addFile } -QT += widgets diff --git a/examples/widgets/effects/blurpicker/blurpicker.pro b/examples/widgets/effects/blurpicker/blurpicker.pro index 1d232190ac..c570ac3b98 100644 --- a/examples/widgets/effects/blurpicker/blurpicker.pro +++ b/examples/widgets/effects/blurpicker/blurpicker.pro @@ -1,3 +1,5 @@ +QT += widgets + SOURCES += main.cpp blurpicker.cpp blureffect.cpp HEADERS += blurpicker.h blureffect.h RESOURCES += blurpicker.qrc @@ -5,5 +7,3 @@ RESOURCES += blurpicker.qrc # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/effects/blurpicker INSTALLS += target -QT += widgets - diff --git a/examples/widgets/effects/effects.pro b/examples/widgets/effects/effects.pro index ee3d655815..795e0508ac 100644 --- a/examples/widgets/effects/effects.pro +++ b/examples/widgets/effects/effects.pro @@ -4,5 +4,3 @@ SUBDIRS = \ blurpicker \ lighting \ fademessage - -QT += widgets diff --git a/examples/widgets/effects/fademessage/fademessage.pro b/examples/widgets/effects/fademessage/fademessage.pro index ff860af4f1..727181e1a1 100644 --- a/examples/widgets/effects/fademessage/fademessage.pro +++ b/examples/widgets/effects/fademessage/fademessage.pro @@ -1,3 +1,5 @@ +QT += widgets + SOURCES += main.cpp fademessage.cpp HEADERS += fademessage.h RESOURCES += fademessage.qrc @@ -6,5 +8,4 @@ RESOURCES += fademessage.qrc target.path = $$[QT_INSTALL_EXAMPLES]/widgets/effects/fademessage INSTALLS += target -QT += widgets simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/effects/lighting/lighting.pro b/examples/widgets/effects/lighting/lighting.pro index 5450b62093..0a3b397de5 100644 --- a/examples/widgets/effects/lighting/lighting.pro +++ b/examples/widgets/effects/lighting/lighting.pro @@ -1,9 +1,8 @@ +QT += widgets + SOURCES += main.cpp lighting.cpp HEADERS += lighting.h # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/effects/lighting INSTALLS += target -QT += widgets - - diff --git a/examples/widgets/graphicsview/anchorlayout/anchorlayout.pro b/examples/widgets/graphicsview/anchorlayout/anchorlayout.pro index bc396226c8..fbfeaac049 100644 --- a/examples/widgets/graphicsview/anchorlayout/anchorlayout.pro +++ b/examples/widgets/graphicsview/anchorlayout/anchorlayout.pro @@ -1,11 +1,11 @@ +TARGET = anchorlayout + +QT += widgets + SOURCES = main.cpp # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/graphicsview/anchorlayout INSTALLS += target -TARGET = anchorlayout -QT += widgets - - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/graphicsview/basicgraphicslayouts/basicgraphicslayouts.pro b/examples/widgets/graphicsview/basicgraphicslayouts/basicgraphicslayouts.pro index 59abd2b405..46fce9b97a 100644 --- a/examples/widgets/graphicsview/basicgraphicslayouts/basicgraphicslayouts.pro +++ b/examples/widgets/graphicsview/basicgraphicslayouts/basicgraphicslayouts.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = layoutitem.h \ window.h SOURCES = layoutitem.cpp \ @@ -8,5 +10,3 @@ RESOURCES = basicgraphicslayouts.qrc # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/graphicsview/basicgraphicslayouts INSTALLS += target - -QT += widgets diff --git a/examples/widgets/graphicsview/chip/chip.pro b/examples/widgets/graphicsview/chip/chip.pro index 8e3d91f38e..a46f07ce35 100644 --- a/examples/widgets/graphicsview/chip/chip.pro +++ b/examples/widgets/graphicsview/chip/chip.pro @@ -5,8 +5,8 @@ SOURCES += main.cpp SOURCES += mainwindow.cpp view.cpp chip.cpp QT += widgets -!isEmpty(QT.printsupport.name): QT += printsupport -contains(QT_CONFIG, opengl):QT += opengl +qtHaveModule(printsupport): QT += printsupport +qtHaveModule(opengl): QT += opengl build_all:!build_pass { CONFIG -= build_all diff --git a/examples/widgets/graphicsview/chip/view.cpp b/examples/widgets/graphicsview/chip/view.cpp index cb83175744..4b7e6c2ed8 100644 --- a/examples/widgets/graphicsview/chip/view.cpp +++ b/examples/widgets/graphicsview/chip/view.cpp @@ -50,6 +50,7 @@ #endif #include <qmath.h> +#ifndef QT_NO_WHEELEVENT void GraphicsView::wheelEvent(QWheelEvent *e) { if (e->modifiers() & Qt::ControlModifier) { @@ -62,6 +63,7 @@ void GraphicsView::wheelEvent(QWheelEvent *e) QGraphicsView::wheelEvent(e); } } +#endif View::View(const QString &name, QWidget *parent) : QFrame(parent) diff --git a/examples/widgets/graphicsview/chip/view.h b/examples/widgets/graphicsview/chip/view.h index b6cdc41200..90e0951716 100644 --- a/examples/widgets/graphicsview/chip/view.h +++ b/examples/widgets/graphicsview/chip/view.h @@ -60,7 +60,9 @@ public: GraphicsView(View *v) : QGraphicsView(), view(v) { } protected: +#ifndef QT_NO_WHEELEVENT void wheelEvent(QWheelEvent *); +#endif private: View *view; diff --git a/examples/widgets/graphicsview/collidingmice/collidingmice.pro b/examples/widgets/graphicsview/collidingmice/collidingmice.pro index 0337b6da4a..c96e3dad79 100644 --- a/examples/widgets/graphicsview/collidingmice/collidingmice.pro +++ b/examples/widgets/graphicsview/collidingmice/collidingmice.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS += \ mouse.h SOURCES += \ @@ -10,6 +12,3 @@ RESOURCES += \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/graphicsview/collidingmice INSTALLS += target - -QT += widgets - diff --git a/examples/widgets/graphicsview/diagramscene/diagramscene.pro b/examples/widgets/graphicsview/diagramscene/diagramscene.pro index ac70e7af17..0c769a0f74 100644 --- a/examples/widgets/graphicsview/diagramscene/diagramscene.pro +++ b/examples/widgets/graphicsview/diagramscene/diagramscene.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = mainwindow.h \ diagramitem.h \ diagramscene.h \ @@ -16,6 +18,4 @@ RESOURCES = diagramscene.qrc target.path = $$[QT_INSTALL_EXAMPLES]/widgets/graphicsview/diagramscene INSTALLS += target - -QT += widgets simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/graphicsview/dragdroprobot/dragdroprobot.pro b/examples/widgets/graphicsview/dragdroprobot/dragdroprobot.pro index 4f8cebc755..8e4197c965 100644 --- a/examples/widgets/graphicsview/dragdroprobot/dragdroprobot.pro +++ b/examples/widgets/graphicsview/dragdroprobot/dragdroprobot.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS += \ coloritem.h \ robot.h @@ -15,6 +17,4 @@ RESOURCES += \ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/graphicsview/dragdroprobot INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/graphicsview/elasticnodes/elasticnodes.pro b/examples/widgets/graphicsview/elasticnodes/elasticnodes.pro index 71ac21ffe9..419fdad617 100644 --- a/examples/widgets/graphicsview/elasticnodes/elasticnodes.pro +++ b/examples/widgets/graphicsview/elasticnodes/elasticnodes.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS += \ edge.h \ node.h \ @@ -12,5 +14,3 @@ SOURCES += \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/graphicsview/elasticnodes INSTALLS += target - -QT += widgets diff --git a/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp b/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp index 67b6088079..b501a4f3c1 100644 --- a/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp +++ b/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp @@ -174,12 +174,14 @@ void GraphWidget::timerEvent(QTimerEvent *event) } //! [4] +#ifndef QT_NO_WHEELEVENT //! [5] void GraphWidget::wheelEvent(QWheelEvent *event) { scaleView(pow((double)2, -event->delta() / 240.0)); } //! [5] +#endif //! [6] void GraphWidget::drawBackground(QPainter *painter, const QRectF &rect) diff --git a/examples/widgets/graphicsview/elasticnodes/graphwidget.h b/examples/widgets/graphicsview/elasticnodes/graphwidget.h index 064d3bf00a..202c17c204 100644 --- a/examples/widgets/graphicsview/elasticnodes/graphwidget.h +++ b/examples/widgets/graphicsview/elasticnodes/graphwidget.h @@ -63,7 +63,9 @@ public slots: protected: void keyPressEvent(QKeyEvent *event); void timerEvent(QTimerEvent *event); +#ifndef QT_NO_WHEELEVENT void wheelEvent(QWheelEvent *event); +#endif void drawBackground(QPainter *painter, const QRectF &rect); void scaleView(qreal scaleFactor); diff --git a/examples/widgets/graphicsview/embeddeddialogs/embeddeddialogs.pro b/examples/widgets/graphicsview/embeddeddialogs/embeddeddialogs.pro index dd01312788..993a5f22b7 100644 --- a/examples/widgets/graphicsview/embeddeddialogs/embeddeddialogs.pro +++ b/examples/widgets/graphicsview/embeddeddialogs/embeddeddialogs.pro @@ -1,3 +1,5 @@ +QT += widgets + SOURCES += main.cpp SOURCES += customproxy.cpp embeddeddialog.cpp HEADERS += customproxy.h embeddeddialog.h @@ -13,5 +15,3 @@ build_all:!build_pass { # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/graphicsview/embeddeddialogs INSTALLS += target - -QT += widgets diff --git a/examples/widgets/graphicsview/graphicsview.pro b/examples/widgets/graphicsview/graphicsview.pro index f7142709c8..9d6d7a75f6 100644 --- a/examples/widgets/graphicsview/graphicsview.pro +++ b/examples/widgets/graphicsview/graphicsview.pro @@ -15,8 +15,6 @@ SUBDIRS = \ contains(DEFINES, QT_NO_CURSOR)|contains(DEFINES, QT_NO_DRAGANDDROP): SUBDIRS -= dragdroprobot -contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles1):!contains(QT_CONFIG, opengles2):{ +qtHaveModule(opengl):!contains(QT_CONFIG, opengles.) { SUBDIRS += boxes } - -QT += widgets diff --git a/examples/widgets/graphicsview/padnavigator/padnavigator.pro b/examples/widgets/graphicsview/padnavigator/padnavigator.pro index 460cc90219..c2bc79b5cc 100644 --- a/examples/widgets/graphicsview/padnavigator/padnavigator.pro +++ b/examples/widgets/graphicsview/padnavigator/padnavigator.pro @@ -17,7 +17,7 @@ FORMS += \ form.ui QT += widgets -contains(QT_CONFIG, opengl):QT += opengl +qtHaveModule(opengl): QT += opengl # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/graphicsview/padnavigator diff --git a/examples/widgets/graphicsview/simpleanchorlayout/simpleanchorlayout.pro b/examples/widgets/graphicsview/simpleanchorlayout/simpleanchorlayout.pro index c8c992adbe..59e37ff64f 100644 --- a/examples/widgets/graphicsview/simpleanchorlayout/simpleanchorlayout.pro +++ b/examples/widgets/graphicsview/simpleanchorlayout/simpleanchorlayout.pro @@ -1,10 +1,11 @@ +TARGET = simpleanchorlayout + +QT += widgets + SOURCES = main.cpp # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/graphicsview/simpleanchorlayout INSTALLS += target -TARGET = simpleanchorlayout -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/itemviews/addressbook/addressbook.pro b/examples/widgets/itemviews/addressbook/addressbook.pro index 0d421cb3e3..5e2f1bcbbc 100644 --- a/examples/widgets/itemviews/addressbook/addressbook.pro +++ b/examples/widgets/itemviews/addressbook/addressbook.pro @@ -1,3 +1,5 @@ +QT += widgets + SOURCES = adddialog.cpp \ addresswidget.cpp \ main.cpp \ @@ -13,5 +15,3 @@ HEADERS = adddialog.h \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/itemviews/addressbook INSTALLS += target -QT += widgets - diff --git a/examples/widgets/itemviews/basicsortfiltermodel/basicsortfiltermodel.pro b/examples/widgets/itemviews/basicsortfiltermodel/basicsortfiltermodel.pro index 6c0924cf7f..2469a4ef20 100644 --- a/examples/widgets/itemviews/basicsortfiltermodel/basicsortfiltermodel.pro +++ b/examples/widgets/itemviews/basicsortfiltermodel/basicsortfiltermodel.pro @@ -1,10 +1,9 @@ +QT += widgets + HEADERS = window.h SOURCES = main.cpp \ window.cpp -CONFIG += qt # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/itemviews/basicsortfiltermodel INSTALLS += target - -QT += widgets diff --git a/examples/widgets/itemviews/chart/chart.pro b/examples/widgets/itemviews/chart/chart.pro index 927c469e88..caa28276bc 100644 --- a/examples/widgets/itemviews/chart/chart.pro +++ b/examples/widgets/itemviews/chart/chart.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = mainwindow.h \ pieview.h RESOURCES = chart.qrc @@ -9,6 +11,3 @@ unix:!mac:!vxworks:!integrity:LIBS+= -lm # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/itemviews/chart INSTALLS += target - -QT += widgets - diff --git a/examples/widgets/itemviews/coloreditorfactory/coloreditorfactory.pro b/examples/widgets/itemviews/coloreditorfactory/coloreditorfactory.pro index 4c16a6fbc1..82cb264ddd 100644 --- a/examples/widgets/itemviews/coloreditorfactory/coloreditorfactory.pro +++ b/examples/widgets/itemviews/coloreditorfactory/coloreditorfactory.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = colorlisteditor.h \ window.h SOURCES = colorlisteditor.cpp \ @@ -7,6 +9,3 @@ SOURCES = colorlisteditor.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/itemviews/coloreditorfactory INSTALLS += target - -QT += widgets - diff --git a/examples/widgets/itemviews/combowidgetmapper/combowidgetmapper.pro b/examples/widgets/itemviews/combowidgetmapper/combowidgetmapper.pro index a093f88e88..37f82fa5ae 100644 --- a/examples/widgets/itemviews/combowidgetmapper/combowidgetmapper.pro +++ b/examples/widgets/itemviews/combowidgetmapper/combowidgetmapper.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = window.h SOURCES = main.cpp \ window.cpp @@ -5,5 +7,4 @@ SOURCES = main.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/itemviews/combowidgetmapper INSTALLS += target -QT += widgets diff --git a/examples/widgets/itemviews/customsortfiltermodel/customsortfiltermodel.pro b/examples/widgets/itemviews/customsortfiltermodel/customsortfiltermodel.pro index 66ea1063c8..b722e606d3 100644 --- a/examples/widgets/itemviews/customsortfiltermodel/customsortfiltermodel.pro +++ b/examples/widgets/itemviews/customsortfiltermodel/customsortfiltermodel.pro @@ -1,12 +1,11 @@ +QT += widgets + HEADERS = mysortfilterproxymodel.h \ window.h SOURCES = main.cpp \ mysortfilterproxymodel.cpp \ window.cpp -CONFIG += qt # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/itemviews/customsortfiltermodel INSTALLS += target - -QT += widgets diff --git a/examples/widgets/itemviews/dirview/dirview.pro b/examples/widgets/itemviews/dirview/dirview.pro index 0c1cd92a58..511ec0ed98 100644 --- a/examples/widgets/itemviews/dirview/dirview.pro +++ b/examples/widgets/itemviews/dirview/dirview.pro @@ -1,7 +1,7 @@ +QT += widgets + SOURCES = main.cpp # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/itemviews/dirview INSTALLS += target - -QT += widgets diff --git a/examples/widgets/itemviews/editabletreemodel/editabletreemodel.pro b/examples/widgets/itemviews/editabletreemodel/editabletreemodel.pro index fcbdfd997f..a6c1e5563f 100644 --- a/examples/widgets/itemviews/editabletreemodel/editabletreemodel.pro +++ b/examples/widgets/itemviews/editabletreemodel/editabletreemodel.pro @@ -1,3 +1,5 @@ +QT += widgets + FORMS = mainwindow.ui HEADERS = mainwindow.h \ treeitem.h \ @@ -7,10 +9,7 @@ SOURCES = mainwindow.cpp \ treeitem.cpp \ treemodel.cpp \ main.cpp -CONFIG += qt # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/itemviews/editabletreemodel INSTALLS += target - -QT += widgets diff --git a/examples/widgets/itemviews/fetchmore/fetchmore.pro b/examples/widgets/itemviews/fetchmore/fetchmore.pro index 67006de9c7..eb4275da19 100644 --- a/examples/widgets/itemviews/fetchmore/fetchmore.pro +++ b/examples/widgets/itemviews/fetchmore/fetchmore.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = filelistmodel.h \ window.h SOURCES = filelistmodel.cpp \ @@ -7,5 +9,3 @@ SOURCES = filelistmodel.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/itemviews/fetchmore INSTALLS += target - -QT += widgets diff --git a/examples/widgets/itemviews/frozencolumn/frozencolumn.pro b/examples/widgets/itemviews/frozencolumn/frozencolumn.pro index 00247b71c7..717ba40a9d 100644 --- a/examples/widgets/itemviews/frozencolumn/frozencolumn.pro +++ b/examples/widgets/itemviews/frozencolumn/frozencolumn.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS += freezetablewidget.h SOURCES += main.cpp freezetablewidget.cpp RESOURCES += grades.qrc @@ -5,5 +7,4 @@ RESOURCES += grades.qrc # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/itemviews/frozencolumn INSTALLS += target -QT += widgets diff --git a/examples/widgets/itemviews/interview/interview.pro b/examples/widgets/itemviews/interview/interview.pro index 08dd9b991e..0e480e939c 100644 --- a/examples/widgets/itemviews/interview/interview.pro +++ b/examples/widgets/itemviews/interview/interview.pro @@ -1,6 +1,6 @@ TEMPLATE = app +QT += widgets -CONFIG += qt warn_on HEADERS += model.h SOURCES += model.cpp main.cpp RESOURCES += interview.qrc @@ -13,5 +13,3 @@ build_all:!build_pass { # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/itemviews/interview INSTALLS += target - -QT += widgets diff --git a/examples/widgets/itemviews/itemviews.pro b/examples/widgets/itemviews/itemviews.pro index 60512e2b66..5d5eef1b0f 100644 --- a/examples/widgets/itemviews/itemviews.pro +++ b/examples/widgets/itemviews/itemviews.pro @@ -18,5 +18,4 @@ SUBDIRS = addressbook \ spinboxdelegate \ spreadsheet \ stardelegate - -QT += widgets +contains(DEFINES, QT_NO_DRAGANDDROP): SUBDIRS -= puzzle diff --git a/examples/widgets/itemviews/pixelator/pixelator.pro b/examples/widgets/itemviews/pixelator/pixelator.pro index 37e54f937a..35176a6026 100644 --- a/examples/widgets/itemviews/pixelator/pixelator.pro +++ b/examples/widgets/itemviews/pixelator/pixelator.pro @@ -1,3 +1,6 @@ +QT += widgets +qtHaveModule(printsupport): QT += printsupport + HEADERS = imagemodel.h \ mainwindow.h \ pixeldelegate.h @@ -10,6 +13,3 @@ RESOURCES += images.qrc # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/itemviews/pixelator INSTALLS += target - -QT += widgets -!isEmpty(QT.printsupport.name): QT += printsupport diff --git a/examples/widgets/itemviews/puzzle/puzzle.pro b/examples/widgets/itemviews/puzzle/puzzle.pro index a05ad83f79..a5379293ff 100644 --- a/examples/widgets/itemviews/puzzle/puzzle.pro +++ b/examples/widgets/itemviews/puzzle/puzzle.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = mainwindow.h \ piecesmodel.h \ puzzlewidget.h @@ -15,6 +17,3 @@ INSTALLS += target wince* { DEPLOYMENT_PLUGIN += qjpeg qgif } - -QT += widgets - diff --git a/examples/widgets/itemviews/simpledommodel/simpledommodel.pro b/examples/widgets/itemviews/simpledommodel/simpledommodel.pro index e52ea4f71e..db15632ba9 100644 --- a/examples/widgets/itemviews/simpledommodel/simpledommodel.pro +++ b/examples/widgets/itemviews/simpledommodel/simpledommodel.pro @@ -5,7 +5,6 @@ SOURCES = domitem.cpp \ dommodel.cpp \ main.cpp \ mainwindow.cpp -CONFIG += qt QT += xml widgets # install diff --git a/examples/widgets/itemviews/simpletreemodel/simpletreemodel.pro b/examples/widgets/itemviews/simpletreemodel/simpletreemodel.pro index 289939fb2f..82484c9971 100644 --- a/examples/widgets/itemviews/simpletreemodel/simpletreemodel.pro +++ b/examples/widgets/itemviews/simpletreemodel/simpletreemodel.pro @@ -1,13 +1,12 @@ +QT += widgets + HEADERS = treeitem.h \ treemodel.h RESOURCES = simpletreemodel.qrc SOURCES = treeitem.cpp \ treemodel.cpp \ main.cpp -CONFIG += qt # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/itemviews/simpletreemodel INSTALLS += target - -QT += widgets diff --git a/examples/widgets/itemviews/simplewidgetmapper/simplewidgetmapper.pro b/examples/widgets/itemviews/simplewidgetmapper/simplewidgetmapper.pro index c19cb0eef8..1d5cca3f01 100644 --- a/examples/widgets/itemviews/simplewidgetmapper/simplewidgetmapper.pro +++ b/examples/widgets/itemviews/simplewidgetmapper/simplewidgetmapper.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = window.h SOURCES = main.cpp \ window.cpp @@ -5,5 +7,3 @@ SOURCES = main.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/itemviews/simplewidgetmapper INSTALLS += target - -QT += widgets diff --git a/examples/widgets/itemviews/spinboxdelegate/spinboxdelegate.pro b/examples/widgets/itemviews/spinboxdelegate/spinboxdelegate.pro index c156a4f425..92f6b9d712 100644 --- a/examples/widgets/itemviews/spinboxdelegate/spinboxdelegate.pro +++ b/examples/widgets/itemviews/spinboxdelegate/spinboxdelegate.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = delegate.h SOURCES = delegate.cpp \ main.cpp @@ -6,6 +8,4 @@ SOURCES = delegate.cpp \ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/itemviews/spinboxdelegate INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/itemviews/spreadsheet/spreadsheet.pro b/examples/widgets/itemviews/spreadsheet/spreadsheet.pro index b69811a4b8..56f7424a93 100644 --- a/examples/widgets/itemviews/spreadsheet/spreadsheet.pro +++ b/examples/widgets/itemviews/spreadsheet/spreadsheet.pro @@ -1,6 +1,6 @@ QT += widgets -!isEmpty(QT.printsupport.name): QT += printsupport -#unix:contains(QT_CONFIG, dbus):QT += dbus widgets +qtHaveModule(printsupport): QT += printsupport +#unix:qtHaveModule(dbus): QT += dbus widgets HEADERS += printview.h spreadsheet.h spreadsheetdelegate.h spreadsheetitem.h SOURCES += main.cpp \ diff --git a/examples/widgets/itemviews/stardelegate/stardelegate.pro b/examples/widgets/itemviews/stardelegate/stardelegate.pro index 13c260d268..fefb8b5b95 100644 --- a/examples/widgets/itemviews/stardelegate/stardelegate.pro +++ b/examples/widgets/itemviews/stardelegate/stardelegate.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = stardelegate.h \ stareditor.h \ starrating.h @@ -10,6 +12,4 @@ SOURCES = main.cpp \ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/itemviews/stardelegate INSTALLS += target - -QT += widgets simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/layouts/basiclayouts/basiclayouts.pro b/examples/widgets/layouts/basiclayouts/basiclayouts.pro index cfa8594516..bc53b27782 100644 --- a/examples/widgets/layouts/basiclayouts/basiclayouts.pro +++ b/examples/widgets/layouts/basiclayouts/basiclayouts.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = dialog.h SOURCES = dialog.cpp \ main.cpp @@ -6,6 +8,4 @@ SOURCES = dialog.cpp \ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/layouts/basiclayouts INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/layouts/borderlayout/borderlayout.pro b/examples/widgets/layouts/borderlayout/borderlayout.pro index 2b7d55919a..53c9647bd7 100644 --- a/examples/widgets/layouts/borderlayout/borderlayout.pro +++ b/examples/widgets/layouts/borderlayout/borderlayout.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = borderlayout.h \ window.h SOURCES = borderlayout.cpp \ @@ -7,5 +9,3 @@ SOURCES = borderlayout.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/layouts/borderlayout INSTALLS += target - -QT += widgets diff --git a/examples/widgets/layouts/dynamiclayouts/dynamiclayouts.pro b/examples/widgets/layouts/dynamiclayouts/dynamiclayouts.pro index 293137c426..8424799ca3 100644 --- a/examples/widgets/layouts/dynamiclayouts/dynamiclayouts.pro +++ b/examples/widgets/layouts/dynamiclayouts/dynamiclayouts.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = dialog.h SOURCES = dialog.cpp \ main.cpp @@ -6,6 +8,4 @@ SOURCES = dialog.cpp \ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/layouts/dynamiclayouts INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/layouts/flowlayout/flowlayout.pro b/examples/widgets/layouts/flowlayout/flowlayout.pro index bd977f2a0e..a0cfd409bb 100644 --- a/examples/widgets/layouts/flowlayout/flowlayout.pro +++ b/examples/widgets/layouts/flowlayout/flowlayout.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = flowlayout.h \ window.h SOURCES = flowlayout.cpp \ @@ -7,5 +9,3 @@ SOURCES = flowlayout.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/layouts/flowlayout INSTALLS += target - -QT += widgets diff --git a/examples/widgets/layouts/layouts.pro b/examples/widgets/layouts/layouts.pro index cfd9b4b01c..c641e8cf7f 100644 --- a/examples/widgets/layouts/layouts.pro +++ b/examples/widgets/layouts/layouts.pro @@ -3,5 +3,3 @@ SUBDIRS = basiclayouts \ borderlayout \ dynamiclayouts \ flowlayout - -QT += widgets diff --git a/examples/widgets/mainwindows/application/application.pro b/examples/widgets/mainwindows/application/application.pro index f202a60979..652cc73485 100644 --- a/examples/widgets/mainwindows/application/application.pro +++ b/examples/widgets/mainwindows/application/application.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = mainwindow.h SOURCES = main.cpp \ mainwindow.cpp @@ -9,6 +11,4 @@ RESOURCES = application.qrc target.path = $$[QT_INSTALL_EXAMPLES]/widgets/mainwindows/application INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/mainwindows/dockwidgets/dockwidgets.pro b/examples/widgets/mainwindows/dockwidgets/dockwidgets.pro index ec3a5813e1..f445c5a89e 100644 --- a/examples/widgets/mainwindows/dockwidgets/dockwidgets.pro +++ b/examples/widgets/mainwindows/dockwidgets/dockwidgets.pro @@ -1,3 +1,6 @@ +QT += widgets +qtHaveModule(printsupport): QT += printsupport + HEADERS = mainwindow.h SOURCES = main.cpp \ mainwindow.cpp @@ -7,7 +10,4 @@ RESOURCES = dockwidgets.qrc target.path = $$[QT_INSTALL_EXAMPLES]/widgets/mainwindows/dockwidgets INSTALLS += target -QT += widgets -!isEmpty(QT.printsupport.name): QT += printsupport - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/mainwindows/mainwindow/mainwindow.pro b/examples/widgets/mainwindows/mainwindow/mainwindow.pro index 2bef5f0b71..bf92d0e3ca 100644 --- a/examples/widgets/mainwindows/mainwindow/mainwindow.pro +++ b/examples/widgets/mainwindows/mainwindow/mainwindow.pro @@ -1,4 +1,6 @@ TEMPLATE = app +QT += widgets + HEADERS += colorswatch.h mainwindow.h toolbar.h SOURCES += colorswatch.cpp mainwindow.cpp toolbar.cpp main.cpp build_all:!build_pass { @@ -11,5 +13,3 @@ RESOURCES += mainwindow.qrc # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/mainwindows/mainwindow INSTALLS += target - -QT += widgets diff --git a/examples/widgets/mainwindows/mainwindows.pro b/examples/widgets/mainwindows/mainwindows.pro index 848fdb04df..52179ec9bd 100644 --- a/examples/widgets/mainwindows/mainwindows.pro +++ b/examples/widgets/mainwindows/mainwindows.pro @@ -6,5 +6,3 @@ SUBDIRS = application \ menus \ recentfiles \ sdi - -QT += widgets diff --git a/examples/widgets/mainwindows/mdi/mdi.pro b/examples/widgets/mainwindows/mdi/mdi.pro index 786bbd3569..9f8ed1184a 100644 --- a/examples/widgets/mainwindows/mdi/mdi.pro +++ b/examples/widgets/mainwindows/mdi/mdi.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = mainwindow.h \ mdichild.h SOURCES = main.cpp \ @@ -9,6 +11,4 @@ RESOURCES = mdi.qrc target.path = $$[QT_INSTALL_EXAMPLES]/widgets/mainwindows/mdi INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/mainwindows/menus/menus.pro b/examples/widgets/mainwindows/menus/menus.pro index 1ac5df4a3b..9be318759c 100644 --- a/examples/widgets/mainwindows/menus/menus.pro +++ b/examples/widgets/mainwindows/menus/menus.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = mainwindow.h SOURCES = mainwindow.cpp \ main.cpp @@ -5,5 +7,3 @@ SOURCES = mainwindow.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/mainwindows/menus INSTALLS += target - -QT += widgets diff --git a/examples/widgets/mainwindows/recentfiles/recentfiles.pro b/examples/widgets/mainwindows/recentfiles/recentfiles.pro index 4ab5a6820e..898ebd7842 100644 --- a/examples/widgets/mainwindows/recentfiles/recentfiles.pro +++ b/examples/widgets/mainwindows/recentfiles/recentfiles.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = mainwindow.h SOURCES = main.cpp \ mainwindow.cpp @@ -6,6 +8,4 @@ SOURCES = main.cpp \ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/mainwindows/recentfiles INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/mainwindows/sdi/sdi.pro b/examples/widgets/mainwindows/sdi/sdi.pro index 30ae4f5f3d..7d46b327e7 100644 --- a/examples/widgets/mainwindows/sdi/sdi.pro +++ b/examples/widgets/mainwindows/sdi/sdi.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = mainwindow.h SOURCES = main.cpp \ mainwindow.cpp @@ -7,6 +9,4 @@ RESOURCES = sdi.qrc target.path = $$[QT_INSTALL_EXAMPLES]/widgets/mainwindows/sdi INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/painting/affine/affine.pro b/examples/widgets/painting/affine/affine.pro index e94f4d12fb..1f2f8df87f 100644 --- a/examples/widgets/painting/affine/affine.pro +++ b/examples/widgets/painting/affine/affine.pro @@ -1,7 +1,7 @@ SOURCES += main.cpp xform.cpp HEADERS += xform.h -contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2) { +qtHaveModule(opengl) { DEFINES += QT_OPENGL_SUPPORT QT += opengl } diff --git a/examples/widgets/painting/affine/xform.cpp b/examples/widgets/painting/affine/xform.cpp index a873ba7af8..d4485df0b3 100644 --- a/examples/widgets/painting/affine/xform.cpp +++ b/examples/widgets/painting/affine/xform.cpp @@ -251,12 +251,14 @@ void XFormView::timerEvent(QTimerEvent *e) } } +#ifndef QT_NO_WHEELEVENT void XFormView::wheelEvent(QWheelEvent *e) { m_scale += e->delta() / qreal(600); m_scale = qMax(qreal(0.1), qMin(qreal(4), m_scale)); emit scaleChanged(int(m_scale*1000)); } +#endif void XFormView::reset() { diff --git a/examples/widgets/painting/affine/xform.h b/examples/widgets/painting/affine/xform.h index fff92733a0..a04381165d 100644 --- a/examples/widgets/painting/affine/xform.h +++ b/examples/widgets/painting/affine/xform.h @@ -116,7 +116,9 @@ signals: protected: void timerEvent(QTimerEvent *e); +#ifndef QT_NO_WHEELEVENT void wheelEvent(QWheelEvent *); +#endif private: QPolygonF ctrlPoints; diff --git a/examples/widgets/painting/basicdrawing/basicdrawing.pro b/examples/widgets/painting/basicdrawing/basicdrawing.pro index 52ee0d4402..a7b3cff9cd 100644 --- a/examples/widgets/painting/basicdrawing/basicdrawing.pro +++ b/examples/widgets/painting/basicdrawing/basicdrawing.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = renderarea.h \ window.h SOURCES = main.cpp \ @@ -8,5 +10,3 @@ RESOURCES = basicdrawing.qrc # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/painting/basicdrawing INSTALLS += target - -QT += widgets diff --git a/examples/widgets/painting/composition/composition.pro b/examples/widgets/painting/composition/composition.pro index 7ff82d789a..0269945ac8 100644 --- a/examples/widgets/painting/composition/composition.pro +++ b/examples/widgets/painting/composition/composition.pro @@ -6,7 +6,7 @@ SHARED_FOLDER = ../shared include($$SHARED_FOLDER/shared.pri) RESOURCES += composition.qrc -contains(QT_CONFIG, opengl) { +qtHaveModule(opengl) { DEFINES += QT_OPENGL_SUPPORT QT += opengl } diff --git a/examples/widgets/painting/concentriccircles/concentriccircles.pro b/examples/widgets/painting/concentriccircles/concentriccircles.pro index 9690465d46..844c01a9c2 100644 --- a/examples/widgets/painting/concentriccircles/concentriccircles.pro +++ b/examples/widgets/painting/concentriccircles/concentriccircles.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = circlewidget.h \ window.h SOURCES = circlewidget.cpp \ @@ -7,6 +9,3 @@ SOURCES = circlewidget.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/painting/concentriccircles INSTALLS += target - -QT += widgets - diff --git a/examples/widgets/painting/deform/deform.pro b/examples/widgets/painting/deform/deform.pro index 01dc0a869c..6409aaed96 100644 --- a/examples/widgets/painting/deform/deform.pro +++ b/examples/widgets/painting/deform/deform.pro @@ -7,7 +7,7 @@ include($$SHARED_FOLDER/shared.pri) RESOURCES += deform.qrc -contains(QT_CONFIG, opengl) { +qtHaveModule(opengl) { DEFINES += QT_OPENGL_SUPPORT QT += opengl } diff --git a/examples/widgets/painting/fontsampler/fontsampler.pro b/examples/widgets/painting/fontsampler/fontsampler.pro index c32fc40572..08dd07bc08 100644 --- a/examples/widgets/painting/fontsampler/fontsampler.pro +++ b/examples/widgets/painting/fontsampler/fontsampler.pro @@ -1,3 +1,6 @@ +QT += widgets +qtHaveModule(printsupport): QT += printsupport + FORMS = mainwindowbase.ui HEADERS = mainwindow.h SOURCES = main.cpp \ @@ -6,6 +9,3 @@ SOURCES = main.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/painting/fontsampler INSTALLS += target - -QT += widgets -!isEmpty(QT.printsupport.name): QT += printsupport diff --git a/examples/widgets/painting/gradients/gradients.pro b/examples/widgets/painting/gradients/gradients.pro index a7d6ae68d1..73f3974c62 100644 --- a/examples/widgets/painting/gradients/gradients.pro +++ b/examples/widgets/painting/gradients/gradients.pro @@ -6,7 +6,7 @@ SHARED_FOLDER = ../shared include($$SHARED_FOLDER/shared.pri) RESOURCES += gradients.qrc -contains(QT_CONFIG, opengl) { +qtHaveModule(opengl) { DEFINES += QT_OPENGL_SUPPORT QT += opengl } diff --git a/examples/widgets/painting/imagecomposition/imagecomposition.pro b/examples/widgets/painting/imagecomposition/imagecomposition.pro index ce23c601f5..42c70471c1 100644 --- a/examples/widgets/painting/imagecomposition/imagecomposition.pro +++ b/examples/widgets/painting/imagecomposition/imagecomposition.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = imagecomposer.h SOURCES = imagecomposer.cpp \ main.cpp @@ -6,6 +8,3 @@ RESOURCES = imagecomposition.qrc # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/painting/imagecomposition INSTALLS += target - -QT += widgets - diff --git a/examples/widgets/painting/painterpaths/painterpaths.pro b/examples/widgets/painting/painterpaths/painterpaths.pro index 560e84a267..2d2db30739 100644 --- a/examples/widgets/painting/painterpaths/painterpaths.pro +++ b/examples/widgets/painting/painterpaths/painterpaths.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = renderarea.h \ window.h SOURCES = main.cpp \ @@ -8,6 +10,3 @@ unix:!mac:!vxworks:!integrity:LIBS += -lm # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/painting/painterpaths INSTALLS += target - -QT += widgets - diff --git a/examples/widgets/painting/painting.pro b/examples/widgets/painting/painting.pro index 145fcdd383..7459dd3e94 100644 --- a/examples/widgets/painting/painting.pro +++ b/examples/widgets/painting/painting.pro @@ -12,8 +12,6 @@ SUBDIRS = basicdrawing \ transformations \ fontsampler -QT += widgets - examples_affine.subdir = affine examples_composition.subdir = composition examples_deform.subdir = deform diff --git a/examples/widgets/painting/pathstroke/pathstroke.pro b/examples/widgets/painting/pathstroke/pathstroke.pro index 197fe22024..8ab3cb9244 100644 --- a/examples/widgets/painting/pathstroke/pathstroke.pro +++ b/examples/widgets/painting/pathstroke/pathstroke.pro @@ -7,7 +7,7 @@ include($$SHARED_FOLDER/shared.pri) RESOURCES += pathstroke.qrc -contains(QT_CONFIG, opengl) { +qtHaveModule(opengl) { DEFINES += QT_OPENGL_SUPPORT QT += opengl } diff --git a/examples/widgets/painting/shared/shared.pri b/examples/widgets/painting/shared/shared.pri index 6aef1bdd5b..af027e081a 100644 --- a/examples/widgets/painting/shared/shared.pri +++ b/examples/widgets/painting/shared/shared.pri @@ -1,6 +1,6 @@ INCLUDEPATH += $$PWD -contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2) { +qtHaveModule(opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2) { DEFINES += QT_OPENGL_SUPPORT QT += opengl widgets } diff --git a/examples/widgets/painting/shared/shared.pro b/examples/widgets/painting/shared/shared.pro index 2a71c7d487..2756bf75ca 100644 --- a/examples/widgets/painting/shared/shared.pro +++ b/examples/widgets/painting/shared/shared.pro @@ -1,17 +1,17 @@ TEMPLATE = lib CONFIG += static -contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2) { +qtHaveModule(opengl) { DEFINES += QT_OPENGL_SUPPORT - QT += opengl widgets + QT += opengl } +QT += widgets build_all:!build_pass { CONFIG -= build_all CONFIG += release } TARGET = demo_shared -QT += widgets SOURCES += \ arthurstyle.cpp\ diff --git a/examples/widgets/painting/transformations/transformations.pro b/examples/widgets/painting/transformations/transformations.pro index 72f42046db..3f5398a228 100644 --- a/examples/widgets/painting/transformations/transformations.pro +++ b/examples/widgets/painting/transformations/transformations.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = renderarea.h \ window.h SOURCES = main.cpp \ @@ -7,5 +9,3 @@ SOURCES = main.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/painting/transformations INSTALLS += target - -QT += widgets diff --git a/examples/widgets/richtext/calendar/calendar.pro b/examples/widgets/richtext/calendar/calendar.pro index d98b08a368..5adb99aac3 100644 --- a/examples/widgets/richtext/calendar/calendar.pro +++ b/examples/widgets/richtext/calendar/calendar.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = mainwindow.h SOURCES = main.cpp \ mainwindow.cpp @@ -5,5 +7,3 @@ SOURCES = main.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/richtext/calendar INSTALLS += target - -QT += widgets diff --git a/examples/widgets/richtext/orderform/orderform.pro b/examples/widgets/richtext/orderform/orderform.pro index 72ba3a1d25..0eb9da3ae1 100644 --- a/examples/widgets/richtext/orderform/orderform.pro +++ b/examples/widgets/richtext/orderform/orderform.pro @@ -1,3 +1,6 @@ +QT += widgets +qtHaveModule(printsupport): QT += printsupport + HEADERS = detailsdialog.h \ mainwindow.h SOURCES = detailsdialog.cpp \ @@ -7,6 +10,3 @@ SOURCES = detailsdialog.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/richtext/orderform INSTALLS += target - -QT += widgets -!isEmpty(QT.printsupport.name): QT += printsupport diff --git a/examples/widgets/richtext/syntaxhighlighter/syntaxhighlighter.pro b/examples/widgets/richtext/syntaxhighlighter/syntaxhighlighter.pro index e968c1168a..640f36f9b8 100644 --- a/examples/widgets/richtext/syntaxhighlighter/syntaxhighlighter.pro +++ b/examples/widgets/richtext/syntaxhighlighter/syntaxhighlighter.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = highlighter.h \ mainwindow.h SOURCES = highlighter.cpp \ @@ -14,5 +16,3 @@ wince*: { addFiles.path = . DEPLOYMENT += addFiles } -QT += widgets - diff --git a/examples/widgets/richtext/textedit/textedit.pro b/examples/widgets/richtext/textedit/textedit.pro index a2090231c5..c32bf68f68 100644 --- a/examples/widgets/richtext/textedit/textedit.pro +++ b/examples/widgets/richtext/textedit/textedit.pro @@ -1,8 +1,9 @@ +QT += widgets +qtHaveModule(printsupport): QT += printsupport + TEMPLATE = app TARGET = textedit -CONFIG += qt warn_on - HEADERS = textedit.h SOURCES = textedit.cpp \ main.cpp @@ -18,6 +19,3 @@ EXAMPLE_FILES = textedit.qdoc # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/richtext/textedit INSTALLS += target - -QT += widgets -!isEmpty(QT.printsupport.name): QT += printsupport diff --git a/examples/widgets/richtext/textedit/textedit.qdoc b/examples/widgets/richtext/textedit/textedit.qdoc index 18f26dbd1d..070ac22f92 100644 --- a/examples/widgets/richtext/textedit/textedit.qdoc +++ b/examples/widgets/richtext/textedit/textedit.qdoc @@ -33,9 +33,8 @@ \brief This example displays a text editor with the user interface written in pure C++. - A similar example which uses \link designer-manual.book Qt - Designer\endlink to produce the user interface is in the \link - designer-manual.book Qt Designer manual\endlink. + A similar example which uses Qt Designer to produce the user + interface is in the \l {Qt Designer Manual}. See \c{$QTDIR/examples/textedit} for the source code. diff --git a/examples/widgets/scroller/graphicsview/graphicsview.pro b/examples/widgets/scroller/graphicsview/graphicsview.pro index 07ad81922e..39bdb2bc2c 100644 --- a/examples/widgets/scroller/graphicsview/graphicsview.pro +++ b/examples/widgets/scroller/graphicsview/graphicsview.pro @@ -1,7 +1,8 @@ +QT += widgets + TEMPLATE = app SOURCES = main.cpp # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/scroller/graphicsview INSTALLS += target -QT += widgets diff --git a/examples/widgets/statemachine/eventtransitions/eventtransitions.pro b/examples/widgets/statemachine/eventtransitions/eventtransitions.pro index 7b8ef26eb0..63c2eab5a9 100644 --- a/examples/widgets/statemachine/eventtransitions/eventtransitions.pro +++ b/examples/widgets/statemachine/eventtransitions/eventtransitions.pro @@ -1,9 +1,9 @@ +QT += widgets + SOURCES = main.cpp # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/statemachine/eventtransitions INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/statemachine/rogue/rogue.pro b/examples/widgets/statemachine/rogue/rogue.pro index d1f4f5d972..cf9657c7d6 100644 --- a/examples/widgets/statemachine/rogue/rogue.pro +++ b/examples/widgets/statemachine/rogue/rogue.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = window.h \ movementtransition.h SOURCES = main.cpp \ @@ -6,6 +8,3 @@ SOURCES = main.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/statemachine/rogue INSTALLS += target - -QT += widgets - diff --git a/examples/widgets/statemachine/statemachine.pro b/examples/widgets/statemachine/statemachine.pro index 2a539d2e54..926e01cfda 100644 --- a/examples/widgets/statemachine/statemachine.pro +++ b/examples/widgets/statemachine/statemachine.pro @@ -3,7 +3,7 @@ SUBDIRS = \ factorial \ pingpong -!contains(QT_CONFIG, no-widgets) { +qtHaveModule(widgets) { SUBDIRS += \ eventtransitions \ rogue \ diff --git a/examples/widgets/statemachine/trafficlight/trafficlight.pro b/examples/widgets/statemachine/trafficlight/trafficlight.pro index 14d10f5a10..85d9cda504 100644 --- a/examples/widgets/statemachine/trafficlight/trafficlight.pro +++ b/examples/widgets/statemachine/trafficlight/trafficlight.pro @@ -1,8 +1,9 @@ +QT += widgets + SOURCES = main.cpp # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/statemachine/trafficlight INSTALLS += target -QT += widgets diff --git a/examples/widgets/statemachine/twowaybutton/twowaybutton.pro b/examples/widgets/statemachine/twowaybutton/twowaybutton.pro index 9562df5919..22d19308ae 100644 --- a/examples/widgets/statemachine/twowaybutton/twowaybutton.pro +++ b/examples/widgets/statemachine/twowaybutton/twowaybutton.pro @@ -1,8 +1,9 @@ +QT += widgets + SOURCES = main.cpp # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/statemachine/twowaybutton INSTALLS += target -QT += widgets diff --git a/examples/widgets/tools/codecs/codecs.pro b/examples/widgets/tools/codecs/codecs.pro index 410411d870..7b2baa3ec8 100644 --- a/examples/widgets/tools/codecs/codecs.pro +++ b/examples/widgets/tools/codecs/codecs.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS += mainwindow.h \ previewform.h SOURCES += main.cpp \ @@ -10,6 +12,4 @@ EXAMPLE_FILES = encodedfiles target.path = $$[QT_INSTALL_EXAMPLES]/tools/codecs INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tools/completer/completer.pro b/examples/widgets/tools/completer/completer.pro index c0fcf8d1fb..b47b7a9057 100644 --- a/examples/widgets/tools/completer/completer.pro +++ b/examples/widgets/tools/completer/completer.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = fsmodel.h \ mainwindow.h SOURCES = fsmodel.cpp \ @@ -9,6 +11,4 @@ RESOURCES = completer.qrc target.path = $$[QT_INSTALL_EXAMPLES]/tools/completer INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tools/customcompleter/customcompleter.pro b/examples/widgets/tools/customcompleter/customcompleter.pro index 24d973cf82..b8ccc83744 100644 --- a/examples/widgets/tools/customcompleter/customcompleter.pro +++ b/examples/widgets/tools/customcompleter/customcompleter.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = mainwindow.h \ textedit.h SOURCES = main.cpp \ @@ -9,6 +11,4 @@ RESOURCES = customcompleter.qrc target.path = $$[QT_INSTALL_EXAMPLES]/tools/customcompleter INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tools/echoplugin/echoplugin.pro b/examples/widgets/tools/echoplugin/echoplugin.pro index 685227c6c4..986ba9c9c3 100644 --- a/examples/widgets/tools/echoplugin/echoplugin.pro +++ b/examples/widgets/tools/echoplugin/echoplugin.pro @@ -7,5 +7,3 @@ SUBDIRS = echowindow \ # install target.path = $$[QT_INSTALL_EXAMPLES]/tools/echoplugin INSTALLS += target - -QT += widgets diff --git a/examples/widgets/tools/echoplugin/echowindow/echowindow.pro b/examples/widgets/tools/echoplugin/echowindow/echowindow.pro index cd91693ec0..c8dc000678 100644 --- a/examples/widgets/tools/echoplugin/echowindow/echowindow.pro +++ b/examples/widgets/tools/echoplugin/echowindow/echowindow.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = echowindow.h \ echointerface.h SOURCES = echowindow.cpp \ @@ -16,6 +18,4 @@ win32 { target.path = $$[QT_INSTALL_EXAMPLES]/tools/echoplugin INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tools/echoplugin/plugin/plugin.pro b/examples/widgets/tools/echoplugin/plugin/plugin.pro index a586130b76..235358d52c 100644 --- a/examples/widgets/tools/echoplugin/plugin/plugin.pro +++ b/examples/widgets/tools/echoplugin/plugin/plugin.pro @@ -1,6 +1,7 @@ #! [0] TEMPLATE = lib CONFIG += plugin +QT += widgets INCLUDEPATH += ../echowindow HEADERS = echoplugin.h SOURCES = echoplugin.cpp @@ -13,5 +14,3 @@ EXAMPLE_FILES = echoplugin.json # install target.path = $$[QT_INSTALL_EXAMPLES]/tools/echoplugin/plugin INSTALLS += target - -QT += widgets diff --git a/examples/widgets/tools/i18n/i18n.pro b/examples/widgets/tools/i18n/i18n.pro index 57514781eb..8095e44b3c 100644 --- a/examples/widgets/tools/i18n/i18n.pro +++ b/examples/widgets/tools/i18n/i18n.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = languagechooser.h \ mainwindow.h SOURCES = languagechooser.cpp \ @@ -23,6 +25,4 @@ TRANSLATIONS += translations/i18n_ar.ts \ target.path = $$[QT_INSTALL_EXAMPLES]/tools/i18n INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tools/plugandpaint/plugandpaint.pro b/examples/widgets/tools/plugandpaint/plugandpaint.pro index ffa408df66..0b20f81a1f 100644 --- a/examples/widgets/tools/plugandpaint/plugandpaint.pro +++ b/examples/widgets/tools/plugandpaint/plugandpaint.pro @@ -1,4 +1,6 @@ #! [0] +QT += widgets + HEADERS = interfaces.h \ mainwindow.h \ paintarea.h \ @@ -19,5 +21,3 @@ if(!debug_and_release|build_pass):CONFIG(debug, debug|release) { # install target.path = $$[QT_INSTALL_EXAMPLES]/tools/plugandpaint INSTALLS += target - -QT += widgets diff --git a/examples/widgets/tools/plugandpaintplugins/basictools/basictools.pro b/examples/widgets/tools/plugandpaintplugins/basictools/basictools.pro index 731034fb3c..aac2edce00 100644 --- a/examples/widgets/tools/plugandpaintplugins/basictools/basictools.pro +++ b/examples/widgets/tools/plugandpaintplugins/basictools/basictools.pro @@ -1,6 +1,7 @@ #! [0] TEMPLATE = lib CONFIG += plugin static +QT += widgets INCLUDEPATH += ../.. HEADERS = basictoolsplugin.h SOURCES = basictoolsplugin.cpp @@ -11,5 +12,3 @@ DESTDIR = ../../plugandpaint/plugins # install target.path = $$[QT_INSTALL_EXAMPLES]/tools/plugandpaint/plugins INSTALLS += target - -QT += widgets diff --git a/examples/widgets/tools/plugandpaintplugins/basictools/basictoolsplugin.h b/examples/widgets/tools/plugandpaintplugins/basictools/basictoolsplugin.h index b5159803f6..3da75252a7 100644 --- a/examples/widgets/tools/plugandpaintplugins/basictools/basictoolsplugin.h +++ b/examples/widgets/tools/plugandpaintplugins/basictools/basictoolsplugin.h @@ -58,7 +58,9 @@ class BasicToolsPlugin : public QObject, public FilterInterface { Q_OBJECT +//! [4] Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Examples.PlugAndPaint.BrushInterface" FILE "basictools.json") +//! [4] Q_INTERFACES(BrushInterface ShapeInterface FilterInterface) //! [0] diff --git a/examples/widgets/tools/plugandpaintplugins/extrafilters/extrafilters.pro b/examples/widgets/tools/plugandpaintplugins/extrafilters/extrafilters.pro index 7a18e49dc1..3280f119cf 100644 --- a/examples/widgets/tools/plugandpaintplugins/extrafilters/extrafilters.pro +++ b/examples/widgets/tools/plugandpaintplugins/extrafilters/extrafilters.pro @@ -1,6 +1,7 @@ #! [0] TEMPLATE = lib CONFIG += plugin +QT += widgets INCLUDEPATH += ../.. HEADERS = extrafiltersplugin.h SOURCES = extrafiltersplugin.cpp @@ -11,5 +12,3 @@ DESTDIR = ../../plugandpaint/plugins # install target.path = $$[QT_INSTALL_EXAMPLES]/tools/plugandpaint/plugins INSTALLS += target - -QT += widgets diff --git a/examples/widgets/tools/plugandpaintplugins/plugandpaintplugins.pro b/examples/widgets/tools/plugandpaintplugins/plugandpaintplugins.pro index 6f077c952e..e15220c621 100644 --- a/examples/widgets/tools/plugandpaintplugins/plugandpaintplugins.pro +++ b/examples/widgets/tools/plugandpaintplugins/plugandpaintplugins.pro @@ -1,5 +1,3 @@ TEMPLATE = subdirs SUBDIRS = basictools \ extrafilters - -QT += widgets diff --git a/examples/widgets/tools/regexp/regexp.pro b/examples/widgets/tools/regexp/regexp.pro index eead58807f..0d2a9a280c 100644 --- a/examples/widgets/tools/regexp/regexp.pro +++ b/examples/widgets/tools/regexp/regexp.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = regexpdialog.h SOURCES = regexpdialog.cpp \ main.cpp @@ -6,6 +8,4 @@ SOURCES = regexpdialog.cpp \ target.path = $$[QT_INSTALL_EXAMPLES]/tools/regexp INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tools/settingseditor/settingseditor.pro b/examples/widgets/tools/settingseditor/settingseditor.pro index 9d7c776067..69b8a04c92 100644 --- a/examples/widgets/tools/settingseditor/settingseditor.pro +++ b/examples/widgets/tools/settingseditor/settingseditor.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = locationdialog.h \ mainwindow.h \ settingstree.h \ @@ -14,6 +16,4 @@ EXAMPLE_FILES = inifiles target.path = $$[QT_INSTALL_EXAMPLES]/tools/settingseditor INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tools/styleplugin/plugin/plugin.pro b/examples/widgets/tools/styleplugin/plugin/plugin.pro index 65a41087e6..605e196bd9 100644 --- a/examples/widgets/tools/styleplugin/plugin/plugin.pro +++ b/examples/widgets/tools/styleplugin/plugin/plugin.pro @@ -1,6 +1,7 @@ #! [0] TEMPLATE = lib CONFIG += plugin +QT += widgets HEADERS = simplestyle.h \ simplestyleplugin.h SOURCES = simplestyle.cpp \ @@ -19,6 +20,3 @@ EXAMPLE_FILES += simplestyle.json # install target.path = $$[QT_INSTALL_EXAMPLES]/tools/styleplugin/styles INSTALLS += target - - -QT += widgets diff --git a/examples/widgets/tools/styleplugin/styleplugin.pro b/examples/widgets/tools/styleplugin/styleplugin.pro index 4df48ae6b4..d7129e724b 100644 --- a/examples/widgets/tools/styleplugin/styleplugin.pro +++ b/examples/widgets/tools/styleplugin/styleplugin.pro @@ -5,5 +5,3 @@ SUBDIRS = stylewindow \ # install target.path = $$[QT_INSTALL_EXAMPLES]/tools/styleplugin INSTALLS += target - -QT += widgets diff --git a/examples/widgets/tools/styleplugin/stylewindow/stylewindow.pro b/examples/widgets/tools/styleplugin/stylewindow/stylewindow.pro index 3bfcf23bbb..12adce4872 100644 --- a/examples/widgets/tools/styleplugin/stylewindow/stylewindow.pro +++ b/examples/widgets/tools/styleplugin/stylewindow/stylewindow.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = stylewindow.h SOURCES = stylewindow.cpp \ main.cpp @@ -13,5 +15,3 @@ win32 { # install target.path = $$[QT_INSTALL_EXAMPLES]/tools/styleplugin INSTALLS += target - -QT += widgets diff --git a/examples/widgets/tools/tools.pro b/examples/widgets/tools/tools.pro index aaf4440d23..f08f7fd6d2 100644 --- a/examples/widgets/tools/tools.pro +++ b/examples/widgets/tools/tools.pro @@ -14,6 +14,8 @@ SUBDIRS = \ undo \ undoframework +contains(DEFINES, QT_NO_TRANSLATION): SUBDIRS -= i18n + plugandpaint.depends = plugandpaintplugins # install diff --git a/examples/widgets/tools/treemodelcompleter/treemodelcompleter.pro b/examples/widgets/tools/treemodelcompleter/treemodelcompleter.pro index 818f242b48..56e0cee210 100644 --- a/examples/widgets/tools/treemodelcompleter/treemodelcompleter.pro +++ b/examples/widgets/tools/treemodelcompleter/treemodelcompleter.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = treemodelcompleter.h \ mainwindow.h SOURCES = treemodelcompleter.cpp \ @@ -9,6 +11,4 @@ RESOURCES = treemodelcompleter.qrc target.path = $$[QT_INSTALL_EXAMPLES]/tools/treemodelcompleter INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tools/undo/undo.pro b/examples/widgets/tools/undo/undo.pro index f3ac1256c0..5e0f1d7817 100644 --- a/examples/widgets/tools/undo/undo.pro +++ b/examples/widgets/tools/undo/undo.pro @@ -1,3 +1,5 @@ +QT += widgets + SOURCES += main.cpp mainwindow.cpp commands.cpp document.cpp HEADERS += mainwindow.h commands.h document.h FORMS += mainwindow.ui @@ -12,5 +14,3 @@ RESOURCES += undo.qrc # install target.path = $$[QT_INSTALL_EXAMPLES]/tools/undo INSTALLS += target - -QT += widgets diff --git a/examples/widgets/tools/undoframework/undoframework.pro b/examples/widgets/tools/undoframework/undoframework.pro index a9a1b05f39..9cea99f105 100644 --- a/examples/widgets/tools/undoframework/undoframework.pro +++ b/examples/widgets/tools/undoframework/undoframework.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = commands.h \ diagramitem.h \ diagramscene.h \ @@ -13,6 +15,4 @@ RESOURCES = undoframework.qrc target.path = $$[QT_INSTALL_EXAMPLES]/tools/undoframework INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tutorials/addressbook-fr/addressbook-fr.pro b/examples/widgets/tutorials/addressbook-fr/addressbook-fr.pro index 50e6e55ac8..8006039ce3 100644 --- a/examples/widgets/tutorials/addressbook-fr/addressbook-fr.pro +++ b/examples/widgets/tutorials/addressbook-fr/addressbook-fr.pro @@ -4,5 +4,4 @@ SUBDIRS = part1 part2 part3 part4 part5 part6 part7 # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/addressbook-fr INSTALLS += target -QT += widgets diff --git a/examples/widgets/tutorials/addressbook-fr/part1/part1.pro b/examples/widgets/tutorials/addressbook-fr/part1/part1.pro index b82f294ed6..aa31f122b8 100644 --- a/examples/widgets/tutorials/addressbook-fr/part1/part1.pro +++ b/examples/widgets/tutorials/addressbook-fr/part1/part1.pro @@ -1,3 +1,5 @@ +QT += widgets + SOURCES = addressbook.cpp \ main.cpp HEADERS = addressbook.h @@ -7,7 +9,5 @@ QMAKE_PROJECT_NAME = abfr_part1 # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/addressbook-fr/part1 INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tutorials/addressbook-fr/part2/part2.pro b/examples/widgets/tutorials/addressbook-fr/part2/part2.pro index 1ebe545e85..bfcedda6f7 100644 --- a/examples/widgets/tutorials/addressbook-fr/part2/part2.pro +++ b/examples/widgets/tutorials/addressbook-fr/part2/part2.pro @@ -1,3 +1,5 @@ +QT += widgets + SOURCES = addressbook.cpp \ main.cpp HEADERS = addressbook.h @@ -7,7 +9,5 @@ QMAKE_PROJECT_NAME = abfr_part2 # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/addressbook-fr/part2 INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tutorials/addressbook-fr/part3/part3.pro b/examples/widgets/tutorials/addressbook-fr/part3/part3.pro index 04c8417cbe..0990cb5088 100644 --- a/examples/widgets/tutorials/addressbook-fr/part3/part3.pro +++ b/examples/widgets/tutorials/addressbook-fr/part3/part3.pro @@ -1,3 +1,5 @@ +QT += widgets + SOURCES = addressbook.cpp \ main.cpp HEADERS = addressbook.h @@ -7,7 +9,5 @@ QMAKE_PROJECT_NAME = abfr_part3 # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/addressbook-fr/part3 INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tutorials/addressbook-fr/part4/part4.pro b/examples/widgets/tutorials/addressbook-fr/part4/part4.pro index 02fdecf210..44ff4bdce9 100644 --- a/examples/widgets/tutorials/addressbook-fr/part4/part4.pro +++ b/examples/widgets/tutorials/addressbook-fr/part4/part4.pro @@ -1,3 +1,5 @@ +QT += widgets + SOURCES = addressbook.cpp \ main.cpp HEADERS = addressbook.h @@ -7,7 +9,5 @@ QMAKE_PROJECT_NAME = abfr_part4 # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/addressbook-fr/part4 INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tutorials/addressbook-fr/part5/part5.pro b/examples/widgets/tutorials/addressbook-fr/part5/part5.pro index 20b9549037..10638759a9 100644 --- a/examples/widgets/tutorials/addressbook-fr/part5/part5.pro +++ b/examples/widgets/tutorials/addressbook-fr/part5/part5.pro @@ -1,3 +1,5 @@ +QT += widgets + SOURCES = addressbook.cpp \ finddialog.cpp \ main.cpp @@ -9,7 +11,5 @@ QMAKE_PROJECT_NAME = abfr_part5 # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/addressbook-fr/part5 INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tutorials/addressbook-fr/part6/part6.pro b/examples/widgets/tutorials/addressbook-fr/part6/part6.pro index 098daca36a..4c7638fd70 100644 --- a/examples/widgets/tutorials/addressbook-fr/part6/part6.pro +++ b/examples/widgets/tutorials/addressbook-fr/part6/part6.pro @@ -1,3 +1,5 @@ +QT += widgets + SOURCES = addressbook.cpp \ finddialog.cpp \ main.cpp @@ -9,7 +11,5 @@ QMAKE_PROJECT_NAME = abfr_part6 # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/addressbook-fr/part6 INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tutorials/addressbook-fr/part7/part7.pro b/examples/widgets/tutorials/addressbook-fr/part7/part7.pro index 5c1dd33d06..6f56489979 100644 --- a/examples/widgets/tutorials/addressbook-fr/part7/part7.pro +++ b/examples/widgets/tutorials/addressbook-fr/part7/part7.pro @@ -1,3 +1,5 @@ +QT += widgets + SOURCES = addressbook.cpp \ finddialog.cpp \ main.cpp @@ -9,7 +11,5 @@ QMAKE_PROJECT_NAME = abfr_part7 # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/addressbook-fr/part7 INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tutorials/addressbook/addressbook.pro b/examples/widgets/tutorials/addressbook/addressbook.pro index 5dd9da5c01..d31424998e 100644 --- a/examples/widgets/tutorials/addressbook/addressbook.pro +++ b/examples/widgets/tutorials/addressbook/addressbook.pro @@ -4,5 +4,3 @@ SUBDIRS = part1 part2 part3 part4 part5 part6 part7 # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/addressbook INSTALLS += target - -QT += widgets diff --git a/examples/widgets/tutorials/addressbook/part1/part1.pro b/examples/widgets/tutorials/addressbook/part1/part1.pro index 82746da8e5..826ed1aa77 100644 --- a/examples/widgets/tutorials/addressbook/part1/part1.pro +++ b/examples/widgets/tutorials/addressbook/part1/part1.pro @@ -1,3 +1,5 @@ +QT += widgets + SOURCES = addressbook.cpp \ main.cpp HEADERS = addressbook.h @@ -8,6 +10,4 @@ QMAKE_PROJECT_NAME = ab_part1 target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/addressbook/part1 INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tutorials/addressbook/part2/part2.pro b/examples/widgets/tutorials/addressbook/part2/part2.pro index 439b9185a6..0ab172872a 100644 --- a/examples/widgets/tutorials/addressbook/part2/part2.pro +++ b/examples/widgets/tutorials/addressbook/part2/part2.pro @@ -1,3 +1,5 @@ +QT += widgets + SOURCES = addressbook.cpp \ main.cpp HEADERS = addressbook.h @@ -8,6 +10,4 @@ QMAKE_PROJECT_NAME = ab_part2 target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/addressbook/part2 INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tutorials/addressbook/part3/part3.pro b/examples/widgets/tutorials/addressbook/part3/part3.pro index fd32f00536..7863a22bf2 100644 --- a/examples/widgets/tutorials/addressbook/part3/part3.pro +++ b/examples/widgets/tutorials/addressbook/part3/part3.pro @@ -1,3 +1,5 @@ +QT += widgets + SOURCES = addressbook.cpp \ main.cpp HEADERS = addressbook.h @@ -8,6 +10,4 @@ QMAKE_PROJECT_NAME = ab_part3 target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/addressbook/part3 INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tutorials/addressbook/part4/part4.pro b/examples/widgets/tutorials/addressbook/part4/part4.pro index c5caaa87c1..d71328bb0e 100644 --- a/examples/widgets/tutorials/addressbook/part4/part4.pro +++ b/examples/widgets/tutorials/addressbook/part4/part4.pro @@ -1,3 +1,5 @@ +QT += widgets + SOURCES = addressbook.cpp \ main.cpp HEADERS = addressbook.h @@ -8,6 +10,4 @@ QMAKE_PROJECT_NAME = ab_part4 target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/addressbook/part4 INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tutorials/addressbook/part5/part5.pro b/examples/widgets/tutorials/addressbook/part5/part5.pro index e779ad5024..7530900f62 100644 --- a/examples/widgets/tutorials/addressbook/part5/part5.pro +++ b/examples/widgets/tutorials/addressbook/part5/part5.pro @@ -1,3 +1,5 @@ +QT += widgets + SOURCES = addressbook.cpp \ finddialog.cpp \ main.cpp @@ -10,6 +12,4 @@ QMAKE_PROJECT_NAME = ab_part5 target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/addressbook/part5 INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tutorials/addressbook/part6/part6.pro b/examples/widgets/tutorials/addressbook/part6/part6.pro index dd652985ad..88b7147a3f 100644 --- a/examples/widgets/tutorials/addressbook/part6/part6.pro +++ b/examples/widgets/tutorials/addressbook/part6/part6.pro @@ -1,3 +1,5 @@ +QT += widgets + SOURCES = addressbook.cpp \ finddialog.cpp \ main.cpp @@ -10,6 +12,4 @@ QMAKE_PROJECT_NAME = ab_part6 target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/addressbook/part6 INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tutorials/addressbook/part7/part7.pro b/examples/widgets/tutorials/addressbook/part7/part7.pro index d63690ee11..ef435222cd 100644 --- a/examples/widgets/tutorials/addressbook/part7/part7.pro +++ b/examples/widgets/tutorials/addressbook/part7/part7.pro @@ -1,3 +1,5 @@ +QT += widgets + SOURCES = addressbook.cpp \ finddialog.cpp \ main.cpp @@ -10,6 +12,4 @@ QMAKE_PROJECT_NAME = ab_part7 target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/addressbook/part7 INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tutorials/gettingStarted/gettingStarted.pro b/examples/widgets/tutorials/gettingStarted/gettingStarted.pro index b18e6565a6..3e37725410 100644 --- a/examples/widgets/tutorials/gettingStarted/gettingStarted.pro +++ b/examples/widgets/tutorials/gettingStarted/gettingStarted.pro @@ -1,5 +1,4 @@ TEMPLATE = subdirs SUBDIRS += dir_gsqt -QT += widgets dir_gsqt.file = gsQt/gsqt.pro diff --git a/examples/widgets/tutorials/gettingStarted/gsQt/gsqt.pro b/examples/widgets/tutorials/gettingStarted/gsQt/gsqt.pro index 956d78aa6e..320f3c3ee4 100644 --- a/examples/widgets/tutorials/gettingStarted/gsQt/gsqt.pro +++ b/examples/widgets/tutorials/gettingStarted/gsQt/gsqt.pro @@ -5,5 +5,3 @@ SUBDIRS = part1 \ part3 \ part4 \ part5 - -QT += widgets diff --git a/examples/widgets/tutorials/modelview/1_readonly/1_readonly.pro b/examples/widgets/tutorials/modelview/1_readonly/1_readonly.pro index cf066c6b31..51fcbae64d 100644 --- a/examples/widgets/tutorials/modelview/1_readonly/1_readonly.pro +++ b/examples/widgets/tutorials/modelview/1_readonly/1_readonly.pro @@ -2,6 +2,8 @@ TARGET = mv_readonly TEMPLATE = app +QT += widgets + SOURCES += main.cpp \ mymodel.cpp @@ -12,6 +14,4 @@ HEADERS += mymodel.h target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/modelview/1_readonly INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tutorials/modelview/2_formatting/2_formatting.pro b/examples/widgets/tutorials/modelview/2_formatting/2_formatting.pro index 057196b7c6..d5d34d6f7f 100644 --- a/examples/widgets/tutorials/modelview/2_formatting/2_formatting.pro +++ b/examples/widgets/tutorials/modelview/2_formatting/2_formatting.pro @@ -2,6 +2,8 @@ TARGET = mv_formatting TEMPLATE = app +QT += widgets + SOURCES += main.cpp \ mymodel.cpp @@ -11,6 +13,4 @@ HEADERS += mymodel.h target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/modelview/2_formatting INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tutorials/modelview/3_changingmodel/3_changingmodel.pro b/examples/widgets/tutorials/modelview/3_changingmodel/3_changingmodel.pro index 92a1bbf4e5..0e7e587255 100644 --- a/examples/widgets/tutorials/modelview/3_changingmodel/3_changingmodel.pro +++ b/examples/widgets/tutorials/modelview/3_changingmodel/3_changingmodel.pro @@ -2,6 +2,8 @@ TARGET = mv_changingmodel TEMPLATE = app +QT += widgets + SOURCES += main.cpp \ mymodel.cpp @@ -11,6 +13,4 @@ HEADERS += mymodel.h target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/modelview/3_changingmodel INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tutorials/modelview/4_headers/4_headers.pro b/examples/widgets/tutorials/modelview/4_headers/4_headers.pro index 186ea888e0..53effe9b5b 100644 --- a/examples/widgets/tutorials/modelview/4_headers/4_headers.pro +++ b/examples/widgets/tutorials/modelview/4_headers/4_headers.pro @@ -2,6 +2,8 @@ TARGET = mv_headers TEMPLATE = app +QT += widgets + SOURCES += main.cpp \ mymodel.cpp @@ -11,6 +13,4 @@ HEADERS += mymodel.h target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/modelview/4_headers INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tutorials/modelview/5_edit/5_edit.pro b/examples/widgets/tutorials/modelview/5_edit/5_edit.pro index b4727580af..9a2c34f977 100644 --- a/examples/widgets/tutorials/modelview/5_edit/5_edit.pro +++ b/examples/widgets/tutorials/modelview/5_edit/5_edit.pro @@ -2,6 +2,8 @@ TARGET = mv_edit TEMPLATE = app +QT += widgets + SOURCES += main.cpp \ mainwindow.cpp \ mymodel.cpp @@ -13,6 +15,4 @@ HEADERS += mainwindow.h \ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/modelview/5_edit INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tutorials/modelview/6_treeview/6_treeview.pro b/examples/widgets/tutorials/modelview/6_treeview/6_treeview.pro index af3208f9c8..4a874b205a 100644 --- a/examples/widgets/tutorials/modelview/6_treeview/6_treeview.pro +++ b/examples/widgets/tutorials/modelview/6_treeview/6_treeview.pro @@ -1,5 +1,6 @@ TARGET = mv_tree TEMPLATE = app +QT += widgets SOURCES += main.cpp \ mainwindow.cpp HEADERS += mainwindow.h @@ -8,6 +9,4 @@ HEADERS += mainwindow.h target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/modelview/6_treeview INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tutorials/modelview/7_selections/7_selections.pro b/examples/widgets/tutorials/modelview/7_selections/7_selections.pro index 8ab42e97ef..ef412f0aff 100644 --- a/examples/widgets/tutorials/modelview/7_selections/7_selections.pro +++ b/examples/widgets/tutorials/modelview/7_selections/7_selections.pro @@ -1,5 +1,6 @@ TARGET = mv_selections TEMPLATE = app +QT += widgets SOURCES += main.cpp \ mainwindow.cpp HEADERS += mainwindow.h @@ -8,6 +9,4 @@ HEADERS += mainwindow.h target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/modelview/7_selections INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tutorials/modelview/modelview.pro b/examples/widgets/tutorials/modelview/modelview.pro index b21fe5afdc..9a5548aa30 100644 --- a/examples/widgets/tutorials/modelview/modelview.pro +++ b/examples/widgets/tutorials/modelview/modelview.pro @@ -10,5 +10,3 @@ SUBDIRS = 1_readonly \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/modelview INSTALLS += target - -QT += widgets diff --git a/examples/widgets/tutorials/threads/clock/clock.pro b/examples/widgets/tutorials/threads/clock/clock.pro index 9d2687324b..041c02bea8 100644 --- a/examples/widgets/tutorials/threads/clock/clock.pro +++ b/examples/widgets/tutorials/threads/clock/clock.pro @@ -1,3 +1,4 @@ +QT += widgets CONFIG += console TEMPLATE = app SOURCES += main.cpp \ @@ -7,6 +8,3 @@ HEADERS += clockthread.h # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/threads/clock INSTALLS += target - - -QT += widgets diff --git a/examples/widgets/tutorials/threads/movedobject/movedobject.pro b/examples/widgets/tutorials/threads/movedobject/movedobject.pro index 3bf40eb49c..b2ea7e5366 100644 --- a/examples/widgets/tutorials/threads/movedobject/movedobject.pro +++ b/examples/widgets/tutorials/threads/movedobject/movedobject.pro @@ -1,3 +1,4 @@ +QT += widgets CONFIG += console CONFIG -= app_bundle TEMPLATE = app @@ -12,5 +13,3 @@ HEADERS += \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/threads/movedobject INSTALLS += target - -QT += widgets diff --git a/examples/widgets/tutorials/threads/threads.pro b/examples/widgets/tutorials/threads/threads.pro index a95eccaaa0..19718d760c 100644 --- a/examples/widgets/tutorials/threads/threads.pro +++ b/examples/widgets/tutorials/threads/threads.pro @@ -5,6 +5,4 @@ SUBDIRS = hellothread \ clock \ movedobject -contains(QT_CONFIG, concurrent): SUBDIRS += helloconcurrent - -QT += widgets +qtHaveModule(concurrent): SUBDIRS += helloconcurrent diff --git a/examples/widgets/tutorials/widgets/childwidget/childwidget.pro b/examples/widgets/tutorials/widgets/childwidget/childwidget.pro index 4eeab61be5..a227a68593 100644 --- a/examples/widgets/tutorials/widgets/childwidget/childwidget.pro +++ b/examples/widgets/tutorials/widgets/childwidget/childwidget.pro @@ -1,9 +1,9 @@ +QT += widgets + SOURCES = main.cpp # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/widgets/childwidget INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tutorials/widgets/nestedlayouts/nestedlayouts.pro b/examples/widgets/tutorials/widgets/nestedlayouts/nestedlayouts.pro index e362f16713..471a98121e 100644 --- a/examples/widgets/tutorials/widgets/nestedlayouts/nestedlayouts.pro +++ b/examples/widgets/tutorials/widgets/nestedlayouts/nestedlayouts.pro @@ -1,9 +1,9 @@ +QT += widgets + SOURCES = main.cpp # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/widgets/nestedlayouts INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tutorials/widgets/toplevel/toplevel.pro b/examples/widgets/tutorials/widgets/toplevel/toplevel.pro index faa91eb0dd..80e2a03ca6 100644 --- a/examples/widgets/tutorials/widgets/toplevel/toplevel.pro +++ b/examples/widgets/tutorials/widgets/toplevel/toplevel.pro @@ -1,9 +1,9 @@ +QT += widgets + SOURCES = main.cpp # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/widgets/toplevel INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/tutorials/widgets/widgets.pro b/examples/widgets/tutorials/widgets/widgets.pro index 41cfa1d7f6..4ab34a8f93 100644 --- a/examples/widgets/tutorials/widgets/widgets.pro +++ b/examples/widgets/tutorials/widgets/widgets.pro @@ -4,4 +4,3 @@ SUBDIRS = toplevel childwidget windowlayout nestedlayouts # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/widgets INSTALLS += target -QT += widgets diff --git a/examples/widgets/tutorials/widgets/windowlayout/windowlayout.pro b/examples/widgets/tutorials/widgets/windowlayout/windowlayout.pro index 6fd115591e..87eb7c58a4 100644 --- a/examples/widgets/tutorials/widgets/windowlayout/windowlayout.pro +++ b/examples/widgets/tutorials/widgets/windowlayout/windowlayout.pro @@ -1,9 +1,9 @@ +QT += widgets + SOURCES = main.cpp # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/widgets/windowlayout INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/widgets.pro b/examples/widgets/widgets.pro index bdac0bde28..87054cff0d 100644 --- a/examples/widgets/widgets.pro +++ b/examples/widgets/widgets.pro @@ -20,3 +20,4 @@ SUBDIRS = \ widgets contains(DEFINES, QT_NO_CURSOR): SUBDIRS -= mainwindows +contains(DEFINES, QT_NO_DRAGANDDROP): SUBDIRS -= draganddrop diff --git a/examples/widgets/widgets/analogclock/analogclock.pro b/examples/widgets/widgets/analogclock/analogclock.pro index 300c4f8ab4..1c6b736995 100644 --- a/examples/widgets/widgets/analogclock/analogclock.pro +++ b/examples/widgets/widgets/analogclock/analogclock.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = analogclock.h SOURCES = analogclock.cpp \ main.cpp @@ -7,6 +9,3 @@ QMAKE_PROJECT_NAME = widgets_analogclock # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/analogclock INSTALLS += target - -QT += widgets - diff --git a/examples/widgets/widgets/calculator/calculator.pro b/examples/widgets/widgets/calculator/calculator.pro index 715d450003..5ee6928c7d 100644 --- a/examples/widgets/widgets/calculator/calculator.pro +++ b/examples/widgets/widgets/calculator/calculator.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = button.h \ calculator.h SOURCES = button.cpp \ @@ -7,6 +9,3 @@ SOURCES = button.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/calculator INSTALLS += target - -QT += widgets - diff --git a/examples/widgets/widgets/calendarwidget/calendarwidget.pro b/examples/widgets/widgets/calendarwidget/calendarwidget.pro index ad586f11f8..a60f10bf36 100644 --- a/examples/widgets/widgets/calendarwidget/calendarwidget.pro +++ b/examples/widgets/widgets/calendarwidget/calendarwidget.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = window.h SOURCES = main.cpp \ window.cpp @@ -5,5 +7,3 @@ SOURCES = main.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/calendarwidget INSTALLS += target - -QT += widgets diff --git a/examples/widgets/widgets/charactermap/charactermap.pro b/examples/widgets/widgets/charactermap/charactermap.pro index 370338bf46..e9b6bb7c40 100644 --- a/examples/widgets/widgets/charactermap/charactermap.pro +++ b/examples/widgets/widgets/charactermap/charactermap.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = characterwidget.h \ mainwindow.h SOURCES = characterwidget.cpp \ @@ -8,6 +10,4 @@ SOURCES = characterwidget.cpp \ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/charactermap INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/widgets/codeeditor/codeeditor.pro b/examples/widgets/widgets/codeeditor/codeeditor.pro index 5af4e24322..5618160d17 100644 --- a/examples/widgets/widgets/codeeditor/codeeditor.pro +++ b/examples/widgets/widgets/codeeditor/codeeditor.pro @@ -1,9 +1,8 @@ +QT += widgets + HEADERS = codeeditor.h SOURCES = main.cpp \ codeeditor.cpp # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/codeeditor INSTALLS += target - -QT += widgets - diff --git a/examples/widgets/widgets/digitalclock/digitalclock.pro b/examples/widgets/widgets/digitalclock/digitalclock.pro index 9ded97b48c..4e4bc0f557 100644 --- a/examples/widgets/widgets/digitalclock/digitalclock.pro +++ b/examples/widgets/widgets/digitalclock/digitalclock.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = digitalclock.h SOURCES = digitalclock.cpp \ main.cpp @@ -5,5 +7,3 @@ SOURCES = digitalclock.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/digitalclock INSTALLS += target - -QT += widgets diff --git a/examples/widgets/widgets/groupbox/groupbox.pro b/examples/widgets/widgets/groupbox/groupbox.pro index 579f0298c6..9167d26d6d 100644 --- a/examples/widgets/widgets/groupbox/groupbox.pro +++ b/examples/widgets/widgets/groupbox/groupbox.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = window.h SOURCES = window.cpp \ main.cpp @@ -6,6 +8,4 @@ SOURCES = window.cpp \ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/groupbox INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/widgets/icons/icons.pro b/examples/widgets/widgets/icons/icons.pro index 4227cedadd..7a5256bcac 100644 --- a/examples/widgets/widgets/icons/icons.pro +++ b/examples/widgets/widgets/icons/icons.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = iconpreviewarea.h \ iconsizespinbox.h \ imagedelegate.h \ @@ -24,6 +26,5 @@ wince*: { } DEPLOYMENT += imageFiles } -QT += widgets simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/widgets/imageviewer/imageviewer.pro b/examples/widgets/widgets/imageviewer/imageviewer.pro index 611848b093..a0f9cebbda 100644 --- a/examples/widgets/widgets/imageviewer/imageviewer.pro +++ b/examples/widgets/widgets/imageviewer/imageviewer.pro @@ -1,3 +1,6 @@ +QT += widgets +qtHaveModule(printsupport): QT += printsupport + HEADERS = imageviewer.h SOURCES = imageviewer.cpp \ main.cpp @@ -10,7 +13,5 @@ INSTALLS += target wince*: { DEPLOYMENT_PLUGIN += qjpeg qgif } -QT += widgets -!isEmpty(QT.printsupport.name): QT += printsupport simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/widgets/lineedits/lineedits.pro b/examples/widgets/widgets/lineedits/lineedits.pro index d8ac14102f..0ab994ea11 100644 --- a/examples/widgets/widgets/lineedits/lineedits.pro +++ b/examples/widgets/widgets/lineedits/lineedits.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = window.h SOURCES = main.cpp \ window.cpp @@ -5,5 +7,3 @@ SOURCES = main.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/lineedits INSTALLS += target - -QT += widgets diff --git a/examples/widgets/widgets/mousebuttons/buttontester.cpp b/examples/widgets/widgets/mousebuttons/buttontester.cpp index 64910375dc..c64bf76211 100644 --- a/examples/widgets/widgets/mousebuttons/buttontester.cpp +++ b/examples/widgets/widgets/mousebuttons/buttontester.cpp @@ -44,30 +44,40 @@ void ButtonTester::mousePressEvent(QMouseEvent *e) { int j = ButtonTester::buttonByNumber (e->button()); - QString result = "Mouse Press: raw button=" + QString::number(j) + " Qt=" + enumNameFromValue(e->button()); + QString result = "Mouse Press: raw button=" + QString::number(j) + + " Qt=" + enumNameFromValue(e->button()); + QString buttonsString = ButtonTester::enumNamesFromMouseButtons(e->buttons()); + result += "\n heldbuttons " + buttonsString; qDebug() << result; this->setText(result); - if (j == 2) { - this->repaint(); - } + this->repaint(); } void ButtonTester::mouseReleaseEvent(QMouseEvent *e) { int j = ButtonTester::buttonByNumber (e->button()); - QString result = "Mouse Release: raw button=" + QString::number(j) + " Qt=" + enumNameFromValue(e->button()); + QString result = "Mouse Release: raw button=" + QString::number(j) + + " Qt=" + enumNameFromValue(e->button()); + QString buttonsString = ButtonTester::enumNamesFromMouseButtons(e->buttons()); + result += "\n heldbuttons " + buttonsString; qDebug() << result; this->setText(result); + this->repaint(); + } void ButtonTester::mouseDoubleClickEvent(QMouseEvent *e) { int j = ButtonTester::buttonByNumber (e->button()); - QString result = "Mouse DoubleClick: raw button=" + QString::number(j) + " Qt=" + enumNameFromValue(e->button()); + QString result = "Mouse DoubleClick: raw button=" + QString::number(j) + + " Qt=" + enumNameFromValue(e->button()); + QString buttonsString = ButtonTester::enumNamesFromMouseButtons(e->buttons()); + result += "\n heldbuttons" + buttonsString; qDebug() << result; this->setText(result); } +#ifndef QT_NO_WHEELEVENT void ButtonTester::wheelEvent (QWheelEvent *e) { QString result; @@ -88,6 +98,7 @@ void ButtonTester::wheelEvent (QWheelEvent *e) qDebug() << result; this->setText(result); } +#endif int ButtonTester::buttonByNumber(const Qt::MouseButton button) { @@ -170,3 +181,38 @@ QString ButtonTester::enumNameFromValue(const Qt::MouseButton button) qDebug("QMouseShortcutEntry::addShortcut contained Invalid Qt::MouseButton value"); return "NoButton"; } + +QString ButtonTester::enumNamesFromMouseButtons(const Qt::MouseButtons buttons) +{ + QString returnText = ""; + if (buttons == Qt::NoButton) return "NoButton"; + if (buttons & Qt::LeftButton) returnText += "LeftButton "; + if (buttons & Qt::RightButton) returnText += "RightButton "; + if (buttons & Qt::MiddleButton) returnText += "MiddleButton "; + if (buttons & Qt::BackButton) returnText += "BackButton "; + if (buttons & Qt::ForwardButton) returnText += "ForwardButton "; + if (buttons & Qt::TaskButton) returnText += "TaskButton "; + if (buttons & Qt::ExtraButton4) returnText += "ExtraButton4 "; + if (buttons & Qt::ExtraButton5) returnText += "ExtraButton5 "; + if (buttons & Qt::ExtraButton6) returnText += "ExtraButton6 "; + if (buttons & Qt::ExtraButton7) returnText += "ExtraButton7 "; + if (buttons & Qt::ExtraButton8) returnText += "ExtraButton8 "; + if (buttons & Qt::ExtraButton9) returnText += "ExtraButton9 "; + if (buttons & Qt::ExtraButton10) returnText += "ExtraButton10 "; + if (buttons & Qt::ExtraButton11) returnText += "ExtraButton11 "; + if (buttons & Qt::ExtraButton12) returnText += "ExtraButton12 "; + if (buttons & Qt::ExtraButton13) returnText += "ExtraButton13 "; + if (buttons & Qt::ExtraButton14) returnText += "ExtraButton14 "; + if (buttons & Qt::ExtraButton15) returnText += "ExtraButton15 "; + if (buttons & Qt::ExtraButton16) returnText += "ExtraButton16 "; + if (buttons & Qt::ExtraButton17) returnText += "ExtraButton17 "; + if (buttons & Qt::ExtraButton18) returnText += "ExtraButton18 "; + if (buttons & Qt::ExtraButton19) returnText += "ExtraButton19 "; + if (buttons & Qt::ExtraButton20) returnText += "ExtraButton20 "; + if (buttons & Qt::ExtraButton21) returnText += "ExtraButton21 "; + if (buttons & Qt::ExtraButton22) returnText += "ExtraButton22 "; + if (buttons & Qt::ExtraButton23) returnText += "ExtraButton23 "; + if (buttons & Qt::ExtraButton24) returnText += "ExtraButton24 "; + return returnText; +} + diff --git a/examples/widgets/widgets/mousebuttons/buttontester.h b/examples/widgets/widgets/mousebuttons/buttontester.h index bb1a7b0335..6db8993486 100644 --- a/examples/widgets/widgets/mousebuttons/buttontester.h +++ b/examples/widgets/widgets/mousebuttons/buttontester.h @@ -56,9 +56,12 @@ protected: void mousePressEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event); void mouseDoubleClickEvent(QMouseEvent *event); +#ifndef QT_NO_WHEELEVENT void wheelEvent(QWheelEvent * event); +#endif int buttonByNumber(const Qt::MouseButton button); QString enumNameFromValue(const Qt::MouseButton button); + QString enumNamesFromMouseButtons(const Qt::MouseButtons buttons); }; #endif // BUTTONTESTER_H diff --git a/examples/widgets/widgets/mousebuttons/main.cpp b/examples/widgets/widgets/mousebuttons/main.cpp index 67bbbb8896..1692ac5432 100644 --- a/examples/widgets/widgets/mousebuttons/main.cpp +++ b/examples/widgets/widgets/mousebuttons/main.cpp @@ -48,6 +48,10 @@ int main(int argv, char **args) ButtonTester *testArea = new ButtonTester; testArea->setMinimumSize(500, 350); + +// For this test, Qt::RightButton behaves like any other button. + testArea->setContextMenuPolicy(Qt::NoContextMenu); + testArea->setTextInteractionFlags(Qt::TextSelectableByMouse); testArea->setText("To test your mouse with Qt, press buttons in this area.\nYou may also scroll or tilt your mouse wheel."); QPushButton *quitButton = new QPushButton("Quit"); diff --git a/examples/widgets/widgets/movie/movie.pro b/examples/widgets/widgets/movie/movie.pro index d922423373..109e9f411d 100644 --- a/examples/widgets/widgets/movie/movie.pro +++ b/examples/widgets/widgets/movie/movie.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = movieplayer.h SOURCES = main.cpp \ movieplayer.cpp @@ -15,6 +17,4 @@ wince*: { DEPLOYMENT += addFiles } -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/widgets/scribble/scribble.pro b/examples/widgets/widgets/scribble/scribble.pro index 674dccff7e..aff0fb442c 100644 --- a/examples/widgets/widgets/scribble/scribble.pro +++ b/examples/widgets/widgets/scribble/scribble.pro @@ -1,3 +1,6 @@ +QT += widgets +qtHaveModule(printsupport): QT += printsupport + HEADERS = mainwindow.h \ scribblearea.h SOURCES = main.cpp \ @@ -7,6 +10,3 @@ SOURCES = main.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/scribble INSTALLS += target - -QT += widgets -!isEmpty(QT.printsupport.name): QT += printsupport diff --git a/examples/widgets/widgets/shapedclock/shapedclock.pro b/examples/widgets/widgets/shapedclock/shapedclock.pro index b5cb9c9076..0fe7f59765 100644 --- a/examples/widgets/widgets/shapedclock/shapedclock.pro +++ b/examples/widgets/widgets/shapedclock/shapedclock.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = shapedclock.h SOURCES = shapedclock.cpp \ main.cpp @@ -5,6 +7,3 @@ SOURCES = shapedclock.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/shapedclock INSTALLS += target - -QT += widgets - diff --git a/examples/widgets/widgets/sliders/sliders.pro b/examples/widgets/widgets/sliders/sliders.pro index bdc30b896c..6a0e01287d 100644 --- a/examples/widgets/widgets/sliders/sliders.pro +++ b/examples/widgets/widgets/sliders/sliders.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = slidersgroup.h \ window.h SOURCES = main.cpp \ @@ -8,6 +10,4 @@ SOURCES = main.cpp \ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/sliders INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/widgets/spinboxes/spinboxes.pro b/examples/widgets/widgets/spinboxes/spinboxes.pro index 55a028c0a5..9638317471 100644 --- a/examples/widgets/widgets/spinboxes/spinboxes.pro +++ b/examples/widgets/widgets/spinboxes/spinboxes.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = window.h SOURCES = main.cpp \ window.cpp @@ -6,6 +8,4 @@ SOURCES = main.cpp \ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/spinboxes INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/widgets/styles/styles.pro b/examples/widgets/widgets/styles/styles.pro index f93175997f..598dceef65 100644 --- a/examples/widgets/widgets/styles/styles.pro +++ b/examples/widgets/widgets/styles/styles.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = norwegianwoodstyle.h \ widgetgallery.h SOURCES = main.cpp \ @@ -11,6 +13,4 @@ REQUIRES += "contains(styles, windows)" target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/styles INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/widgets/stylesheet/stylesheet.pro b/examples/widgets/widgets/stylesheet/stylesheet.pro index 24590ab3dc..01edb0bbd8 100644 --- a/examples/widgets/widgets/stylesheet/stylesheet.pro +++ b/examples/widgets/widgets/stylesheet/stylesheet.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = mainwindow.h \ stylesheeteditor.h FORMS = mainwindow.ui \ @@ -11,6 +13,4 @@ SOURCES = main.cpp \ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/stylesheet INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/widgets/tablet/tablet.pro b/examples/widgets/widgets/tablet/tablet.pro index 2e74cb847b..6867f92ac8 100644 --- a/examples/widgets/widgets/tablet/tablet.pro +++ b/examples/widgets/widgets/tablet/tablet.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = mainwindow.h \ tabletcanvas.h \ tabletapplication.h @@ -10,6 +12,4 @@ SOURCES = mainwindow.cpp \ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/tablet INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/widgets/tetrix/tetrix.pro b/examples/widgets/widgets/tetrix/tetrix.pro index 5dd5342885..bb9f855fb0 100644 --- a/examples/widgets/widgets/tetrix/tetrix.pro +++ b/examples/widgets/widgets/tetrix/tetrix.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = tetrixboard.h \ tetrixpiece.h \ tetrixwindow.h @@ -9,6 +11,3 @@ SOURCES = main.cpp \ # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/tetrix INSTALLS += target - -QT += widgets - diff --git a/examples/widgets/widgets/tooltips/tooltips.pro b/examples/widgets/widgets/tooltips/tooltips.pro index 7262a1aece..d14b8295ba 100644 --- a/examples/widgets/widgets/tooltips/tooltips.pro +++ b/examples/widgets/widgets/tooltips/tooltips.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = shapeitem.h \ sortingbox.h SOURCES = main.cpp \ @@ -8,5 +10,3 @@ RESOURCES = tooltips.qrc # install target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/tooltips INSTALLS += target - -QT += widgets diff --git a/examples/widgets/widgets/wiggly/wiggly.pro b/examples/widgets/widgets/wiggly/wiggly.pro index 17371603dc..0e39f18add 100644 --- a/examples/widgets/widgets/wiggly/wiggly.pro +++ b/examples/widgets/widgets/wiggly/wiggly.pro @@ -1,4 +1,4 @@ -QT += widgets widgets +QT += widgets HEADERS = wigglywidget.h \ dialog.h diff --git a/examples/widgets/widgets/windowflags/windowflags.pro b/examples/widgets/widgets/windowflags/windowflags.pro index e96344c33d..250319983a 100644 --- a/examples/widgets/widgets/windowflags/windowflags.pro +++ b/examples/widgets/widgets/windowflags/windowflags.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = controllerwindow.h \ previewwindow.h SOURCES = controllerwindow.cpp \ @@ -8,6 +10,4 @@ SOURCES = controllerwindow.cpp \ target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/windowflags INSTALLS += target -QT += widgets - simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/xml/doc/images/xmlstreamexample-filemenu.png b/examples/xml/doc/images/xmlstreamexample-filemenu.png Binary files differnew file mode 100644 index 0000000000..e074fb7c41 --- /dev/null +++ b/examples/xml/doc/images/xmlstreamexample-filemenu.png diff --git a/examples/xml/doc/images/xmlstreamexample-helpmenu.png b/examples/xml/doc/images/xmlstreamexample-helpmenu.png Binary files differnew file mode 100644 index 0000000000..0dc4392b94 --- /dev/null +++ b/examples/xml/doc/images/xmlstreamexample-helpmenu.png diff --git a/examples/xml/doc/images/xmlstreamexample-screenshot.png b/examples/xml/doc/images/xmlstreamexample-screenshot.png Binary files differnew file mode 100644 index 0000000000..bbaa423061 --- /dev/null +++ b/examples/xml/doc/images/xmlstreamexample-screenshot.png diff --git a/examples/xml/doc/src/qxmlstreambookmarks.qdoc b/examples/xml/doc/src/qxmlstreambookmarks.qdoc new file mode 100644 index 0000000000..dd7708a290 --- /dev/null +++ b/examples/xml/doc/src/qxmlstreambookmarks.qdoc @@ -0,0 +1,194 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example xml/streambookmarks + \title QXmlStream Bookmarks Example + \brief Demonstrates how to read and write to XBEL files + \ingroup xml-examples + + The QXmlStream Bookmarks example provides a reader for XML Bookmark + Exchange Language (XBEL) files using Qt's QXmlStreamReader class + for reading, and QXmlStreamWriter class for writing the files. + + \image xmlstreamexample-screenshot.png + + \section1 XbelWriter Class Definition + + The \c XbelWriter class contains a private instance of QXmlStreamWriter, + which provides an XML writer with a streaming API. \c XbelWriter also + has a reference to the QTreeWidget instance where the bookmark hierarchy + is stored. + + \snippet streambookmarks/xbelwriter.h 0 + + \section1 XbelWriter Class Implementation + + The \c XbelWriter constructor accepts a \a treeWidget to initialize within + its definition. We enable \l{QXmlStreamWriter}'s auto-formatting property + to ensure line-breaks and indentations are added automatically to empty + sections between elements, increasing readability as the data is split into + several lines. + + \snippet streambookmarks/xbelwriter.cpp 0 + + The \c writeFile() function accepts a QIODevice object and sets it using + \c setDevice(). This function then writes the document type + definition(DTD), the start element, the version, and \c{treeWidget}'s + top-level items. + + \snippet streambookmarks/xbelwriter.cpp 1 + + The \c writeItem() function accepts a QTreeWidgetItem object and writes it + to the stream, depending on its \c tagName, which can either be a "folder", + "bookmark", or "separator". + + \snippet streambookmarks/xbelwriter.cpp 2 + + \section1 XbelReader Class Definition + + The \c XbelReader contains a private instance of QXmlStreamReader, the + companion class to QXmlStreamWriter. \c XbelReader also contains a + reference to the QTreeWidget that is used to group the bookmarks according + to their hierarchy. + + \snippet streambookmarks/xbelreader.h 0 + + \section1 XbelReader Class Implementation + + The \c XbelReader constructor accepts a QTreeWidget to initialize the + \c treeWidget within its definition. A QStyle object is used to set + \c{treeWidget}'s style property. The \c folderIcon is set to QIcon::Normal + mode where the pixmap is only displayed when the user is not interacting + with the icon. The QStyle::SP_DirClosedIcon, QStyle::SP_DirOpenIcon, and + QStyle::SP_FileIcon correspond to standard pixmaps that follow the style + of your GUI. + + \snippet streambookmarks/xbelreader.cpp 0 + + The \c read() function accepts a QIODevice and sets it using + \l{QXmlStreamReader::}{setDevice()}. The actual process of reading only + takes place if the file is a valid XBEL 1.0 file. Note that the XML input + needs to be well-formed to be accepted by QXmlStreamReader. Otherwise, the + \l{QXmlStreamReader::}{raiseError()} function is used to display an error + message. Since the XBEL reader is only concerned with reading XML elements, + it makes extensive use of the \l{QXmlStreamReader::}{readNextStartElement()} + convenience function. + + \snippet streambookmarks/xbelreader.cpp 1 + + The \c errorString() function is used if an error occurred, in order to + obtain a description of the error complete with line and column number + information. + + \snippet streambookmarks/xbelreader.cpp 2 + + The \c readXBEL() function reads the name of a startElement and calls + the appropriate function to read it, depending on whether if its a + "folder", "bookmark" or "separator". Otherwise, it calls + \l{QXmlStreamReader::}{skipCurrentElement()}. The Q_ASSERT() macro is used + to provide a pre-condition for the function. + + \snippet streambookmarks/xbelreader.cpp 3 + + The \c readTitle() function reads the bookmark's title. + + \snippet streambookmarks/xbelreader.cpp 4 + + The \c readSeparator() function creates a separator and sets its flags. + The text is set to 30 "0xB7", the HEX equivalent for period. The element + is then skipped using \l{QXmlStreamReader::}{skipCurrentElement()}. + + \snippet streambookmarks/xbelreader.cpp 5 + + \section1 MainWindow Class Definition + + The \c MainWindow class is a subclass of QMainWindow, with a + \c File menu and a \c Help menu. + + \snippet streambookmarks/mainwindow.h 0 + + \section1 MainWindow Class Implementation + + The \c MainWindow constructor instantiates the QTreeWidget object, \c + treeWidget and sets its header with a QStringList object, \c labels. + The constructor also invokes \c createActions() and \c createMenus() + to set up the menus and their corresponding actions. The \c statusBar() + is used to display the message "Ready" and the window's size is fixed + to 480x320 pixels. + + \snippet streambookmarks/mainwindow.cpp 0 + + The \c open() function enables the user to open an XBEL file using + QFileDialog::getOpenFileName(). A warning message is displayed along + with the \c fileName and \c errorString if the file cannot be read or + if there is a parse error. + + \snippet streambookmarks/mainwindow.cpp 1 + + The \c saveAs() function displays a QFileDialog, prompting the user for + a \c fileName using QFileDialog::getSaveFileName(). Similar to the + \c open() function, this function also displays a warning message if + the file cannot be written to. + + \snippet streambookmarks/mainwindow.cpp 2 + + The \c about() function displays a QMessageBox with a brief description + of the example. + + \snippet streambookmarks/mainwindow.cpp 3 + + In order to implement the \c open(), \c saveAs(), \c exit(), \c about() + and \c aboutQt() functions, we connect them to QAction objects and + add them to the \c fileMenu and \c helpMenu. The connections are as shown + below: + + \snippet streambookmarks/mainwindow.cpp 4 + + The \c createMenus() function creates the \c fileMenu and \c helpMenu + and adds the QAction objects to them in order to create the menu shown + in the screenshot below: + + \table + \row + \li \inlineimage xmlstreamexample-filemenu.png + \li \inlineimage xmlstreamexample-helpmenu.png + \endtable + + \snippet streambookmarks/mainwindow.cpp 5 + + \section1 \c{main()} Function + + The \c main() function instantiates \c MainWindow and invokes the \c show() + function. + + \snippet streambookmarks/main.cpp 0 + + See the \l{http://pyxml.sourceforge.net/topics/xbel/} + {XML Bookmark Exchange Language Resource Page} for more information + about XBEL files. +*/ diff --git a/examples/xml/doc/src/saxbookmarks.qdoc b/examples/xml/doc/src/saxbookmarks.qdoc index 9ed7611184..d45549bc1e 100644 --- a/examples/xml/doc/src/saxbookmarks.qdoc +++ b/examples/xml/doc/src/saxbookmarks.qdoc @@ -28,13 +28,14 @@ /*! \example saxbookmarks \title SAX Bookmarks Example + \brief Demonstrates how to read XBEL files + \ingroup xml-examples - \brief The SAX Bookmarks example provides a reader for XML Bookmark Exchange Language (XBEL) - files that uses Qt's SAX-based API to read and parse the files. The DOM Bookmarks + This example uses Qt's SAX API to read and parse the files. The DOM Bookmarks example provides an alternative way to read this type of file. \image saxbookmarks-example.png See the \l{XML Bookmark Exchange Language Resource Page} for more - information about XBEL files. + information about XBEL files. */ diff --git a/examples/xml/xml.pro b/examples/xml/xml.pro index 7c7b6f7456..bc8686a475 100644 --- a/examples/xml/xml.pro +++ b/examples/xml/xml.pro @@ -2,7 +2,7 @@ TEMPLATE = subdirs SUBDIRS = htmlinfo \ xmlstreamlint -!contains(QT_CONFIG, no-widgets) { +qtHaveModule(widgets) { SUBDIRS += dombookmarks \ rsslisting \ saxbookmarks \ |