diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2012-08-17 13:23:19 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-20 12:20:55 +0200 |
commit | 806dda08d685bc5f9ed71dfe8b61f21848d48066 (patch) | |
tree | a63533a1c4a335ae17adc105abb0ae4e62e2f26e /examples/widgets/widgets/groupbox | |
parent | 9f942014e31842b512c3198de035d041c59f54a9 (diff) |
Moving .qdoc files under examples/widgets/doc
Updated those .qdoc files to refer to the new relative examples
emplacement. Images and snippets to be moved later.
Also grouped all widgets related examples under widgets.
Change-Id: Ib29696e2d8948524537f53e8dda88f9ee26a597f
Reviewed-by: J-P Nurmi <j-p.nurmi@nokia.com>
Diffstat (limited to 'examples/widgets/widgets/groupbox')
-rw-r--r-- | examples/widgets/widgets/groupbox/groupbox.desktop | 11 | ||||
-rw-r--r-- | examples/widgets/widgets/groupbox/groupbox.pro | 13 | ||||
-rw-r--r-- | examples/widgets/widgets/groupbox/main.cpp | 51 | ||||
-rw-r--r-- | examples/widgets/widgets/groupbox/window.cpp | 189 | ||||
-rw-r--r-- | examples/widgets/widgets/groupbox/window.h | 66 |
5 files changed, 330 insertions, 0 deletions
diff --git a/examples/widgets/widgets/groupbox/groupbox.desktop b/examples/widgets/widgets/groupbox/groupbox.desktop new file mode 100644 index 0000000000..8239bbf5d0 --- /dev/null +++ b/examples/widgets/widgets/groupbox/groupbox.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Group Box +Exec=/opt/usr/bin/groupbox +Icon=groupbox +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/widgets/groupbox/groupbox.pro b/examples/widgets/widgets/groupbox/groupbox.pro new file mode 100644 index 0000000000..07c0ed8818 --- /dev/null +++ b/examples/widgets/widgets/groupbox/groupbox.pro @@ -0,0 +1,13 @@ +HEADERS = window.h +SOURCES = window.cpp \ + main.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets/groupbox +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS groupbox.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets/groupbox +INSTALLS += target sources + +QT += widgets + +simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/widgets/groupbox/main.cpp b/examples/widgets/widgets/groupbox/main.cpp new file mode 100644 index 0000000000..dcbf1c0449 --- /dev/null +++ b/examples/widgets/widgets/groupbox/main.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** 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 "window.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + Window window; + window.show(); + return app.exec(); +} diff --git a/examples/widgets/widgets/groupbox/window.cpp b/examples/widgets/widgets/groupbox/window.cpp new file mode 100644 index 0000000000..7436e2dfb6 --- /dev/null +++ b/examples/widgets/widgets/groupbox/window.cpp @@ -0,0 +1,189 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** 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 "window.h" + +//! [0] +Window::Window(QWidget *parent) + : QWidget(parent) +{ + QGridLayout *grid = new QGridLayout; + grid->addWidget(createFirstExclusiveGroup(), 0, 0); + grid->addWidget(createSecondExclusiveGroup(), 1, 0); + grid->addWidget(createNonExclusiveGroup(), 0, 1); + grid->addWidget(createPushButtonGroup(), 1, 1); + setLayout(grid); + + setWindowTitle(tr("Group Boxes")); + resize(480, 320); +} +//! [0] + +//! [1] +QGroupBox *Window::createFirstExclusiveGroup() +{ +//! [2] + QGroupBox *groupBox = new QGroupBox(tr("Exclusive Radio Buttons")); + + QRadioButton *radio1 = new QRadioButton(tr("&Radio button 1")); + QRadioButton *radio2 = new QRadioButton(tr("R&adio button 2")); + QRadioButton *radio3 = new QRadioButton(tr("Ra&dio button 3")); + + radio1->setChecked(true); +//! [1] //! [3] + + QVBoxLayout *vbox = new QVBoxLayout; + vbox->addWidget(radio1); + vbox->addWidget(radio2); + vbox->addWidget(radio3); + vbox->addStretch(1); + groupBox->setLayout(vbox); +//! [2] + + return groupBox; +} +//! [3] + +//! [4] +QGroupBox *Window::createSecondExclusiveGroup() +{ + QGroupBox *groupBox = new QGroupBox(tr("E&xclusive Radio Buttons")); + groupBox->setCheckable(true); + groupBox->setChecked(false); +//! [4] + +//! [5] + QRadioButton *radio1 = new QRadioButton(tr("Rad&io button 1")); + QRadioButton *radio2 = new QRadioButton(tr("Radi&o button 2")); + QRadioButton *radio3 = new QRadioButton(tr("Radio &button 3")); + radio1->setChecked(true); + QCheckBox *checkBox = new QCheckBox(tr("Ind&ependent checkbox")); + checkBox->setChecked(true); +//! [5] + +//! [6] + QVBoxLayout *vbox = new QVBoxLayout; + vbox->addWidget(radio1); + vbox->addWidget(radio2); + vbox->addWidget(radio3); + vbox->addWidget(checkBox); + vbox->addStretch(1); + groupBox->setLayout(vbox); + + return groupBox; +} +//! [6] + +//! [7] +QGroupBox *Window::createNonExclusiveGroup() +{ + QGroupBox *groupBox = new QGroupBox(tr("Non-Exclusive Checkboxes")); + groupBox->setFlat(true); +//! [7] + +//! [8] + QCheckBox *checkBox1 = new QCheckBox(tr("&Checkbox 1")); + QCheckBox *checkBox2 = new QCheckBox(tr("C&heckbox 2")); + checkBox2->setChecked(true); + QCheckBox *tristateBox = new QCheckBox(tr("Tri-&state button")); + tristateBox->setTristate(true); +//! [8] + tristateBox->setCheckState(Qt::PartiallyChecked); + +//! [9] + QVBoxLayout *vbox = new QVBoxLayout; + vbox->addWidget(checkBox1); + vbox->addWidget(checkBox2); + vbox->addWidget(tristateBox); + vbox->addStretch(1); + groupBox->setLayout(vbox); + + return groupBox; +} +//! [9] + +//! [10] +QGroupBox *Window::createPushButtonGroup() +{ + QGroupBox *groupBox = new QGroupBox(tr("&Push Buttons")); + groupBox->setCheckable(true); + groupBox->setChecked(true); +//! [10] + +//! [11] + QPushButton *pushButton = new QPushButton(tr("&Normal Button")); + QPushButton *toggleButton = new QPushButton(tr("&Toggle Button")); + toggleButton->setCheckable(true); + toggleButton->setChecked(true); + QPushButton *flatButton = new QPushButton(tr("&Flat Button")); + flatButton->setFlat(true); +//! [11] + +//! [12] + QPushButton *popupButton = new QPushButton(tr("Pop&up Button")); + QMenu *menu = new QMenu(this); + menu->addAction(tr("&First Item")); + menu->addAction(tr("&Second Item")); + menu->addAction(tr("&Third Item")); + menu->addAction(tr("F&ourth Item")); + popupButton->setMenu(menu); +//! [12] + + QAction *newAction = menu->addAction(tr("Submenu")); + QMenu *subMenu = new QMenu(tr("Popup Submenu")); + subMenu->addAction(tr("Item 1")); + subMenu->addAction(tr("Item 2")); + subMenu->addAction(tr("Item 3")); + newAction->setMenu(subMenu); + +//! [13] + QVBoxLayout *vbox = new QVBoxLayout; + vbox->addWidget(pushButton); + vbox->addWidget(toggleButton); + vbox->addWidget(flatButton); + vbox->addWidget(popupButton); + vbox->addStretch(1); + groupBox->setLayout(vbox); + + return groupBox; +} +//! [13] diff --git a/examples/widgets/widgets/groupbox/window.h b/examples/widgets/widgets/groupbox/window.h new file mode 100644 index 0000000000..a88374b429 --- /dev/null +++ b/examples/widgets/widgets/groupbox/window.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** 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 WINDOW_H +#define WINDOW_H + +#include <QWidget> + +QT_BEGIN_NAMESPACE +class QGroupBox; +QT_END_NAMESPACE + +//! [0] +class Window : public QWidget +{ + Q_OBJECT + +public: + Window(QWidget *parent = 0); + +private: + QGroupBox *createFirstExclusiveGroup(); + QGroupBox *createSecondExclusiveGroup(); + QGroupBox *createNonExclusiveGroup(); + QGroupBox *createPushButtonGroup(); +}; +//! [0] + +#endif |