summaryrefslogtreecommitdiffstats
path: root/examples/widgets/icons
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2009-03-23 09:34:13 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-03-23 09:34:13 (GMT)
commit67ad0519fd165acee4a4d2a94fa502e9e4847bd0 (patch)
tree1dbf50b3dff8d5ca7e9344733968c72704eb15ff /examples/widgets/icons
downloadQt-67ad0519fd165acee4a4d2a94fa502e9e4847bd0.zip
Qt-67ad0519fd165acee4a4d2a94fa502e9e4847bd0.tar.gz
Qt-67ad0519fd165acee4a4d2a94fa502e9e4847bd0.tar.bz2
Long live Qt!
Diffstat (limited to 'examples/widgets/icons')
-rw-r--r--examples/widgets/icons/iconpreviewarea.cpp142
-rw-r--r--examples/widgets/icons/iconpreviewarea.h78
-rw-r--r--examples/widgets/icons/icons.pro25
-rw-r--r--examples/widgets/icons/iconsizespinbox.cpp71
-rw-r--r--examples/widgets/icons/iconsizespinbox.h60
-rw-r--r--examples/widgets/icons/imagedelegate.cpp106
-rw-r--r--examples/widgets/icons/imagedelegate.h69
-rw-r--r--examples/widgets/icons/images/designer.pngbin0 -> 4205 bytes
-rw-r--r--examples/widgets/icons/images/find_disabled.pngbin0 -> 501 bytes
-rw-r--r--examples/widgets/icons/images/find_normal.pngbin0 -> 838 bytes
-rw-r--r--examples/widgets/icons/images/monkey_off_128x128.pngbin0 -> 7045 bytes
-rw-r--r--examples/widgets/icons/images/monkey_off_16x16.pngbin0 -> 683 bytes
-rw-r--r--examples/widgets/icons/images/monkey_off_32x32.pngbin0 -> 1609 bytes
-rw-r--r--examples/widgets/icons/images/monkey_off_64x64.pngbin0 -> 3533 bytes
-rw-r--r--examples/widgets/icons/images/monkey_on_128x128.pngbin0 -> 6909 bytes
-rw-r--r--examples/widgets/icons/images/monkey_on_16x16.pngbin0 -> 681 bytes
-rw-r--r--examples/widgets/icons/images/monkey_on_32x32.pngbin0 -> 1577 bytes
-rw-r--r--examples/widgets/icons/images/monkey_on_64x64.pngbin0 -> 3479 bytes
-rw-r--r--examples/widgets/icons/images/qt_extended_16x16.pngbin0 -> 834 bytes
-rw-r--r--examples/widgets/icons/images/qt_extended_32x32.pngbin0 -> 1892 bytes
-rw-r--r--examples/widgets/icons/images/qt_extended_48x48.pngbin0 -> 3672 bytes
-rw-r--r--examples/widgets/icons/main.cpp52
-rw-r--r--examples/widgets/icons/mainwindow.cpp443
-rw-r--r--examples/widgets/icons/mainwindow.h117
24 files changed, 1163 insertions, 0 deletions
diff --git a/examples/widgets/icons/iconpreviewarea.cpp b/examples/widgets/icons/iconpreviewarea.cpp
new file mode 100644
index 0000000..d80d41d
--- /dev/null
+++ b/examples/widgets/icons/iconpreviewarea.cpp
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#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
new file mode 100644
index 0000000..9b915a4
--- /dev/null
+++ b/examples/widgets/icons/iconpreviewarea.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $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.pro b/examples/widgets/icons/icons.pro
new file mode 100644
index 0000000..3b432d9
--- /dev/null
+++ b/examples/widgets/icons/icons.pro
@@ -0,0 +1,25 @@
+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]/widgets/icons
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS icons.pro images
+sources.path = $$[QT_INSTALL_EXAMPLES]/widgets/icons
+INSTALLS += target sources
+
+wince*: {
+ imageFiles.sources = images/*
+ wincewm*: {
+ imageFiles.path = "/My Documents/My Pictures"
+ } else {
+ imageFiles.path = images
+ }
+ DEPLOYMENT += imageFiles
+}
diff --git a/examples/widgets/icons/iconsizespinbox.cpp b/examples/widgets/icons/iconsizespinbox.cpp
new file mode 100644
index 0000000..22f45e9
--- /dev/null
+++ b/examples/widgets/icons/iconsizespinbox.cpp
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#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
new file mode 100644
index 0000000..ea84dc7
--- /dev/null
+++ b/examples/widgets/icons/iconsizespinbox.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $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
new file mode 100644
index 0000000..e8e79b3
--- /dev/null
+++ b/examples/widgets/icons/imagedelegate.cpp
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#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
new file mode 100644
index 0000000..638c0eb
--- /dev/null
+++ b/examples/widgets/icons/imagedelegate.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $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
new file mode 100644
index 0000000..0988fce
--- /dev/null
+++ b/examples/widgets/icons/images/designer.png
Binary files differ
diff --git a/examples/widgets/icons/images/find_disabled.png b/examples/widgets/icons/images/find_disabled.png
new file mode 100644
index 0000000..e85e33f
--- /dev/null
+++ b/examples/widgets/icons/images/find_disabled.png
Binary files differ
diff --git a/examples/widgets/icons/images/find_normal.png b/examples/widgets/icons/images/find_normal.png
new file mode 100644
index 0000000..728c27f
--- /dev/null
+++ b/examples/widgets/icons/images/find_normal.png
Binary files differ
diff --git a/examples/widgets/icons/images/monkey_off_128x128.png b/examples/widgets/icons/images/monkey_off_128x128.png
new file mode 100644
index 0000000..f878267
--- /dev/null
+++ b/examples/widgets/icons/images/monkey_off_128x128.png
Binary files differ
diff --git a/examples/widgets/icons/images/monkey_off_16x16.png b/examples/widgets/icons/images/monkey_off_16x16.png
new file mode 100644
index 0000000..0ac57d7
--- /dev/null
+++ b/examples/widgets/icons/images/monkey_off_16x16.png
Binary files differ
diff --git a/examples/widgets/icons/images/monkey_off_32x32.png b/examples/widgets/icons/images/monkey_off_32x32.png
new file mode 100644
index 0000000..1f7fab6
--- /dev/null
+++ b/examples/widgets/icons/images/monkey_off_32x32.png
Binary files differ
diff --git a/examples/widgets/icons/images/monkey_off_64x64.png b/examples/widgets/icons/images/monkey_off_64x64.png
new file mode 100644
index 0000000..47d8f6d
--- /dev/null
+++ b/examples/widgets/icons/images/monkey_off_64x64.png
Binary files differ
diff --git a/examples/widgets/icons/images/monkey_on_128x128.png b/examples/widgets/icons/images/monkey_on_128x128.png
new file mode 100644
index 0000000..8e1c746
--- /dev/null
+++ b/examples/widgets/icons/images/monkey_on_128x128.png
Binary files differ
diff --git a/examples/widgets/icons/images/monkey_on_16x16.png b/examples/widgets/icons/images/monkey_on_16x16.png
new file mode 100644
index 0000000..082e852
--- /dev/null
+++ b/examples/widgets/icons/images/monkey_on_16x16.png
Binary files differ
diff --git a/examples/widgets/icons/images/monkey_on_32x32.png b/examples/widgets/icons/images/monkey_on_32x32.png
new file mode 100644
index 0000000..bf9acc6
--- /dev/null
+++ b/examples/widgets/icons/images/monkey_on_32x32.png
Binary files differ
diff --git a/examples/widgets/icons/images/monkey_on_64x64.png b/examples/widgets/icons/images/monkey_on_64x64.png
new file mode 100644
index 0000000..990f604
--- /dev/null
+++ b/examples/widgets/icons/images/monkey_on_64x64.png
Binary files differ
diff --git a/examples/widgets/icons/images/qt_extended_16x16.png b/examples/widgets/icons/images/qt_extended_16x16.png
new file mode 100644
index 0000000..95d3bae
--- /dev/null
+++ b/examples/widgets/icons/images/qt_extended_16x16.png
Binary files differ
diff --git a/examples/widgets/icons/images/qt_extended_32x32.png b/examples/widgets/icons/images/qt_extended_32x32.png
new file mode 100644
index 0000000..7b7a790
--- /dev/null
+++ b/examples/widgets/icons/images/qt_extended_32x32.png
Binary files differ
diff --git a/examples/widgets/icons/images/qt_extended_48x48.png b/examples/widgets/icons/images/qt_extended_48x48.png
new file mode 100644
index 0000000..8434dc2
--- /dev/null
+++ b/examples/widgets/icons/images/qt_extended_48x48.png
Binary files differ
diff --git a/examples/widgets/icons/main.cpp b/examples/widgets/icons/main.cpp
new file mode 100644
index 0000000..4856752
--- /dev/null
+++ b/examples/widgets/icons/main.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $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
new file mode 100644
index 0000000..00ce8b0
--- /dev/null
+++ b/examples/widgets/icons/mainwindow.cpp
@@ -0,0 +1,443 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#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()->setResizeMode(0, QHeaderView::Stretch);
+ imagesTable->horizontalHeader()->setResizeMode(1, QHeaderView::Fixed);
+ imagesTable->horizontalHeader()->setResizeMode(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->setShortcut(tr("Ctrl+Q"));
+ 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
new file mode 100644
index 0000000..3494359
--- /dev/null
+++ b/examples/widgets/icons/mainwindow.h
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $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