diff options
Diffstat (limited to 'examples')
43 files changed, 899 insertions, 35 deletions
diff --git a/examples/designer/arthurplugin/plugin.cpp b/examples/designer/arthurplugin/plugin.cpp index 298e2f9ba..590c09113 100644 --- a/examples/designer/arthurplugin/plugin.cpp +++ b/examples/designer/arthurplugin/plugin.cpp @@ -43,8 +43,8 @@ #include <QtDesigner/QDesignerCustomWidgetInterface> #include <QtCore/qplugin.h> -#include <QtGui/QIcon> -#include <QtGui/QPixmap> +#include <QtWidgets/QIcon> +#include <QtWidgets/QPixmap> #include "xform.h" #include "pathdeform.h" diff --git a/examples/designer/calculatorbuilder/calculatorbuilder.pro b/examples/designer/calculatorbuilder/calculatorbuilder.pro index bf4fb1d13..1e0a35e42 100644 --- a/examples/designer/calculatorbuilder/calculatorbuilder.pro +++ b/examples/designer/calculatorbuilder/calculatorbuilder.pro @@ -5,6 +5,7 @@ HEADERS = calculatorform.h RESOURCES = calculatorbuilder.qrc SOURCES = calculatorform.cpp \ main.cpp +QT += widgets #! [0] # install diff --git a/examples/designer/calculatorbuilder/calculatorform.cpp b/examples/designer/calculatorbuilder/calculatorform.cpp index e14efa497..cc559e54a 100644 --- a/examples/designer/calculatorbuilder/calculatorform.cpp +++ b/examples/designer/calculatorbuilder/calculatorform.cpp @@ -41,7 +41,9 @@ //! [0] #include <QtUiTools> //! [0] -#include <QtGui> +#include <QSpinBox> +#include <QLabel> +#include <QVBoxLayout> #include "calculatorform.h" diff --git a/examples/designer/calculatorform/calculatorform.pro b/examples/designer/calculatorform/calculatorform.pro index 757d313c7..b2a7427c6 100644 --- a/examples/designer/calculatorform/calculatorform.pro +++ b/examples/designer/calculatorform/calculatorform.pro @@ -5,6 +5,7 @@ FORMS = calculatorform.ui #! [1] SOURCES = calculatorform.cpp \ main.cpp +QT += widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qttools/designer/calculatorform diff --git a/examples/designer/containerextension/containerextension.pro b/examples/designer/containerextension/containerextension.pro index a7bc02f4c..fc7a1ff81 100644 --- a/examples/designer/containerextension/containerextension.pro +++ b/examples/designer/containerextension/containerextension.pro @@ -4,6 +4,7 @@ TEMPLATE = lib TARGET = $$qtLibraryTarget($$TARGET) #! [1] CONFIG += designer plugin +QT += widgets #! [1] DESTDIR = $$QT.designer.plugins/designer diff --git a/examples/designer/containerextension/multipagewidget.cpp b/examples/designer/containerextension/multipagewidget.cpp index 5b44f36d2..ff2418b0c 100644 --- a/examples/designer/containerextension/multipagewidget.cpp +++ b/examples/designer/containerextension/multipagewidget.cpp @@ -38,7 +38,9 @@ ** ****************************************************************************/ -#include <QtGui> +#include <QComboBox> +#include <QVBoxLayout> +#include <QStackedWidget> #include "multipagewidget.h" diff --git a/examples/designer/customwidgetplugin/customwidgetplugin.pro b/examples/designer/customwidgetplugin/customwidgetplugin.pro index 3af8cc133..e70fe6575 100644 --- a/examples/designer/customwidgetplugin/customwidgetplugin.pro +++ b/examples/designer/customwidgetplugin/customwidgetplugin.pro @@ -1,5 +1,6 @@ #! [0] #! [1] CONFIG += designer plugin +QT += widgets #! [0] TARGET = $$qtLibraryTarget($$TARGET) #! [2] diff --git a/examples/designer/taskmenuextension/taskmenuextension.pro b/examples/designer/taskmenuextension/taskmenuextension.pro index 4e5df7d1b..aaf3ab89c 100644 --- a/examples/designer/taskmenuextension/taskmenuextension.pro +++ b/examples/designer/taskmenuextension/taskmenuextension.pro @@ -4,6 +4,7 @@ TEMPLATE = lib TARGET = $$qtLibraryTarget($$TARGET) #! [1] CONFIG += designer plugin +QT += widgets #! [1] DESTDIR = $$QT.designer.plugins/designer diff --git a/examples/designer/taskmenuextension/tictactoedialog.cpp b/examples/designer/taskmenuextension/tictactoedialog.cpp index 5af3c6f30..5b6a8c4a3 100644 --- a/examples/designer/taskmenuextension/tictactoedialog.cpp +++ b/examples/designer/taskmenuextension/tictactoedialog.cpp @@ -38,7 +38,9 @@ ** ****************************************************************************/ -#include <QtGui> +#include <QDialogButtonBox> +#include <QPushButton> +#include <QVBoxLayout> #include <QtDesigner> #include "tictactoe.h" diff --git a/examples/designer/worldtimeclockbuilder/main.cpp b/examples/designer/worldtimeclockbuilder/main.cpp index 680394190..e54a95a99 100644 --- a/examples/designer/worldtimeclockbuilder/main.cpp +++ b/examples/designer/worldtimeclockbuilder/main.cpp @@ -41,8 +41,8 @@ //! [0] #include <QtUiTools> //! [0] -#include <QtGui> - +#include <QApplication> +#include <QWidget> //! [1] int main(int argc, char *argv[]) { diff --git a/examples/designer/worldtimeclockbuilder/worldtimeclockbuilder.pro b/examples/designer/worldtimeclockbuilder/worldtimeclockbuilder.pro index 6d1164d55..005e35043 100644 --- a/examples/designer/worldtimeclockbuilder/worldtimeclockbuilder.pro +++ b/examples/designer/worldtimeclockbuilder/worldtimeclockbuilder.pro @@ -1,5 +1,6 @@ #! [0] CONFIG += uitools +QT += widgets SOURCES = main.cpp RESOURCES = worldtimeclockbuilder.qrc #! [0] diff --git a/examples/designer/worldtimeclockplugin/worldtimeclockplugin.pro b/examples/designer/worldtimeclockplugin/worldtimeclockplugin.pro index e394a3dc8..8caad5e92 100644 --- a/examples/designer/worldtimeclockplugin/worldtimeclockplugin.pro +++ b/examples/designer/worldtimeclockplugin/worldtimeclockplugin.pro @@ -1,5 +1,6 @@ #! [0] CONFIG += designer plugin +QT += widgets #! [0] TARGET = $$qtLibraryTarget($$TARGET) #! [1] diff --git a/examples/examples.pro b/examples/examples.pro index e2f2c617f..3c12ee67c 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -1,2 +1,2 @@ TEMPLATE = subdirs -SUBDIRS += help designer +SUBDIRS += help designer uitools diff --git a/examples/help/contextsensitivehelp/contextsensitivehelp.pro b/examples/help/contextsensitivehelp/contextsensitivehelp.pro index 8941dcbb1..9fa1a2a66 100644 --- a/examples/help/contextsensitivehelp/contextsensitivehelp.pro +++ b/examples/help/contextsensitivehelp/contextsensitivehelp.pro @@ -1,7 +1,7 @@ TEMPLATE = app CONFIG += help - +QT += widgets SOURCES += main.cpp \ wateringconfigdialog.cpp \ helpbrowser.cpp diff --git a/examples/help/contextsensitivehelp/helpbrowser.cpp b/examples/help/contextsensitivehelp/helpbrowser.cpp index d37a72f3b..2182cf57b 100644 --- a/examples/help/contextsensitivehelp/helpbrowser.cpp +++ b/examples/help/contextsensitivehelp/helpbrowser.cpp @@ -39,7 +39,7 @@ ****************************************************************************/ #include <QtCore/QLibraryInfo> -#include <QtGui/QApplication> +#include <QtWidgets/QApplication> #include <QtHelp/QHelpEngineCore> #include "helpbrowser.h" diff --git a/examples/help/contextsensitivehelp/helpbrowser.h b/examples/help/contextsensitivehelp/helpbrowser.h index 684ed6827..245772ac9 100644 --- a/examples/help/contextsensitivehelp/helpbrowser.h +++ b/examples/help/contextsensitivehelp/helpbrowser.h @@ -41,7 +41,7 @@ #ifndef HELPBROWSER_H #define HELPBROWSER_H -#include <QtGui/QTextBrowser> +#include <QtWidgets/QTextBrowser> QT_BEGIN_NAMESPACE class QHelpEngineCore; diff --git a/examples/help/contextsensitivehelp/main.cpp b/examples/help/contextsensitivehelp/main.cpp index ca15d9fb6..d635db298 100644 --- a/examples/help/contextsensitivehelp/main.cpp +++ b/examples/help/contextsensitivehelp/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include <QtGui/QApplication> +#include <QtWidgets/QApplication> #include "wateringconfigdialog.h" diff --git a/examples/help/contextsensitivehelp/wateringconfigdialog.h b/examples/help/contextsensitivehelp/wateringconfigdialog.h index d1fd98643..835c46ec0 100644 --- a/examples/help/contextsensitivehelp/wateringconfigdialog.h +++ b/examples/help/contextsensitivehelp/wateringconfigdialog.h @@ -41,7 +41,7 @@ #ifndef WATERINGCONFIGDIALOG_H #define WATERINGCONFIGDIALOG_H -#include <QtGui/QDialog> +#include <QtWidgets/QDialog> #include "ui_wateringconfigdialog.h" class WateringConfigDialog : public QDialog diff --git a/examples/help/remotecontrol/main.cpp b/examples/help/remotecontrol/main.cpp index ad561ce4f..583c2e494 100644 --- a/examples/help/remotecontrol/main.cpp +++ b/examples/help/remotecontrol/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include <QtGui/QApplication> +#include <QtWidgets/QApplication> #include "remotecontrol.h" int main(int argc, char *argv[]) diff --git a/examples/help/remotecontrol/remotecontrol.cpp b/examples/help/remotecontrol/remotecontrol.cpp index 45d3fde82..d666489fb 100644 --- a/examples/help/remotecontrol/remotecontrol.cpp +++ b/examples/help/remotecontrol/remotecontrol.cpp @@ -43,7 +43,7 @@ #include <QtCore/QTextStream> #include <QtCore/QLibraryInfo> -#include <QtGui/QMessageBox> +#include <QtWidgets/QMessageBox> #include "remotecontrol.h" diff --git a/examples/help/remotecontrol/remotecontrol.h b/examples/help/remotecontrol/remotecontrol.h index e440add3f..16bd3f33c 100644 --- a/examples/help/remotecontrol/remotecontrol.h +++ b/examples/help/remotecontrol/remotecontrol.h @@ -41,7 +41,7 @@ #ifndef REMOTECONTROL_H #define REMOTECONTROL_H -#include <QtGui/QMainWindow> +#include <QtWidgets/QMainWindow> #include "ui_remotecontrol.h" QT_BEGIN_NAMESPACE diff --git a/examples/help/remotecontrol/remotecontrol.pro b/examples/help/remotecontrol/remotecontrol.pro index 2212db040..79fb7c1be 100644 --- a/examples/help/remotecontrol/remotecontrol.pro +++ b/examples/help/remotecontrol/remotecontrol.pro @@ -1,4 +1,5 @@ TEMPLATE = app +QT += widgets HEADERS += remotecontrol.h SOURCES += main.cpp \ diff --git a/examples/help/simpletextviewer/assistant.cpp b/examples/help/simpletextviewer/assistant.cpp index 2223b4bbf..392f2260e 100644 --- a/examples/help/simpletextviewer/assistant.cpp +++ b/examples/help/simpletextviewer/assistant.cpp @@ -43,7 +43,7 @@ #include <QtCore/QLibraryInfo> #include <QtCore/QProcess> -#include <QtGui/QMessageBox> +#include <QtWidgets/QMessageBox> #include "assistant.h" diff --git a/examples/help/simpletextviewer/findfiledialog.cpp b/examples/help/simpletextviewer/findfiledialog.cpp index 086be965d..bbaf038d7 100644 --- a/examples/help/simpletextviewer/findfiledialog.cpp +++ b/examples/help/simpletextviewer/findfiledialog.cpp @@ -39,15 +39,15 @@ ****************************************************************************/ #include <QtCore/QDir> -#include <QtGui/QLayout> -#include <QtGui/QComboBox> -#include <QtGui/QTreeWidget> -#include <QtGui/QLayout> -#include <QtGui/QFileDialog> -#include <QtGui/QDialogButtonBox> -#include <QtGui/QToolButton> -#include <QtGui/QPushButton> -#include <QtGui/QLabel> +#include <QtWidgets/QLayout> +#include <QtWidgets/QComboBox> +#include <QtWidgets/QTreeWidget> +#include <QtWidgets/QLayout> +#include <QtWidgets/QFileDialog> +#include <QtWidgets/QDialogButtonBox> +#include <QtWidgets/QToolButton> +#include <QtWidgets/QPushButton> +#include <QtWidgets/QLabel> #include "findfiledialog.h" #include "assistant.h" diff --git a/examples/help/simpletextviewer/findfiledialog.h b/examples/help/simpletextviewer/findfiledialog.h index 71abd4aac..9df00edbd 100644 --- a/examples/help/simpletextviewer/findfiledialog.h +++ b/examples/help/simpletextviewer/findfiledialog.h @@ -41,7 +41,7 @@ #ifndef FINDFILEDIALOG_H #define FINDFILEDIALOG_H -#include <QtGui/QDialog> +#include <QtWidgets/QDialog> QT_BEGIN_NAMESPACE class QComboBox; diff --git a/examples/help/simpletextviewer/main.cpp b/examples/help/simpletextviewer/main.cpp index 4c8aab9c8..8780e0d3a 100644 --- a/examples/help/simpletextviewer/main.cpp +++ b/examples/help/simpletextviewer/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include <QtGui/QApplication> +#include <QtWidgets/QApplication> #include "mainwindow.h" diff --git a/examples/help/simpletextviewer/mainwindow.cpp b/examples/help/simpletextviewer/mainwindow.cpp index 61fbdf3cb..c84c78c2f 100644 --- a/examples/help/simpletextviewer/mainwindow.cpp +++ b/examples/help/simpletextviewer/mainwindow.cpp @@ -39,11 +39,11 @@ ****************************************************************************/ #include <QtCore/QLibraryInfo> -#include <QtGui/QApplication> -#include <QtGui/QAction> -#include <QtGui/QMenu> -#include <QtGui/QMenuBar> -#include <QtGui/QMessageBox> +#include <QtWidgets/QApplication> +#include <QtWidgets/QAction> +#include <QtWidgets/QMenu> +#include <QtWidgets/QMenuBar> +#include <QtWidgets/QMessageBox> #include "mainwindow.h" #include "findfiledialog.h" diff --git a/examples/help/simpletextviewer/mainwindow.h b/examples/help/simpletextviewer/mainwindow.h index 4fab382f2..8c2f84123 100644 --- a/examples/help/simpletextviewer/mainwindow.h +++ b/examples/help/simpletextviewer/mainwindow.h @@ -41,7 +41,7 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include <QtGui/QMainWindow> +#include <QtWidgets/QMainWindow> class Assistant; class TextEdit; diff --git a/examples/help/simpletextviewer/simpletextviewer.pro b/examples/help/simpletextviewer/simpletextviewer.pro index b51c141c0..5ef14c44a 100644 --- a/examples/help/simpletextviewer/simpletextviewer.pro +++ b/examples/help/simpletextviewer/simpletextviewer.pro @@ -8,6 +8,8 @@ SOURCES = main.cpp \ assistant.cpp \ textedit.cpp +QT += widgets + # install target.path = $$[QT_INSTALL_EXAMPLES]/qttools/help/simpletextviewer sources.files = $$SOURCES $$HEADERS $$RESOURCES documentation *.pro diff --git a/examples/help/simpletextviewer/textedit.h b/examples/help/simpletextviewer/textedit.h index b9ecabd1d..6222ac189 100644 --- a/examples/help/simpletextviewer/textedit.h +++ b/examples/help/simpletextviewer/textedit.h @@ -42,7 +42,7 @@ #define TEXTEDIT_H #include <QtCore/QUrl> -#include <QtGui/QTextEdit> +#include <QtWidgets/QTextEdit> class TextEdit : public QTextEdit { diff --git a/examples/uitools/multipleinheritance/calculatorform.cpp b/examples/uitools/multipleinheritance/calculatorform.cpp new file mode 100644 index 000000000..ae1312f55 --- /dev/null +++ b/examples/uitools/multipleinheritance/calculatorform.cpp @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 Nokia Corporation 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 "calculatorform.h" + + +//! [0] +CalculatorForm::CalculatorForm(QWidget *parent) + : QWidget(parent) +{ + setupUi(this); +} +//! [0] + +//! [1] +void CalculatorForm::on_inputSpinBox1_valueChanged(int value) +{ + outputWidget->setText(QString::number(value + inputSpinBox2->value())); +} +//! [1] + +//! [2] +void CalculatorForm::on_inputSpinBox2_valueChanged(int value) +{ + outputWidget->setText(QString::number(value + inputSpinBox1->value())); +} +//! [2] diff --git a/examples/uitools/multipleinheritance/calculatorform.h b/examples/uitools/multipleinheritance/calculatorform.h new file mode 100644 index 000000000..9b8c8880b --- /dev/null +++ b/examples/uitools/multipleinheritance/calculatorform.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 Nokia Corporation 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 CALCULATORFORM_H +#define CALCULATORFORM_H + +//! [0] +#include "ui_calculatorform.h" +//! [0] + +//! [1] +class CalculatorForm : public QWidget, private Ui::CalculatorForm +{ + Q_OBJECT + +public: + CalculatorForm(QWidget *parent = 0); + +private slots: + void on_inputSpinBox1_valueChanged(int value); + void on_inputSpinBox2_valueChanged(int value); +}; +//! [1] + +#endif diff --git a/examples/uitools/multipleinheritance/calculatorform.ui b/examples/uitools/multipleinheritance/calculatorform.ui new file mode 100644 index 000000000..dda0e62dd --- /dev/null +++ b/examples/uitools/multipleinheritance/calculatorform.ui @@ -0,0 +1,303 @@ +<ui version="4.0" > + <author></author> + <comment></comment> + <exportmacro></exportmacro> + <class>CalculatorForm</class> + <widget class="QWidget" name="CalculatorForm" > + <property name="objectName" > + <string notr="true" >CalculatorForm</string> + </property> + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>276</width> + <height>98</height> + </rect> + </property> + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="windowTitle" > + <string>Calculator Builder</string> + </property> + <layout class="QGridLayout" > + <property name="objectName" > + <string notr="true" /> + </property> + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item row="0" column="0" > + <layout class="QHBoxLayout" > + <property name="objectName" > + <string notr="true" /> + </property> + <property name="margin" > + <number>1</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <layout class="QVBoxLayout" > + <property name="objectName" > + <string notr="true" /> + </property> + <property name="margin" > + <number>1</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QLabel" name="label" > + <property name="objectName" > + <string notr="true" >label</string> + </property> + <property name="geometry" > + <rect> + <x>1</x> + <y>1</y> + <width>45</width> + <height>19</height> + </rect> + </property> + <property name="text" > + <string>Input 1</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="inputSpinBox1" > + <property name="objectName" > + <string notr="true" >inputSpinBox1</string> + </property> + <property name="geometry" > + <rect> + <x>1</x> + <y>26</y> + <width>45</width> + <height>25</height> + </rect> + </property> + <property name="mouseTracking" > + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QLabel" name="label_3" > + <property name="objectName" > + <string notr="true" >label_3</string> + </property> + <property name="geometry" > + <rect> + <x>54</x> + <y>1</y> + <width>7</width> + <height>52</height> + </rect> + </property> + <property name="text" > + <string>+</string> + </property> + <property name="alignment" > + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <layout class="QVBoxLayout" > + <property name="objectName" > + <string notr="true" /> + </property> + <property name="margin" > + <number>1</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QLabel" name="label_2" > + <property name="objectName" > + <string notr="true" >label_2</string> + </property> + <property name="geometry" > + <rect> + <x>1</x> + <y>1</y> + <width>45</width> + <height>19</height> + </rect> + </property> + <property name="text" > + <string>Input 2</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="inputSpinBox2" > + <property name="objectName" > + <string notr="true" >inputSpinBox2</string> + </property> + <property name="geometry" > + <rect> + <x>1</x> + <y>26</y> + <width>45</width> + <height>25</height> + </rect> + </property> + <property name="mouseTracking" > + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QLabel" name="label_3_2" > + <property name="objectName" > + <string notr="true" >label_3_2</string> + </property> + <property name="geometry" > + <rect> + <x>120</x> + <y>1</y> + <width>7</width> + <height>52</height> + </rect> + </property> + <property name="text" > + <string>=</string> + </property> + <property name="alignment" > + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <layout class="QVBoxLayout" > + <property name="objectName" > + <string notr="true" /> + </property> + <property name="margin" > + <number>1</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QLabel" name="label_2_2_2" > + <property name="objectName" > + <string notr="true" >label_2_2_2</string> + </property> + <property name="geometry" > + <rect> + <x>1</x> + <y>1</y> + <width>37</width> + <height>17</height> + </rect> + </property> + <property name="text" > + <string>Output</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="outputWidget" > + <property name="objectName" > + <string notr="true" >outputWidget</string> + </property> + <property name="geometry" > + <rect> + <x>1</x> + <y>24</y> + <width>37</width> + <height>27</height> + </rect> + </property> + <property name="frameShape" > + <enum>QFrame::Box</enum> + </property> + <property name="frameShadow" > + <enum>QFrame::Sunken</enum> + </property> + <property name="text" > + <string>0</string> + </property> + <property name="alignment" > + <set>Qt::AlignAbsolute|Qt::AlignBottom|Qt::AlignCenter|Qt::AlignHCenter|Qt::AlignHorizontal_Mask|Qt::AlignJustify|Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing|Qt::AlignVCenter|Qt::AlignVertical_Mask</set> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + <item row="1" column="0" > + <spacer> + <property name="objectName" > + <string notr="true" >verticalSpacer</string> + </property> + <property name="geometry" > + <rect> + <x>85</x> + <y>69</y> + <width>20</width> + <height>20</height> + </rect> + </property> + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" > + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="1" > + <spacer> + <property name="objectName" > + <string notr="true" >horizontalSpacer</string> + </property> + <property name="geometry" > + <rect> + <x>188</x> + <y>26</y> + <width>79</width> + <height>20</height> + </rect> + </property> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <pixmapfunction></pixmapfunction> + <resources/> + <connections/> +</ui> diff --git a/examples/uitools/multipleinheritance/main.cpp b/examples/uitools/multipleinheritance/main.cpp new file mode 100644 index 000000000..56ba8efe5 --- /dev/null +++ b/examples/uitools/multipleinheritance/main.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 Nokia Corporation 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 "calculatorform.h" + +//! [0] +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + CalculatorForm calculator; +#if defined(Q_OS_SYMBIAN) + calculator.showMaximized(); +#else + calculator.show(); +#endif + return app.exec(); +} +//! [0] diff --git a/examples/uitools/multipleinheritance/multipleinheritance.desktop b/examples/uitools/multipleinheritance/multipleinheritance.desktop new file mode 100644 index 000000000..7e652f972 --- /dev/null +++ b/examples/uitools/multipleinheritance/multipleinheritance.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Multiple Inheritance +Exec=/opt/usr/bin/multipleinheritance +Icon=multipleinheritance +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/uitools/multipleinheritance/multipleinheritance.pro b/examples/uitools/multipleinheritance/multipleinheritance.pro new file mode 100644 index 000000000..7e6496741 --- /dev/null +++ b/examples/uitools/multipleinheritance/multipleinheritance.pro @@ -0,0 +1,19 @@ +#! [0] +SOURCES = calculatorform.cpp main.cpp +HEADERS = calculatorform.h +FORMS = calculatorform.ui +#! [0] + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/uitools/multipleinheritance +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/uitools/multipleinheritance +INSTALLS += target sources + +symbian { + TARGET.UID3 = 0xA000D7C1 + CONFIG += qt_example +} +QT += widgets +maemo5: CONFIG += qt_example + diff --git a/examples/uitools/textfinder/main.cpp b/examples/uitools/textfinder/main.cpp new file mode 100644 index 000000000..2fe9b715d --- /dev/null +++ b/examples/uitools/textfinder/main.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 Nokia Corporation 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 "textfinder.h" + +//! [0] +int main(int argc, char *argv[]) +{ + Q_INIT_RESOURCE(textfinder); + QApplication app(argc, argv); + + TextFinder *textFinder = new TextFinder; + textFinder->show(); + + return app.exec(); +} +//! [0] diff --git a/examples/uitools/textfinder/textfinder.cpp b/examples/uitools/textfinder/textfinder.cpp new file mode 100644 index 000000000..041c36f21 --- /dev/null +++ b/examples/uitools/textfinder/textfinder.cpp @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 Nokia Corporation 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 <QtUiTools> +#include <QtWidgets> +#include "textfinder.h" + +//! [0] +TextFinder::TextFinder(QWidget *parent) + : QWidget(parent) +{ + QWidget *formWidget = loadUiFile(); + +//! [1] + ui_findButton = findChild<QPushButton*>("findButton"); + ui_textEdit = findChild<QTextEdit*>("textEdit"); + ui_lineEdit = findChild<QLineEdit*>("lineEdit"); +//! [0] //! [1] + +//! [2] + QMetaObject::connectSlotsByName(this); +//! [2] + +//! [3a] + loadTextFile(); +//! [3a] + +//! [3b] + QVBoxLayout *layout = new QVBoxLayout; + layout->addWidget(formWidget); + setLayout(layout); +//! [3b] + +//! [3c] + setWindowTitle(tr("Text Finder")); + isFirstTime = true; +} +//! [3c] + +//! [4] +QWidget* TextFinder::loadUiFile() +{ + QUiLoader loader; + + QFile file(":/forms/textfinder.ui"); + file.open(QFile::ReadOnly); + + QWidget *formWidget = loader.load(&file, this); + file.close(); + + return formWidget; +} +//! [4] + +//! [5] +void TextFinder::loadTextFile() +{ + QFile inputFile(":/forms/input.txt"); + inputFile.open(QIODevice::ReadOnly); + QTextStream in(&inputFile); + QString line = in.readAll(); + inputFile.close(); + + ui_textEdit->append(line); + ui_textEdit->setUndoRedoEnabled(false); + ui_textEdit->setUndoRedoEnabled(true); +} +//! [5] + +//! [6] //! [7] +void TextFinder::on_findButton_clicked() +{ + QString searchString = ui_lineEdit->text(); + QTextDocument *document = ui_textEdit->document(); + + bool found = false; + + if (isFirstTime == false) + document->undo(); + + if (searchString.isEmpty()) { + QMessageBox::information(this, tr("Empty Search Field"), + "The search field is empty. Please enter a word and click Find."); + } else { + + QTextCursor highlightCursor(document); + QTextCursor cursor(document); + + cursor.beginEditBlock(); +//! [6] + + QTextCharFormat plainFormat(highlightCursor.charFormat()); + QTextCharFormat colorFormat = plainFormat; + colorFormat.setForeground(Qt::red); + + while (!highlightCursor.isNull() && !highlightCursor.atEnd()) { + highlightCursor = document->find(searchString, highlightCursor, QTextDocument::FindWholeWords); + + if (!highlightCursor.isNull()) { + found = true; + highlightCursor.movePosition(QTextCursor::WordRight, + QTextCursor::KeepAnchor); + highlightCursor.mergeCharFormat(colorFormat); + } + } + +//! [8] + cursor.endEditBlock(); +//! [7] //! [9] + isFirstTime = false; + + if (found == false) { + QMessageBox::information(this, tr("Word Not Found"), + "Sorry, the word cannot be found."); + } + } +} +//! [8] //! [9] diff --git a/examples/uitools/textfinder/textfinder.desktop b/examples/uitools/textfinder/textfinder.desktop new file mode 100644 index 000000000..e1911cc61 --- /dev/null +++ b/examples/uitools/textfinder/textfinder.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Text Finder +Exec=/opt/usr/bin/textfinder +Icon=textfinder +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/uitools/textfinder/textfinder.h b/examples/uitools/textfinder/textfinder.h new file mode 100644 index 000000000..c3cd030cb --- /dev/null +++ b/examples/uitools/textfinder/textfinder.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 Nokia Corporation 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 TEXTFINDER_H +#define TEXTFINDER_H + +#include <QWidget> + +QT_BEGIN_NAMESPACE +class QPushButton; +class QTextEdit; +class QLineEdit; +QT_END_NAMESPACE + +//! [0] +class TextFinder : public QWidget +{ + Q_OBJECT + +public: + TextFinder(QWidget *parent = 0); + +private slots: + void on_findButton_clicked(); + +private: + QWidget* loadUiFile(); + void loadTextFile(); + + QPushButton *ui_findButton; + QTextEdit *ui_textEdit; + QLineEdit *ui_lineEdit; + bool isFirstTime; +}; +//! [0] + +#endif diff --git a/examples/uitools/textfinder/textfinder.pro b/examples/uitools/textfinder/textfinder.pro new file mode 100644 index 000000000..337b7216e --- /dev/null +++ b/examples/uitools/textfinder/textfinder.pro @@ -0,0 +1,17 @@ +CONFIG += uitools +HEADERS = textfinder.h +RESOURCES = textfinder.qrc +SOURCES = textfinder.cpp main.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/uitools/textfinder +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro forms +sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/uitools/textfinder +INSTALLS += target sources + +symbian: CONFIG += qt_example +QT += widgets +maemo5: CONFIG += qt_example + +symbian: warning(This example does not work on Symbian platform) +simulator: warning(This example does not work on Simulator platform) diff --git a/examples/uitools/textfinder/textfinder.qrc b/examples/uitools/textfinder/textfinder.qrc new file mode 100644 index 000000000..a4cea8a77 --- /dev/null +++ b/examples/uitools/textfinder/textfinder.qrc @@ -0,0 +1,6 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource> + <file>forms/textfinder.ui</file> + <file>forms/input.txt</file> +</qresource> +</RCC>
\ No newline at end of file diff --git a/examples/uitools/uitools.pro b/examples/uitools/uitools.pro new file mode 100644 index 000000000..f17de666f --- /dev/null +++ b/examples/uitools/uitools.pro @@ -0,0 +1,14 @@ +TEMPLATE = subdirs +SUBDIRS = multipleinheritance + +!wince*:!symbian:contains(QT_BUILD_PARTS, tools): SUBDIRS += textfinder + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/uitools +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS uitools.pro README +sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/uitools +INSTALLS += target sources + +symbian: CONFIG += qt_example +QT += widgets +maemo5: CONFIG += qt_example |