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/painting/painterpaths | |
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/painting/painterpaths')
-rw-r--r-- | examples/painting/painterpaths/main.cpp | 51 | ||||
-rw-r--r-- | examples/painting/painterpaths/painterpaths.desktop | 11 | ||||
-rw-r--r-- | examples/painting/painterpaths/painterpaths.pro | 15 | ||||
-rw-r--r-- | examples/painting/painterpaths/renderarea.cpp | 130 | ||||
-rw-r--r-- | examples/painting/painterpaths/renderarea.h | 80 | ||||
-rw-r--r-- | examples/painting/painterpaths/window.cpp | 289 | ||||
-rw-r--r-- | examples/painting/painterpaths/window.h | 90 |
7 files changed, 0 insertions, 666 deletions
diff --git a/examples/painting/painterpaths/main.cpp b/examples/painting/painterpaths/main.cpp deleted file mode 100644 index dcbf1c0449..0000000000 --- a/examples/painting/painterpaths/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 "window.h" - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - Window window; - window.show(); - return app.exec(); -} diff --git a/examples/painting/painterpaths/painterpaths.desktop b/examples/painting/painterpaths/painterpaths.desktop deleted file mode 100644 index ae92f2c589..0000000000 --- a/examples/painting/painterpaths/painterpaths.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=Painter Paths -Exec=/opt/usr/bin/painterpaths -Icon=painterpaths -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/examples/painting/painterpaths/painterpaths.pro b/examples/painting/painterpaths/painterpaths.pro deleted file mode 100644 index c988ba26e0..0000000000 --- a/examples/painting/painterpaths/painterpaths.pro +++ /dev/null @@ -1,15 +0,0 @@ -HEADERS = renderarea.h \ - window.h -SOURCES = main.cpp \ - renderarea.cpp \ - window.cpp -unix:!mac:!vxworks:!integrity:LIBS += -lm - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/painting/painterpaths -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS painterpaths.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/painting/painterpaths -INSTALLS += target sources - -QT += widgets - diff --git a/examples/painting/painterpaths/renderarea.cpp b/examples/painting/painterpaths/renderarea.cpp deleted file mode 100644 index 0b3f1fdc0d..0000000000 --- a/examples/painting/painterpaths/renderarea.cpp +++ /dev/null @@ -1,130 +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 "renderarea.h" - -//! [0] -RenderArea::RenderArea(const QPainterPath &path, QWidget *parent) - : QWidget(parent), path(path) -{ - penWidth = 1; - rotationAngle = 0; - setBackgroundRole(QPalette::Base); -} -//! [0] - -//! [1] -QSize RenderArea::minimumSizeHint() const -{ - return QSize(50, 50); -} -//! [1] - -//! [2] -QSize RenderArea::sizeHint() const -{ - return QSize(100, 100); -} -//! [2] - -//! [3] -void RenderArea::setFillRule(Qt::FillRule rule) -{ - path.setFillRule(rule); - update(); -} -//! [3] - -//! [4] -void RenderArea::setFillGradient(const QColor &color1, const QColor &color2) -{ - fillColor1 = color1; - fillColor2 = color2; - update(); -} -//! [4] - -//! [5] -void RenderArea::setPenWidth(int width) -{ - penWidth = width; - update(); -} -//! [5] - -//! [6] -void RenderArea::setPenColor(const QColor &color) -{ - penColor = color; - update(); -} -//! [6] - -//! [7] -void RenderArea::setRotationAngle(int degrees) -{ - rotationAngle = degrees; - update(); -} -//! [7] - -//! [8] -void RenderArea::paintEvent(QPaintEvent *) -{ - QPainter painter(this); - painter.setRenderHint(QPainter::Antialiasing); -//! [8] //! [9] - painter.scale(width() / 100.0, height() / 100.0); - painter.translate(50.0, 50.0); - painter.rotate(-rotationAngle); - painter.translate(-50.0, -50.0); - -//! [9] //! [10] - painter.setPen(QPen(penColor, penWidth, Qt::SolidLine, Qt::RoundCap, - Qt::RoundJoin)); - QLinearGradient gradient(0, 0, 0, 100); - gradient.setColorAt(0.0, fillColor1); - gradient.setColorAt(1.0, fillColor2); - painter.setBrush(gradient); - painter.drawPath(path); -} -//! [10] diff --git a/examples/painting/painterpaths/renderarea.h b/examples/painting/painterpaths/renderarea.h deleted file mode 100644 index 5c310fdf62..0000000000 --- a/examples/painting/painterpaths/renderarea.h +++ /dev/null @@ -1,80 +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 RENDERAREA_H -#define RENDERAREA_H - -#include <QPainterPath> -#include <QWidget> - -//! [0] -class RenderArea : public QWidget -{ - Q_OBJECT - -public: - RenderArea(const QPainterPath &path, QWidget *parent = 0); - - QSize minimumSizeHint() const; - QSize sizeHint() const; - -public slots: - void setFillRule(Qt::FillRule rule); - void setFillGradient(const QColor &color1, const QColor &color2); - void setPenWidth(int width); - void setPenColor(const QColor &color); - void setRotationAngle(int degrees); - -protected: - void paintEvent(QPaintEvent *event); -//! [0] - -//! [1] -private: - QPainterPath path; - QColor fillColor1; - QColor fillColor2; - int penWidth; - QColor penColor; - int rotationAngle; -}; -//! [1] - -#endif diff --git a/examples/painting/painterpaths/window.cpp b/examples/painting/painterpaths/window.cpp deleted file mode 100644 index 3d3eef9d2b..0000000000 --- a/examples/painting/painterpaths/window.cpp +++ /dev/null @@ -1,289 +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 <math.h> - -#include "renderarea.h" -#include "window.h" - -//! [0] -const float Pi = 3.14159f; -//! [0] - -//! [1] -Window::Window() -{ - QPainterPath rectPath; - rectPath.moveTo(20.0, 30.0); - rectPath.lineTo(80.0, 30.0); - rectPath.lineTo(80.0, 70.0); - rectPath.lineTo(20.0, 70.0); - rectPath.closeSubpath(); -//! [1] - -//! [2] - QPainterPath roundRectPath; - roundRectPath.moveTo(80.0, 35.0); - roundRectPath.arcTo(70.0, 30.0, 10.0, 10.0, 0.0, 90.0); - roundRectPath.lineTo(25.0, 30.0); - roundRectPath.arcTo(20.0, 30.0, 10.0, 10.0, 90.0, 90.0); - roundRectPath.lineTo(20.0, 65.0); - roundRectPath.arcTo(20.0, 60.0, 10.0, 10.0, 180.0, 90.0); - roundRectPath.lineTo(75.0, 70.0); - roundRectPath.arcTo(70.0, 60.0, 10.0, 10.0, 270.0, 90.0); - roundRectPath.closeSubpath(); -//! [2] - -//! [3] - QPainterPath ellipsePath; - ellipsePath.moveTo(80.0, 50.0); - ellipsePath.arcTo(20.0, 30.0, 60.0, 40.0, 0.0, 360.0); -//! [3] - -//! [4] - QPainterPath piePath; - piePath.moveTo(50.0, 50.0); - piePath.arcTo(20.0, 30.0, 60.0, 40.0, 60.0, 240.0); - piePath.closeSubpath(); -//! [4] - -//! [5] - QPainterPath polygonPath; - polygonPath.moveTo(10.0, 80.0); - polygonPath.lineTo(20.0, 10.0); - polygonPath.lineTo(80.0, 30.0); - polygonPath.lineTo(90.0, 70.0); - polygonPath.closeSubpath(); -//! [5] - -//! [6] - QPainterPath groupPath; - groupPath.moveTo(60.0, 40.0); - groupPath.arcTo(20.0, 20.0, 40.0, 40.0, 0.0, 360.0); - groupPath.moveTo(40.0, 40.0); - groupPath.lineTo(40.0, 80.0); - groupPath.lineTo(80.0, 80.0); - groupPath.lineTo(80.0, 40.0); - groupPath.closeSubpath(); -//! [6] - -//! [7] - QPainterPath textPath; - QFont timesFont("Times", 50); - timesFont.setStyleStrategy(QFont::ForceOutline); - textPath.addText(10, 70, timesFont, tr("Qt")); -//! [7] - -//! [8] - QPainterPath bezierPath; - bezierPath.moveTo(20, 30); - bezierPath.cubicTo(80, 0, 50, 50, 80, 80); -//! [8] - -//! [9] - QPainterPath starPath; - starPath.moveTo(90, 50); - for (int i = 1; i < 5; ++i) { - starPath.lineTo(50 + 40 * cos(0.8 * i * Pi), - 50 + 40 * sin(0.8 * i * Pi)); - } - starPath.closeSubpath(); -//! [9] - -//! [10] - renderAreas.push_back(new RenderArea(rectPath)); - renderAreas.push_back(new RenderArea(roundRectPath)); - renderAreas.push_back(new RenderArea(ellipsePath)); - renderAreas.push_back(new RenderArea(piePath)); - renderAreas.push_back(new RenderArea(polygonPath)); - renderAreas.push_back(new RenderArea(groupPath)); - renderAreas.push_back(new RenderArea(textPath)); - renderAreas.push_back(new RenderArea(bezierPath)); - renderAreas.push_back(new RenderArea(starPath)); -//! [10] - -//! [11] - fillRuleComboBox = new QComboBox; - fillRuleComboBox->addItem(tr("Odd Even"), Qt::OddEvenFill); - fillRuleComboBox->addItem(tr("Winding"), Qt::WindingFill); - - fillRuleLabel = new QLabel(tr("Fill &Rule:")); - fillRuleLabel->setBuddy(fillRuleComboBox); -//! [11] - -//! [12] - fillColor1ComboBox = new QComboBox; - populateWithColors(fillColor1ComboBox); - fillColor1ComboBox->setCurrentIndex( - fillColor1ComboBox->findText("mediumslateblue")); - - fillColor2ComboBox = new QComboBox; - populateWithColors(fillColor2ComboBox); - fillColor2ComboBox->setCurrentIndex( - fillColor2ComboBox->findText("cornsilk")); - - fillGradientLabel = new QLabel(tr("&Fill Gradient:")); - fillGradientLabel->setBuddy(fillColor1ComboBox); - - fillToLabel = new QLabel(tr("to")); - fillToLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - - penWidthSpinBox = new QSpinBox; - penWidthSpinBox->setRange(0, 20); - - penWidthLabel = new QLabel(tr("&Pen Width:")); - penWidthLabel->setBuddy(penWidthSpinBox); - - penColorComboBox = new QComboBox; - populateWithColors(penColorComboBox); - penColorComboBox->setCurrentIndex( - penColorComboBox->findText("darkslateblue")); - - penColorLabel = new QLabel(tr("Pen &Color:")); - penColorLabel->setBuddy(penColorComboBox); - - rotationAngleSpinBox = new QSpinBox; - rotationAngleSpinBox->setRange(0, 359); - rotationAngleSpinBox->setWrapping(true); - rotationAngleSpinBox->setSuffix(QLatin1String("\xB0")); - - rotationAngleLabel = new QLabel(tr("&Rotation Angle:")); - rotationAngleLabel->setBuddy(rotationAngleSpinBox); -//! [12] - -//! [16] - connect(fillRuleComboBox, SIGNAL(activated(int)), - this, SLOT(fillRuleChanged())); - connect(fillColor1ComboBox, SIGNAL(activated(int)), - this, SLOT(fillGradientChanged())); - connect(fillColor2ComboBox, SIGNAL(activated(int)), - this, SLOT(fillGradientChanged())); - connect(penColorComboBox, SIGNAL(activated(int)), - this, SLOT(penColorChanged())); - - for(QList<RenderArea*>::iterator it = renderAreas.begin(); it != renderAreas.end(); it++) { - connect(penWidthSpinBox, SIGNAL(valueChanged(int)), - *it, SLOT(setPenWidth(int))); - connect(rotationAngleSpinBox, SIGNAL(valueChanged(int)), - *it, SLOT(setRotationAngle(int))); - } - -//! [16] //! [17] - QGridLayout *topLayout = new QGridLayout; - - int i=0; - for(QList<RenderArea*>::iterator it = renderAreas.begin(); it != renderAreas.end(); it++, i++) - topLayout->addWidget(*it, i / 3, i % 3); - - QGridLayout *mainLayout = new QGridLayout; - mainLayout->addLayout(topLayout, 0, 0, 1, 4); - mainLayout->addWidget(fillRuleLabel, 1, 0); - mainLayout->addWidget(fillRuleComboBox, 1, 1, 1, 3); - mainLayout->addWidget(fillGradientLabel, 2, 0); - mainLayout->addWidget(fillColor1ComboBox, 2, 1); - mainLayout->addWidget(fillToLabel, 2, 2); - mainLayout->addWidget(fillColor2ComboBox, 2, 3); - mainLayout->addWidget(penWidthLabel, 3, 0); - mainLayout->addWidget(penWidthSpinBox, 3, 1, 1, 3); - mainLayout->addWidget(penColorLabel, 4, 0); - mainLayout->addWidget(penColorComboBox, 4, 1, 1, 3); - mainLayout->addWidget(rotationAngleLabel, 5, 0); - mainLayout->addWidget(rotationAngleSpinBox, 5, 1, 1, 3); - setLayout(mainLayout); -//! [17] - -//! [18] - fillRuleChanged(); - fillGradientChanged(); - penColorChanged(); - penWidthSpinBox->setValue(2); - - setWindowTitle(tr("Painter Paths")); -} -//! [18] - -//! [19] -void Window::fillRuleChanged() -{ - Qt::FillRule rule = (Qt::FillRule)currentItemData(fillRuleComboBox).toInt(); - - for(QList<RenderArea*>::iterator it = renderAreas.begin(); it != renderAreas.end(); it++) - (*it)->setFillRule(rule); -} -//! [19] - -//! [20] -void Window::fillGradientChanged() -{ - QColor color1 = qvariant_cast<QColor>(currentItemData(fillColor1ComboBox)); - QColor color2 = qvariant_cast<QColor>(currentItemData(fillColor2ComboBox)); - - for(QList<RenderArea*>::iterator it = renderAreas.begin(); it != renderAreas.end(); it++) - (*it)->setFillGradient(color1, color2); -} -//! [20] - -//! [21] -void Window::penColorChanged() -{ - QColor color = qvariant_cast<QColor>(currentItemData(penColorComboBox)); - - for(QList<RenderArea*>::iterator it = renderAreas.begin(); it != renderAreas.end(); it++) - (*it)->setPenColor(color); -} -//! [21] - -//! [22] -void Window::populateWithColors(QComboBox *comboBox) -{ - QStringList colorNames = QColor::colorNames(); - foreach (QString name, colorNames) - comboBox->addItem(name, QColor(name)); -} -//! [22] - -//! [23] -QVariant Window::currentItemData(QComboBox *comboBox) -{ - return comboBox->itemData(comboBox->currentIndex()); -} -//! [23] diff --git a/examples/painting/painterpaths/window.h b/examples/painting/painterpaths/window.h deleted file mode 100644 index 4c01719b16..0000000000 --- a/examples/painting/painterpaths/window.h +++ /dev/null @@ -1,90 +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 WINDOW_H -#define WINDOW_H - -#include <QWidget> - -QT_BEGIN_NAMESPACE -class QComboBox; -class QLabel; -class QSpinBox; -QT_END_NAMESPACE -class RenderArea; - -//! [0] -class Window : public QWidget -{ - Q_OBJECT - -public: - Window(); - -private slots: - void fillRuleChanged(); - void fillGradientChanged(); - void penColorChanged(); -//! [0] - -//! [1] -private: - void populateWithColors(QComboBox *comboBox); - QVariant currentItemData(QComboBox *comboBox); -//! [1] - -//! [2] - QList<RenderArea*> renderAreas; - QLabel *fillRuleLabel; - QLabel *fillGradientLabel; - QLabel *fillToLabel; - QLabel *penWidthLabel; - QLabel *penColorLabel; - QLabel *rotationAngleLabel; - QComboBox *fillRuleComboBox; - QComboBox *fillColor1ComboBox; - QComboBox *fillColor2ComboBox; - QSpinBox *penWidthSpinBox; - QComboBox *penColorComboBox; - QSpinBox *rotationAngleSpinBox; -}; -//! [2] - -#endif |