~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/painting-svggenerator.html

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-11-02 18:30:08 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (15.2.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 88.
  • Revision ID: james.westby@ubuntu.com-20091102183008-b6a4gcs128mvfb3m
Tags: upstream-4.6.0~beta1
ImportĀ upstreamĀ versionĀ 4.6.0~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
<!DOCTYPE html
3
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
4
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
 
<!-- /fasttmp/mkdist-qt-4.5.2-1245473805/qt-x11-opensource-src-4.5.2/doc/src/examples/svggenerator.qdoc -->
 
5
<!-- svggenerator.qdoc -->
6
6
<head>
7
 
  <title>Qt 4.5: SVG Generator Example</title>
 
7
  <title>Qt 4.6: SVG Generator Example</title>
8
8
  <link href="classic.css" rel="stylesheet" type="text/css" />
9
9
</head>
10
10
<body>
11
11
<table border="0" cellpadding="0" cellspacing="0" width="100%">
12
12
<tr>
13
 
<td align="left" valign="top" width="32"><a href="http://qtsoftware.com/products/qt"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
14
 
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="namespaces.html"><font color="#004faf">All&nbsp;Namespaces</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
15
 
<td align="right" valign="top" width="230"></td></tr></table><h1 class="title">SVG Generator Example<br /><span class="subtitle"></span>
 
13
<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
 
14
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">All&nbsp;Functions</font></a>&nbsp;&middot; <a href="overviews.html"><font color="#004faf">Overviews</font></a></td><td class="searchBar" align="right" valign="center"><form action="http://www.google.com/cse" id="cse-search-box"><div><input type="hidden" name="cx" value="000136343326384750312:dhbxnqlakyu" /><input type="hidden" name="ie" value="UTF-8" /><input type="text" name="q" size="31" /><input type="submit" name="sa" value="Search" /></div></form></td>
 
15
</tr></table><h1 class="title">SVG Generator Example<br /><span class="subtitle"></span>
16
16
</h1>
17
17
<p>Files:</p>
18
18
<ul>
28
28
<p>The SVG Generator example shows how to add SVG file export to applications.</p>
29
29
<p align="center"><img src="images/svggenerator-example.png" /></p><p>Scalable Vector Graphics (SVG) is an XML-based language for describing two-dimensional vector graphics. Qt provides classes for rendering and generating SVG drawings. This example allows the user to create a simple picture and save it to an SVG file.</p>
30
30
<p>The example consists of two classes: <tt>Window</tt> and <tt>DisplayWidget</tt>.</p>
31
 
<p>The <tt>Window</tt> class contains the application logic and constructs the user interface from a Qt Designer <tt>.ui</tt> file as described in the <a href="designer-using-a-ui-file.html#the-multiple-inheritance-approach">Qt Designer manual</a>. It also contains the code to write an SVG file.</p>
 
31
<p>The <tt>Window</tt> class contains the application logic and constructs the user interface from a Qt Designer UI file as described in the <a href="designer-using-a-ui-file.html#the-multiple-inheritance-approach">Qt Designer manual</a>. It also contains the code to write an SVG file.</p>
32
32
<p>The <tt>DisplayWidget</tt> class performs all the work of painting a picture on screen. Since we want the SVG to resemble this picture as closely as possible, we make this code available to the <tt>Window</tt> class so that it can be used to generate SVG files.</p>
33
33
<a name="the-displaywidget-class"></a>
34
34
<h2>The DisplayWidget Class</h2>
63
63
 };</pre>
64
64
<p>Much of this class is used to configure the appearance of the drawing. The <tt>paintEvent()</tt> and <tt>paint()</tt> functions are most relevant to the purpose of this example, so we will describe these here and leave the reader to look at the source code for the example to see how shapes and colors are handled.</p>
65
65
<p>We reimplement the <a href="qwidget.html#paintEvent">QWidget::paintEvent</a>() function to display the drawing on screen:</p>
66
 
<pre> void DisplayWidget::paintEvent(QPaintEvent *event)
 
66
<pre> void DisplayWidget::paintEvent(QPaintEvent * <span class="comment">/* event */</span>)
67
67
 {
68
68
     QPainter painter;
69
69
     painter.begin(this);
171
171
<p>See the <a href="qtsvg.html">QtSvg</a> module documentation for more information about SVG and Qt's SVG classes.</p>
172
172
<p /><address><hr /><div align="center">
173
173
<table width="100%" cellspacing="0" border="0"><tr class="address">
174
 
<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
175
 
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
176
 
<td width="30%" align="right"><div align="right">Qt 4.5.2</div></td>
177
 
</tr></table></div></address></body>
 
174
<td width="40%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
 
175
<td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
176
<td width="40%" align="right"><div align="right">Qt 4.6.0</div></td>
 
177
<script type="text/javascript" src="http://www.google.com/jsapi"></script><script type="text/javascript">google.load("elements", "1", {packages: "transliteration"});</script><script type="text/javascript" src="http://www.google.com/coop/cse/t13n?form=cse-search-box&t13n_langs=en"></script><script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script></tr></table></div></address></body>
178
178
</html>