summaryrefslogtreecommitdiffstats
path: root/examples/widgets/icons
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2012-08-17 13:23:19 +0200
committerQt by Nokia <qt-info@nokia.com>2012-08-20 12:20:55 +0200
commit806dda08d685bc5f9ed71dfe8b61f21848d48066 (patch)
treea63533a1c4a335ae17adc105abb0ae4e62e2f26e /examples/widgets/icons
parent9f942014e31842b512c3198de035d041c59f54a9 (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/icons')
-rw-r--r--examples/widgets/icons/iconpreviewarea.cpp141
-rw-r--r--examples/widgets/icons/iconpreviewarea.h77
-rw-r--r--examples/widgets/icons/icons.desktop11
-rw-r--r--examples/widgets/icons/icons.pro29
-rw-r--r--examples/widgets/icons/iconsizespinbox.cpp70
-rw-r--r--examples/widgets/icons/iconsizespinbox.h59
-rw-r--r--examples/widgets/icons/imagedelegate.cpp105
-rw-r--r--examples/widgets/icons/imagedelegate.h68
-rw-r--r--examples/widgets/icons/images/designer.pngbin4205 -> 0 bytes
-rw-r--r--examples/widgets/icons/images/find_disabled.pngbin501 -> 0 bytes
-rw-r--r--examples/widgets/icons/images/find_normal.pngbin838 -> 0 bytes
-rw-r--r--examples/widgets/icons/images/monkey_off_128x128.pngbin7045 -> 0 bytes
-rw-r--r--examples/widgets/icons/images/monkey_off_16x16.pngbin683 -> 0 bytes
-rw-r--r--examples/widgets/icons/images/monkey_off_32x32.pngbin1609 -> 0 bytes
-rw-r--r--examples/widgets/icons/images/monkey_off_64x64.pngbin3533 -> 0 bytes
-rw-r--r--examples/widgets/icons/images/monkey_on_128x128.pngbin6909 -> 0 bytes
-rw-r--r--examples/widgets/icons/images/monkey_on_16x16.pngbin681 -> 0 bytes
-rw-r--r--examples/widgets/icons/images/monkey_on_32x32.pngbin1577 -> 0 bytes
-rw-r--r--examples/widgets/icons/images/monkey_on_64x64.pngbin3479 -> 0 bytes
-rw-r--r--examples/widgets/icons/images/qt_extended_16x16.pngbin834 -> 0 bytes
-rw-r--r--examples/widgets/icons/images/qt_extended_32x32.pngbin1892 -> 0 bytes
-rw-r--r--examples/widgets/icons/images/qt_extended_48x48.pngbin3672 -> 0 bytes
-rw-r--r--examples/widgets/icons/main.cpp51
-rw-r--r--examples/widgets/icons/mainwindow.cpp442
-rw-r--r--examples/widgets/icons/mainwindow.h116
25 files changed, 0 insertions, 1169 deletions
diff --git a/examples/widgets/icons/iconpreviewarea.cpp b/examples/widgets/icons/iconpreviewarea.cpp
deleted file mode 100644
index 53391c7f4f..0000000000
--- a/examples/widgets/icons/iconpreviewarea.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/****************************************************************************
-**
-** 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 "iconpreviewarea.h"
-
-//! [0]
-IconPreviewArea::IconPreviewArea(QWidget *parent)
- : QWidget(parent)
-{
- QGridLayout *mainLayout = new QGridLayout;
- setLayout(mainLayout);
-
- stateLabels[0] = createHeaderLabel(tr("Off"));
- stateLabels[1] = createHeaderLabel(tr("On"));
- Q_ASSERT(NumStates == 2);
-
- modeLabels[0] = createHeaderLabel(tr("Normal"));
- modeLabels[1] = createHeaderLabel(tr("Active"));
- modeLabels[2] = createHeaderLabel(tr("Disabled"));
- modeLabels[3] = createHeaderLabel(tr("Selected"));
- Q_ASSERT(NumModes == 4);
-
- for (int j = 0; j < NumStates; ++j)
- mainLayout->addWidget(stateLabels[j], j + 1, 0);
-
- for (int i = 0; i < NumModes; ++i) {
- mainLayout->addWidget(modeLabels[i], 0, i + 1);
-
- for (int j = 0; j < NumStates; ++j) {
- pixmapLabels[i][j] = createPixmapLabel();
- mainLayout->addWidget(pixmapLabels[i][j], j + 1, i + 1);
- }
- }
-}
-//! [0]
-
-//! [1]
-void IconPreviewArea::setIcon(const QIcon &icon)
-{
- this->icon = icon;
- updatePixmapLabels();
-}
-//! [1]
-
-//! [2]
-void IconPreviewArea::setSize(const QSize &size)
-{
- if (size != this->size) {
- this->size = size;
- updatePixmapLabels();
- }
-}
-//! [2]
-
-//! [3]
-QLabel *IconPreviewArea::createHeaderLabel(const QString &text)
-{
- QLabel *label = new QLabel(tr("<b>%1</b>").arg(text));
- label->setAlignment(Qt::AlignCenter);
- return label;
-}
-//! [3]
-
-//! [4]
-QLabel *IconPreviewArea::createPixmapLabel()
-{
- QLabel *label = new QLabel;
- label->setEnabled(false);
- label->setAlignment(Qt::AlignCenter);
- label->setFrameShape(QFrame::Box);
- label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- label->setBackgroundRole(QPalette::Base);
- label->setAutoFillBackground(true);
- label->setMinimumSize(132, 132);
- return label;
-}
-//! [4]
-
-//! [5]
-void IconPreviewArea::updatePixmapLabels()
-{
- for (int i = 0; i < NumModes; ++i) {
- QIcon::Mode mode;
- if (i == 0) {
- mode = QIcon::Normal;
- } else if (i == 1) {
- mode = QIcon::Active;
- } else if (i == 2) {
- mode = QIcon::Disabled;
- } else {
- mode = QIcon::Selected;
- }
-
- for (int j = 0; j < NumStates; ++j) {
- QIcon::State state = (j == 0) ? QIcon::Off : QIcon::On;
- QPixmap pixmap = icon.pixmap(size, mode, state);
- pixmapLabels[i][j]->setPixmap(pixmap);
- pixmapLabels[i][j]->setEnabled(!pixmap.isNull());
- }
- }
-}
-//! [5]
diff --git a/examples/widgets/icons/iconpreviewarea.h b/examples/widgets/icons/iconpreviewarea.h
deleted file mode 100644
index 4c6bc92dbc..0000000000
--- a/examples/widgets/icons/iconpreviewarea.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** 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 ICONPREVIEWAREA_H
-#define ICONPREVIEWAREA_H
-
-#include <QIcon>
-#include <QWidget>
-
-QT_BEGIN_NAMESPACE
-class QLabel;
-QT_END_NAMESPACE
-
-//! [0]
-class IconPreviewArea : public QWidget
-{
- Q_OBJECT
-
-public:
- IconPreviewArea(QWidget *parent = 0);
-
- void setIcon(const QIcon &icon);
- void setSize(const QSize &size);
-
-private:
- QLabel *createHeaderLabel(const QString &text);
- QLabel *createPixmapLabel();
- void updatePixmapLabels();
-
- enum { NumModes = 4, NumStates = 2 };
-
- QIcon icon;
- QSize size;
- QLabel *stateLabels[NumStates];
- QLabel *modeLabels[NumModes];
- QLabel *pixmapLabels[NumModes][NumStates];
-};
-//! [0]
-
-#endif
diff --git a/examples/widgets/icons/icons.desktop b/examples/widgets/icons/icons.desktop
deleted file mode 100644
index df90cc5e6f..0000000000
--- a/examples/widgets/icons/icons.desktop
+++ /dev/null
@@ -1,11 +0,0 @@
-[Desktop Entry]
-Encoding=UTF-8
-Version=1.0
-Type=Application
-Terminal=false
-Name=Icons
-Exec=/opt/usr/bin/icons
-Icon=icons
-X-Window-Icon=
-X-HildonDesk-ShowInToolbar=true
-X-Osso-Type=application/x-executable
diff --git a/examples/widgets/icons/icons.pro b/examples/widgets/icons/icons.pro
deleted file mode 100644
index 8b0831117c..0000000000
--- a/examples/widgets/icons/icons.pro
+++ /dev/null
@@ -1,29 +0,0 @@
-HEADERS = iconpreviewarea.h \
- iconsizespinbox.h \
- imagedelegate.h \
- mainwindow.h
-SOURCES = iconpreviewarea.cpp \
- iconsizespinbox.cpp \
- imagedelegate.cpp \
- main.cpp \
- mainwindow.cpp
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets/icons
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS icons.pro images
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets/icons
-INSTALLS += target sources
-
-
-wince*: {
- imageFiles.files = images/*
- wincewm*: {
- imageFiles.path = "/My Documents/My Pictures"
- } else {
- imageFiles.path = images
- }
- DEPLOYMENT += imageFiles
-}
-QT += widgets
-
-simulator: warning(This example might not fully work on Simulator platform)
diff --git a/examples/widgets/icons/iconsizespinbox.cpp b/examples/widgets/icons/iconsizespinbox.cpp
deleted file mode 100644
index bc3609ccb3..0000000000
--- a/examples/widgets/icons/iconsizespinbox.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** 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 "iconsizespinbox.h"
-
-//! [0]
-IconSizeSpinBox::IconSizeSpinBox(QWidget *parent)
- : QSpinBox(parent)
-{
-}
-//! [0]
-
-//! [1]
-int IconSizeSpinBox::valueFromText(const QString &text) const
-{
- QRegExp regExp(tr("(\\d+)(\\s*[xx]\\s*\\d+)?"));
-
- if (regExp.exactMatch(text)) {
- return regExp.cap(1).toInt();
- } else {
- return 0;
- }
-}
-//! [1]
-
-//! [2]
-QString IconSizeSpinBox::textFromValue(int value) const
-{
- return tr("%1 x %1").arg(value);
-}
-//! [2]
diff --git a/examples/widgets/icons/iconsizespinbox.h b/examples/widgets/icons/iconsizespinbox.h
deleted file mode 100644
index c163c0f597..0000000000
--- a/examples/widgets/icons/iconsizespinbox.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************************
-**
-** 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 ICONSIZESPINBOX_H
-#define ICONSIZESPINBOX_H
-
-#include <QSpinBox>
-
-//! [0]
-class IconSizeSpinBox : public QSpinBox
-{
- Q_OBJECT
-
-public:
- IconSizeSpinBox(QWidget *parent = 0);
-
- int valueFromText(const QString &text) const;
- QString textFromValue(int value) const;
-};
-//! [0]
-
-#endif
diff --git a/examples/widgets/icons/imagedelegate.cpp b/examples/widgets/icons/imagedelegate.cpp
deleted file mode 100644
index b801fc2171..0000000000
--- a/examples/widgets/icons/imagedelegate.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** 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 "imagedelegate.h"
-
-//! [0]
-ImageDelegate::ImageDelegate(QObject *parent)
- : QItemDelegate(parent)
-{
-}
-//! [0]
-
-//! [1]
-QWidget *ImageDelegate::createEditor(QWidget *parent,
- const QStyleOptionViewItem & /* option */,
- const QModelIndex &index) const
-{
- QComboBox *comboBox = new QComboBox(parent);
- if (index.column() == 1) {
- comboBox->addItem(tr("Normal"));
- comboBox->addItem(tr("Active"));
- comboBox->addItem(tr("Disabled"));
- comboBox->addItem(tr("Selected"));
- } else if (index.column() == 2) {
- comboBox->addItem(tr("Off"));
- comboBox->addItem(tr("On"));
- }
-
- connect(comboBox, SIGNAL(activated(int)), this, SLOT(emitCommitData()));
-
- return comboBox;
-}
-//! [1]
-
-//! [2]
-void ImageDelegate::setEditorData(QWidget *editor,
- const QModelIndex &index) const
-{
- QComboBox *comboBox = qobject_cast<QComboBox *>(editor);
- if (!comboBox)
- return;
-
- int pos = comboBox->findText(index.model()->data(index).toString(),
- Qt::MatchExactly);
- comboBox->setCurrentIndex(pos);
-}
-//! [2]
-
-//! [3]
-void ImageDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
- const QModelIndex &index) const
-{
- QComboBox *comboBox = qobject_cast<QComboBox *>(editor);
- if (!comboBox)
- return;
-
- model->setData(index, comboBox->currentText());
-}
-//! [3]
-
-//! [4]
-void ImageDelegate::emitCommitData()
-{
- emit commitData(qobject_cast<QWidget *>(sender()));
-}
-//! [4]
diff --git a/examples/widgets/icons/imagedelegate.h b/examples/widgets/icons/imagedelegate.h
deleted file mode 100644
index a07dc4b9ad..0000000000
--- a/examples/widgets/icons/imagedelegate.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** 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 IMAGEDELEGATE_H
-#define IMAGEDELEGATE_H
-
-#include <QItemDelegate>
-
-//! [0]
-class ImageDelegate : public QItemDelegate
-{
- Q_OBJECT
-
-public:
- ImageDelegate(QObject *parent = 0);
-//! [0]
-
-//! [1]
- QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
- const QModelIndex &index) const;
- void setEditorData(QWidget *editor, const QModelIndex &index) const;
- void setModelData(QWidget *editor, QAbstractItemModel *model,
- const QModelIndex &index) const;
-
-//! [1] //! [2]
-private slots:
- void emitCommitData();
-};
-//! [2]
-
-#endif
diff --git a/examples/widgets/icons/images/designer.png b/examples/widgets/icons/images/designer.png
deleted file mode 100644
index 0988fcee3f..0000000000
--- a/examples/widgets/icons/images/designer.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/icons/images/find_disabled.png b/examples/widgets/icons/images/find_disabled.png
deleted file mode 100644
index e85e33fe05..0000000000
--- a/examples/widgets/icons/images/find_disabled.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/icons/images/find_normal.png b/examples/widgets/icons/images/find_normal.png
deleted file mode 100644
index 728c27f905..0000000000
--- a/examples/widgets/icons/images/find_normal.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/icons/images/monkey_off_128x128.png b/examples/widgets/icons/images/monkey_off_128x128.png
deleted file mode 100644
index f878267287..0000000000
--- a/examples/widgets/icons/images/monkey_off_128x128.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/icons/images/monkey_off_16x16.png b/examples/widgets/icons/images/monkey_off_16x16.png
deleted file mode 100644
index 0ac57d7d4f..0000000000
--- a/examples/widgets/icons/images/monkey_off_16x16.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/icons/images/monkey_off_32x32.png b/examples/widgets/icons/images/monkey_off_32x32.png
deleted file mode 100644
index 1f7fab694c..0000000000
--- a/examples/widgets/icons/images/monkey_off_32x32.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/icons/images/monkey_off_64x64.png b/examples/widgets/icons/images/monkey_off_64x64.png
deleted file mode 100644
index 47d8f6de35..0000000000
--- a/examples/widgets/icons/images/monkey_off_64x64.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/icons/images/monkey_on_128x128.png b/examples/widgets/icons/images/monkey_on_128x128.png
deleted file mode 100644
index 8e1c7468bf..0000000000
--- a/examples/widgets/icons/images/monkey_on_128x128.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/icons/images/monkey_on_16x16.png b/examples/widgets/icons/images/monkey_on_16x16.png
deleted file mode 100644
index 082e8527f1..0000000000
--- a/examples/widgets/icons/images/monkey_on_16x16.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/icons/images/monkey_on_32x32.png b/examples/widgets/icons/images/monkey_on_32x32.png
deleted file mode 100644
index bf9acc6cae..0000000000
--- a/examples/widgets/icons/images/monkey_on_32x32.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/icons/images/monkey_on_64x64.png b/examples/widgets/icons/images/monkey_on_64x64.png
deleted file mode 100644
index 990f604d98..0000000000
--- a/examples/widgets/icons/images/monkey_on_64x64.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/icons/images/qt_extended_16x16.png b/examples/widgets/icons/images/qt_extended_16x16.png
deleted file mode 100644
index 95d3bae838..0000000000
--- a/examples/widgets/icons/images/qt_extended_16x16.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/icons/images/qt_extended_32x32.png b/examples/widgets/icons/images/qt_extended_32x32.png
deleted file mode 100644
index 7b7a790c12..0000000000
--- a/examples/widgets/icons/images/qt_extended_32x32.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/icons/images/qt_extended_48x48.png b/examples/widgets/icons/images/qt_extended_48x48.png
deleted file mode 100644
index 8434dc26db..0000000000
--- a/examples/widgets/icons/images/qt_extended_48x48.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/icons/main.cpp b/examples/widgets/icons/main.cpp
deleted file mode 100644
index e96d256e9b..0000000000
--- a/examples/widgets/icons/main.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
-**
-** 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 "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow mainWin;
- mainWin.show();
- return app.exec();
-}
diff --git a/examples/widgets/icons/mainwindow.cpp b/examples/widgets/icons/mainwindow.cpp
deleted file mode 100644
index 00f5a21854..0000000000
--- a/examples/widgets/icons/mainwindow.cpp
+++ /dev/null
@@ -1,442 +0,0 @@
-/****************************************************************************
-**
-** 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 "iconpreviewarea.h"
-#include "iconsizespinbox.h"
-#include "imagedelegate.h"
-#include "mainwindow.h"
-
-//! [0]
-MainWindow::MainWindow()
-{
- centralWidget = new QWidget;
- setCentralWidget(centralWidget);
-
- createPreviewGroupBox();
- createImagesGroupBox();
- createIconSizeGroupBox();
-
- createActions();
- createMenus();
- createContextMenu();
-
- QGridLayout *mainLayout = new QGridLayout;
- mainLayout->addWidget(previewGroupBox, 0, 0, 1, 2);
- mainLayout->addWidget(imagesGroupBox, 1, 0);
- mainLayout->addWidget(iconSizeGroupBox, 1, 1);
- centralWidget->setLayout(mainLayout);
-
- setWindowTitle(tr("Icons"));
- checkCurrentStyle();
- otherRadioButton->click();
-
- resize(minimumSizeHint());
-}
-//! [0]
-
-//! [1]
-void MainWindow::about()
-{
- QMessageBox::about(this, tr("About Icons"),
- tr("The <b>Icons</b> example illustrates how Qt renders an icon in "
- "different modes (active, normal, disabled, and selected) and "
- "states (on and off) based on a set of images."));
-}
-//! [1]
-
-//! [2]
-void MainWindow::changeStyle(bool checked)
-{
- if (!checked)
- return;
-
- QAction *action = qobject_cast<QAction *>(sender());
-//! [2] //! [3]
- QStyle *style = QStyleFactory::create(action->data().toString());
-//! [3] //! [4]
- Q_ASSERT(style);
- QApplication::setStyle(style);
-
- smallRadioButton->setText(tr("Small (%1 x %1)")
- .arg(style->pixelMetric(QStyle::PM_SmallIconSize)));
- largeRadioButton->setText(tr("Large (%1 x %1)")
- .arg(style->pixelMetric(QStyle::PM_LargeIconSize)));
- toolBarRadioButton->setText(tr("Toolbars (%1 x %1)")
- .arg(style->pixelMetric(QStyle::PM_ToolBarIconSize)));
- listViewRadioButton->setText(tr("List views (%1 x %1)")
- .arg(style->pixelMetric(QStyle::PM_ListViewIconSize)));
- iconViewRadioButton->setText(tr("Icon views (%1 x %1)")
- .arg(style->pixelMetric(QStyle::PM_IconViewIconSize)));
- tabBarRadioButton->setText(tr("Tab bars (%1 x %1)")
- .arg(style->pixelMetric(QStyle::PM_TabBarIconSize)));
-
- changeSize();
-}
-//! [4]
-
-//! [5]
-void MainWindow::changeSize(bool checked)
-{
- if (!checked)
- return;
-
- int extent;
-
- if (otherRadioButton->isChecked()) {
- extent = otherSpinBox->value();
- } else {
- QStyle::PixelMetric metric;
-
- if (smallRadioButton->isChecked()) {
- metric = QStyle::PM_SmallIconSize;
- } else if (largeRadioButton->isChecked()) {
- metric = QStyle::PM_LargeIconSize;
- } else if (toolBarRadioButton->isChecked()) {
- metric = QStyle::PM_ToolBarIconSize;
- } else if (listViewRadioButton->isChecked()) {
- metric = QStyle::PM_ListViewIconSize;
- } else if (iconViewRadioButton->isChecked()) {
- metric = QStyle::PM_IconViewIconSize;
- } else {
- metric = QStyle::PM_TabBarIconSize;
- }
- extent = QApplication::style()->pixelMetric(metric);
- }
- previewArea->setSize(QSize(extent, extent));
- otherSpinBox->setEnabled(otherRadioButton->isChecked());
-}
-//! [5]
-
-//! [6]
-void MainWindow::changeIcon()
-{
- QIcon icon;
-
- for (int row = 0; row < imagesTable->rowCount(); ++row) {
- QTableWidgetItem *item0 = imagesTable->item(row, 0);
- QTableWidgetItem *item1 = imagesTable->item(row, 1);
- QTableWidgetItem *item2 = imagesTable->item(row, 2);
-
- if (item0->checkState() == Qt::Checked) {
- QIcon::Mode mode;
- if (item1->text() == tr("Normal")) {
- mode = QIcon::Normal;
- } else if (item1->text() == tr("Active")) {
- mode = QIcon::Active;
- } else if (item1->text() == tr("Disabled")) {
- mode = QIcon::Disabled;
- } else {
- mode = QIcon::Selected;
- }
-
- QIcon::State state;
- if (item2->text() == tr("On")) {
- state = QIcon::On;
- } else {
- state = QIcon::Off;
-//! [6] //! [7]
- }
-//! [7]
-
-//! [8]
- QString fileName = item0->data(Qt::UserRole).toString();
- QImage image(fileName);
- if (!image.isNull())
- icon.addPixmap(QPixmap::fromImage(image), mode, state);
-//! [8] //! [9]
- }
-//! [9] //! [10]
- }
-//! [10]
-
-//! [11]
- previewArea->setIcon(icon);
-}
-//! [11]
-
-//! [12]
-void MainWindow::addImages()
-{
- QStringList fileNames = QFileDialog::getOpenFileNames(this,
- tr("Open Images"), "",
- tr("Images (*.png *.xpm *.jpg);;"
- "All Files (*)"));
- if (!fileNames.isEmpty()) {
- foreach (QString fileName, fileNames) {
- int row = imagesTable->rowCount();
- imagesTable->setRowCount(row + 1);
-//! [12]
-
-//! [13]
- QString imageName = QFileInfo(fileName).baseName();
-//! [13] //! [14]
- QTableWidgetItem *item0 = new QTableWidgetItem(imageName);
- item0->setData(Qt::UserRole, fileName);
- item0->setFlags(item0->flags() & ~Qt::ItemIsEditable);
-//! [14]
-
-//! [15]
- QTableWidgetItem *item1 = new QTableWidgetItem(tr("Normal"));
-//! [15] //! [16]
- QTableWidgetItem *item2 = new QTableWidgetItem(tr("Off"));
-
- if (guessModeStateAct->isChecked()) {
- if (fileName.contains("_act")) {
- item1->setText(tr("Active"));
- } else if (fileName.contains("_dis")) {
- item1->setText(tr("Disabled"));
- } else if (fileName.contains("_sel")) {
- item1->setText(tr("Selected"));
- }
-
- if (fileName.contains("_on"))
- item2->setText(tr("On"));
-//! [16] //! [17]
- }
-//! [17]
-
-//! [18]
- imagesTable->setItem(row, 0, item0);
-//! [18] //! [19]
- imagesTable->setItem(row, 1, item1);
- imagesTable->setItem(row, 2, item2);
- imagesTable->openPersistentEditor(item1);
- imagesTable->openPersistentEditor(item2);
-
- item0->setCheckState(Qt::Checked);
- }
- }
-}
-//! [19]
-
-//! [20]
-void MainWindow::removeAllImages()
-{
- imagesTable->setRowCount(0);
- changeIcon();
-}
-//! [20]
-
-void MainWindow::createPreviewGroupBox()
-{
- previewGroupBox = new QGroupBox(tr("Preview"));
-
- previewArea = new IconPreviewArea;
-
- QVBoxLayout *layout = new QVBoxLayout;
- layout->addWidget(previewArea);
- previewGroupBox->setLayout(layout);
-}
-
-//! [21]
-void MainWindow::createImagesGroupBox()
-{
- imagesGroupBox = new QGroupBox(tr("Images"));
-
- imagesTable = new QTableWidget;
- imagesTable->setSelectionMode(QAbstractItemView::NoSelection);
- imagesTable->setItemDelegate(new ImageDelegate(this));
-//! [21]
-
-//! [22]
- QStringList labels;
-//! [22] //! [23]
- labels << tr("Image") << tr("Mode") << tr("State");
-
- imagesTable->horizontalHeader()->setDefaultSectionSize(90);
- imagesTable->setColumnCount(3);
- imagesTable->setHorizontalHeaderLabels(labels);
- imagesTable->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
- imagesTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Fixed);
- imagesTable->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Fixed);
- imagesTable->verticalHeader()->hide();
-//! [23]
-
-//! [24]
- connect(imagesTable, SIGNAL(itemChanged(QTableWidgetItem*)),
-//! [24] //! [25]
- this, SLOT(changeIcon()));
-
- QVBoxLayout *layout = new QVBoxLayout;
- layout->addWidget(imagesTable);
- imagesGroupBox->setLayout(layout);
-}
-//! [25]
-
-//! [26]
-void MainWindow::createIconSizeGroupBox()
-{
- iconSizeGroupBox = new QGroupBox(tr("Icon Size"));
-
- smallRadioButton = new QRadioButton;
- largeRadioButton = new QRadioButton;
- toolBarRadioButton = new QRadioButton;
- listViewRadioButton = new QRadioButton;
- iconViewRadioButton = new QRadioButton;
- tabBarRadioButton = new QRadioButton;
- otherRadioButton = new QRadioButton(tr("Other:"));
-
- otherSpinBox = new IconSizeSpinBox;
- otherSpinBox->setRange(8, 128);
- otherSpinBox->setValue(64);
-//! [26]
-
-//! [27]
- connect(smallRadioButton, SIGNAL(toggled(bool)),
- this, SLOT(changeSize(bool)));
- connect(largeRadioButton, SIGNAL(toggled(bool)),
- this, SLOT(changeSize(bool)));
- connect(toolBarRadioButton, SIGNAL(toggled(bool)),
- this, SLOT(changeSize(bool)));
- connect(listViewRadioButton, SIGNAL(toggled(bool)),
- this, SLOT(changeSize(bool)));
- connect(iconViewRadioButton, SIGNAL(toggled(bool)),
- this, SLOT(changeSize(bool)));
- connect(tabBarRadioButton, SIGNAL(toggled(bool)),
- this, SLOT(changeSize(bool)));
- connect(otherRadioButton, SIGNAL(toggled(bool)),
- this, SLOT(changeSize(bool)));
- connect(otherSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeSize()));
-
- QHBoxLayout *otherSizeLayout = new QHBoxLayout;
- otherSizeLayout->addWidget(otherRadioButton);
- otherSizeLayout->addWidget(otherSpinBox);
- otherSizeLayout->addStretch();
-
- QGridLayout *layout = new QGridLayout;
- layout->addWidget(smallRadioButton, 0, 0);
- layout->addWidget(largeRadioButton, 1, 0);
- layout->addWidget(toolBarRadioButton, 2, 0);
- layout->addWidget(listViewRadioButton, 0, 1);
- layout->addWidget(iconViewRadioButton, 1, 1);
- layout->addWidget(tabBarRadioButton, 2, 1);
- layout->addLayout(otherSizeLayout, 3, 0, 1, 2);
- layout->setRowStretch(4, 1);
- iconSizeGroupBox->setLayout(layout);
-}
-//! [27]
-
-//! [28]
-void MainWindow::createActions()
-{
- addImagesAct = new QAction(tr("&Add Images..."), this);
- addImagesAct->setShortcut(tr("Ctrl+A"));
- connect(addImagesAct, SIGNAL(triggered()), this, SLOT(addImages()));
-
- removeAllImagesAct = new QAction(tr("&Remove All Images"), this);
- removeAllImagesAct->setShortcut(tr("Ctrl+R"));
- connect(removeAllImagesAct, SIGNAL(triggered()),
- this, SLOT(removeAllImages()));
-
- exitAct = new QAction(tr("&Quit"), this);
- exitAct->setShortcuts(QKeySequence::Quit);
- connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
-
- styleActionGroup = new QActionGroup(this);
- foreach (QString styleName, QStyleFactory::keys()) {
- QAction *action = new QAction(styleActionGroup);
- action->setText(tr("%1 Style").arg(styleName));
- action->setData(styleName);
- action->setCheckable(true);
- connect(action, SIGNAL(triggered(bool)), this, SLOT(changeStyle(bool)));
- }
-
- guessModeStateAct = new QAction(tr("&Guess Image Mode/State"), this);
- guessModeStateAct->setCheckable(true);
- guessModeStateAct->setChecked(true);
-
- aboutAct = new QAction(tr("&About"), this);
- connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
-
- aboutQtAct = new QAction(tr("About &Qt"), this);
- connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
-}
-//! [28]
-
-//! [29]
-void MainWindow::createMenus()
-{
- fileMenu = menuBar()->addMenu(tr("&File"));
- fileMenu->addAction(addImagesAct);
- fileMenu->addAction(removeAllImagesAct);
- fileMenu->addSeparator();
- fileMenu->addAction(exitAct);
-
- viewMenu = menuBar()->addMenu(tr("&View"));
- foreach (QAction *action, styleActionGroup->actions())
- viewMenu->addAction(action);
- viewMenu->addSeparator();
- viewMenu->addAction(guessModeStateAct);
-
- menuBar()->addSeparator();
-
- helpMenu = menuBar()->addMenu(tr("&Help"));
- helpMenu->addAction(aboutAct);
- helpMenu->addAction(aboutQtAct);
-}
-//! [29]
-
-//! [30]
-void MainWindow::createContextMenu()
-{
- imagesTable->setContextMenuPolicy(Qt::ActionsContextMenu);
- imagesTable->addAction(addImagesAct);
- imagesTable->addAction(removeAllImagesAct);
-}
-//! [30]
-
-//! [31]
-void MainWindow::checkCurrentStyle()
-{
- foreach (QAction *action, styleActionGroup->actions()) {
- QString styleName = action->data().toString();
- QStyle *candidate = QStyleFactory::create(styleName);
- Q_ASSERT(candidate);
- if (candidate->metaObject()->className()
- == QApplication::style()->metaObject()->className()) {
- action->trigger();
- return;
- }
- delete candidate;
- }
-}
-//! [31]
diff --git a/examples/widgets/icons/mainwindow.h b/examples/widgets/icons/mainwindow.h
deleted file mode 100644
index 8afaf9496e..0000000000
--- a/examples/widgets/icons/mainwindow.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** 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 MAINWINDOW_H
-#define MAINWINDOW_H
-
-#include <QIcon>
-#include <QList>
-#include <QMainWindow>
-#include <QPixmap>
-
-QT_BEGIN_NAMESPACE
-class QAction;
-class QActionGroup;
-class QGroupBox;
-class QMenu;
-class QRadioButton;
-class QTableWidget;
-QT_END_NAMESPACE
-class IconPreviewArea;
-class IconSizeSpinBox;
-
-//! [0]
-class MainWindow : public QMainWindow
-{
- Q_OBJECT
-
-public:
- MainWindow();
-
-private slots:
- void about();
- void changeStyle(bool checked);
- void changeSize(bool checked = true);
- void changeIcon();
- void addImages();
- void removeAllImages();
-
-private:
- void createPreviewGroupBox();
- void createImagesGroupBox();
- void createIconSizeGroupBox();
- void createActions();
- void createMenus();
- void createContextMenu();
- void checkCurrentStyle();
-
- QWidget *centralWidget;
-
- QGroupBox *previewGroupBox;
- IconPreviewArea *previewArea;
-
- QGroupBox *imagesGroupBox;
- QTableWidget *imagesTable;
-
- QGroupBox *iconSizeGroupBox;
- QRadioButton *smallRadioButton;
- QRadioButton *largeRadioButton;
- QRadioButton *toolBarRadioButton;
- QRadioButton *listViewRadioButton;
- QRadioButton *iconViewRadioButton;
- QRadioButton *tabBarRadioButton;
- QRadioButton *otherRadioButton;
- IconSizeSpinBox *otherSpinBox;
-
- QMenu *fileMenu;
- QMenu *viewMenu;
- QMenu *helpMenu;
- QAction *addImagesAct;
- QAction *removeAllImagesAct;
- QAction *exitAct;
- QAction *guessModeStateAct;
- QActionGroup *styleActionGroup;
- QAction *aboutAct;
- QAction *aboutQtAct;
-};
-//! [0]
-
-#endif