summaryrefslogtreecommitdiffstats
path: root/examples/painting
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-04-24 14:03:55 (GMT)
committeraxis <qt-info@nokia.com>2009-04-27 07:09:01 (GMT)
commite74c8dc65e2feffb9a55d00aee5ca634fba41df8 (patch)
tree3a131f9235fb6a455793178d8313655e4fd0036e /examples/painting
parent8f427b2b914d5b575a4a7c0ed65d2fb8f45acc76 (diff)
parent211bea9838bcc2acd7f54b65468fe1be2d81b1e0 (diff)
downloadQt-e74c8dc65e2feffb9a55d00aee5ca634fba41df8.zip
Qt-e74c8dc65e2feffb9a55d00aee5ca634fba41df8.tar.gz
Qt-e74c8dc65e2feffb9a55d00aee5ca634fba41df8.tar.bz2
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Configure.exe recompiled with MSVC6. Conflicts: configure.exe examples/network/network.pro src/gui/dialogs/qfiledialog_p.h src/gui/dialogs/qfilesystemmodel_p.h src/gui/kernel/qapplication.cpp tests/auto/_Categories/qmake.txt tests/auto/qfile/test/test.pro tests/auto/qfile/tst_qfile.cpp tests/auto/qlibrary/tst_qlibrary.cpp tests/auto/qline/tst_qline.cpp tests/auto/qstyle/tst_qstyle.cpp tests/auto/qtextstream/tst_qtextstream.cpp tests/auto/qtranslator/qtranslator.pro tests/auto/qwaitcondition/tst_qwaitcondition.cpp translations/qt_ja_JP.ts
Diffstat (limited to 'examples/painting')
-rw-r--r--examples/painting/painting.pro2
-rw-r--r--examples/painting/svggenerator/displaywidget.cpp149
-rw-r--r--examples/painting/svggenerator/displaywidget.h80
-rw-r--r--examples/painting/svggenerator/forms/window.ui249
-rw-r--r--examples/painting/svggenerator/main.cpp52
-rw-r--r--examples/painting/svggenerator/resources/shapes.datbin0 -> 2088 bytes
-rw-r--r--examples/painting/svggenerator/svggenerator.pro15
-rw-r--r--examples/painting/svggenerator/svggenerator.qrc5
-rw-r--r--examples/painting/svggenerator/window.cpp101
-rw-r--r--examples/painting/svggenerator/window.h66
10 files changed, 718 insertions, 1 deletions
diff --git a/examples/painting/painting.pro b/examples/painting/painting.pro
index 8ce3460..59ca54e 100644
--- a/examples/painting/painting.pro
+++ b/examples/painting/painting.pro
@@ -7,7 +7,7 @@ SUBDIRS = basicdrawing \
!wince*:!symbian: SUBDIRS += fontsampler
-contains(QT_CONFIG, svg): SUBDIRS += svgviewer
+contains(QT_CONFIG, svg): SUBDIRS += svggenerator svgviewer
# install
target.path = $$[QT_INSTALL_EXAMPLES]/painting
diff --git a/examples/painting/svggenerator/displaywidget.cpp b/examples/painting/svggenerator/displaywidget.cpp
new file mode 100644
index 0000000..c973341
--- /dev/null
+++ b/examples/painting/svggenerator/displaywidget.cpp
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** 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 "displaywidget.h"
+
+DisplayWidget::DisplayWidget(QWidget *parent)
+ : QWidget(parent)
+{
+ QPainterPath car;
+ QPainterPath house;
+
+ QFile file(":resources/shapes.dat");
+ file.open(QFile::ReadOnly);
+ QDataStream stream(&file);
+ stream >> car >> house >> tree >> moon;
+ file.close();
+
+ shapeMap[Car] = car;
+ shapeMap[House] = house;
+
+ background = Sky;
+ shapeColor = Qt::darkYellow;
+ shape = House;
+}
+
+//! [paint event]
+void DisplayWidget::paintEvent(QPaintEvent *event)
+{
+ QPainter painter;
+ painter.begin(this);
+ painter.setRenderHint(QPainter::Antialiasing);
+ paint(painter);
+ painter.end();
+}
+//! [paint event]
+
+//! [paint function]
+void DisplayWidget::paint(QPainter &painter)
+{
+//![paint picture]
+ painter.setClipRect(QRect(0, 0, 200, 200));
+ painter.setPen(Qt::NoPen);
+
+ switch (background) {
+ case Sky:
+ default:
+ painter.fillRect(QRect(0, 0, 200, 200), Qt::darkBlue);
+ painter.translate(145, 10);
+ painter.setBrush(Qt::white);
+ painter.drawPath(moon);
+ painter.translate(-145, -10);
+ break;
+ case Trees:
+ {
+ painter.fillRect(QRect(0, 0, 200, 200), Qt::darkGreen);
+ painter.setBrush(Qt::green);
+ painter.setPen(Qt::black);
+ for (int y = -55, row = 0; y < 200; y += 50, ++row) {
+ int xs;
+ if (row == 2 || row == 3)
+ xs = 150;
+ else
+ xs = 50;
+ for (int x = 0; x < 200; x += xs) {
+ painter.save();
+ painter.translate(x, y);
+ painter.drawPath(tree);
+ painter.restore();
+ }
+ }
+ break;
+ }
+ case Road:
+ painter.fillRect(QRect(0, 0, 200, 200), Qt::gray);
+ painter.setPen(QPen(Qt::white, 4, Qt::DashLine));
+ painter.drawLine(QLine(0, 35, 200, 35));
+ painter.drawLine(QLine(0, 165, 200, 165));
+ break;
+ }
+
+ painter.setBrush(shapeColor);
+ painter.setPen(Qt::black);
+ painter.translate(100, 100);
+ painter.drawPath(shapeMap[shape]);
+//![paint picture]
+}
+//! [paint function]
+
+QColor DisplayWidget::color() const
+{
+ return shapeColor;
+}
+
+void DisplayWidget::setBackground(Background background)
+{
+ this->background = background;
+ update();
+}
+
+void DisplayWidget::setColor(const QColor &color)
+{
+ this->shapeColor = color;
+ update();
+}
+
+void DisplayWidget::setShape(Shape shape)
+{
+ this->shape = shape;
+ update();
+}
diff --git a/examples/painting/svggenerator/displaywidget.h b/examples/painting/svggenerator/displaywidget.h
new file mode 100644
index 0000000..58ad97e
--- /dev/null
+++ b/examples/painting/svggenerator/displaywidget.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** 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 DISPLAYWIDGET_H
+#define DISPLAYWIDGET_H
+
+#include <QColor>
+#include <QHash>
+#include <QWidget>
+
+//! [DisplayWidget class definition]
+class DisplayWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ enum Shape { House = 0, Car = 1 };
+ enum Background { Sky = 0, Trees = 1, Road = 2 };
+
+ DisplayWidget(QWidget *parent = 0);
+ QColor color() const;
+ void paint(QPainter &painter);
+
+public slots:
+ void setBackground(Background background);
+ void setColor(const QColor &color);
+ void setShape(Shape shape);
+
+protected:
+ void paintEvent(QPaintEvent *event);
+
+private:
+ Background background;
+ QColor shapeColor;
+ Shape shape;
+ QHash<Shape,QPainterPath> shapeMap;
+ QPainterPath moon;
+ QPainterPath tree;
+};
+//! [DisplayWidget class definition]
+
+#endif
diff --git a/examples/painting/svggenerator/forms/window.ui b/examples/painting/svggenerator/forms/window.ui
new file mode 100644
index 0000000..bf11908
--- /dev/null
+++ b/examples/painting/svggenerator/forms/window.ui
@@ -0,0 +1,249 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Window</class>
+ <widget class="QWidget" name="Window">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>339</width>
+ <height>353</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>SVG Generator</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetFixedSize</enum>
+ </property>
+ <item row="0" column="0">
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="1">
+ <widget class="DisplayWidget" name="displayWidget" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>200</horstretch>
+ <verstretch>200</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>200</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>200</width>
+ <height>200</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="0" colspan="3">
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>&amp;Shape:</string>
+ </property>
+ <property name="buddy">
+ <cstring>shapeComboBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QComboBox" name="shapeComboBox">
+ <item>
+ <property name="text">
+ <string>House</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Car</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>&amp;Color:</string>
+ </property>
+ <property name="buddy">
+ <cstring>colorButton</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QToolButton" name="colorButton">
+ <property name="text">
+ <string>Choose Color...</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>&amp;Background:</string>
+ </property>
+ <property name="buddy">
+ <cstring>shapeComboBox_2</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QComboBox" name="shapeComboBox_2">
+ <item>
+ <property name="text">
+ <string>Sky</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Trees</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Road</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="0" colspan="3">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QToolButton" name="toolButton_2">
+ <property name="text">
+ <string>Save &amp;As...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>DisplayWidget</class>
+ <extends>QWidget</extends>
+ <header>displaywidget.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>shapeComboBox</sender>
+ <signal>currentIndexChanged(int)</signal>
+ <receiver>Window</receiver>
+ <slot>updateShape(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>288</x>
+ <y>232</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>336</x>
+ <y>234</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>colorButton</sender>
+ <signal>clicked()</signal>
+ <receiver>Window</receiver>
+ <slot>updateColor()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>301</x>
+ <y>262</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>337</x>
+ <y>267</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>shapeComboBox_2</sender>
+ <signal>currentIndexChanged(int)</signal>
+ <receiver>Window</receiver>
+ <slot>updateBackground(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>306</x>
+ <y>299</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>337</x>
+ <y>311</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>toolButton_2</sender>
+ <signal>clicked()</signal>
+ <receiver>Window</receiver>
+ <slot>saveSvg()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>298</x>
+ <y>336</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>307</x>
+ <y>348</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+ <slots>
+ <slot>updateBackground(int)</slot>
+ <slot>updateColor()</slot>
+ <slot>updateShape(int)</slot>
+ <slot>saveSvg()</slot>
+ </slots>
+</ui>
diff --git a/examples/painting/svggenerator/main.cpp b/examples/painting/svggenerator/main.cpp
new file mode 100644
index 0000000..fa8b0ab
--- /dev/null
+++ b/examples/painting/svggenerator/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 "window.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ Window window;
+ window.show();
+ return app.exec();
+}
diff --git a/examples/painting/svggenerator/resources/shapes.dat b/examples/painting/svggenerator/resources/shapes.dat
new file mode 100644
index 0000000..d9b981e
--- /dev/null
+++ b/examples/painting/svggenerator/resources/shapes.dat
Binary files differ
diff --git a/examples/painting/svggenerator/svggenerator.pro b/examples/painting/svggenerator/svggenerator.pro
new file mode 100644
index 0000000..4d08ba4
--- /dev/null
+++ b/examples/painting/svggenerator/svggenerator.pro
@@ -0,0 +1,15 @@
+FORMS = forms/window.ui
+HEADERS = displaywidget.h \
+ window.h
+RESOURCES = svggenerator.qrc
+SOURCES = displaywidget.cpp \
+ main.cpp \
+ window.cpp
+
+QT += svg
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/painting/svggenerator
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS svggenerator.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/painting/svggenerator
+INSTALLS += target sources
diff --git a/examples/painting/svggenerator/svggenerator.qrc b/examples/painting/svggenerator/svggenerator.qrc
new file mode 100644
index 0000000..061d1f6
--- /dev/null
+++ b/examples/painting/svggenerator/svggenerator.qrc
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>resources/shapes.dat</file>
+</qresource>
+</RCC>
diff --git a/examples/painting/svggenerator/window.cpp b/examples/painting/svggenerator/window.cpp
new file mode 100644
index 0000000..1965604
--- /dev/null
+++ b/examples/painting/svggenerator/window.cpp
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** 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 <QColorDialog>
+#include <QFileDialog>
+#include <QPainter>
+#include <QSvgGenerator>
+#include "window.h"
+#include "displaywidget.h"
+
+Window::Window(QWidget *parent)
+ : QWidget(parent)
+{
+ setupUi(this);
+}
+
+void Window::updateBackground(int background)
+{
+ displayWidget->setBackground(DisplayWidget::Background(background));
+}
+
+void Window::updateColor()
+{
+ QColor color = QColorDialog::getColor(displayWidget->color());
+ if (color.isValid())
+ displayWidget->setColor(color);
+}
+
+void Window::updateShape(int shape)
+{
+ displayWidget->setShape(DisplayWidget::Shape(shape));
+}
+
+//! [save SVG]
+void Window::saveSvg()
+{
+ QString newPath = QFileDialog::getSaveFileName(this, tr("Save SVG"),
+ path, tr("SVG files (*.svg)"));
+
+ if (newPath.isEmpty())
+ return;
+
+ path = newPath;
+
+//![configure SVG generator]
+ QSvgGenerator generator;
+ generator.setFileName(path);
+ generator.setSize(QSize(200, 200));
+ generator.setViewBox(QRect(0, 0, 200, 200));
+ generator.setTitle(tr("SVG Generator Example Drawing"));
+ generator.setDescription(tr("An SVG drawing created by the SVG Generator "
+ "Example provided with Qt."));
+//![configure SVG generator]
+//![begin painting]
+ QPainter painter;
+ painter.begin(&generator);
+//![begin painting]
+ displayWidget->paint(painter);
+//![end painting]
+ painter.end();
+//![end painting]
+}
+//! [save SVG]
diff --git a/examples/painting/svggenerator/window.h b/examples/painting/svggenerator/window.h
new file mode 100644
index 0000000..4bc4d22
--- /dev/null
+++ b/examples/painting/svggenerator/window.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** 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 WINDOW_H
+#define WINDOW_H
+
+#include "ui_window.h"
+
+//! [Window class definition]
+class Window : public QWidget, private Ui::Window
+{
+ Q_OBJECT
+
+public:
+ Window(QWidget *parent = 0);
+
+public slots:
+ void saveSvg();
+ void updateBackground(int background);
+ void updateColor();
+ void updateShape(int shape);
+
+private:
+ QString path;
+};
+//! [Window class definition]
+
+#endif