Welcome to mirror list, hosted at ThFree Co, Russian Federation.

qtsvg.md « doc - github.com/torch/qtlua.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 288ae474b29de0bd6c77a504ddf2f5a12b2c63b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<a name="qtsvg.dok"></a>
# QtSvg Bindings #

The package `qtsvg` 
contains bindings for classes defined by the Qt module
[QtSvg](http://doc.trolltech.com/4.4/qtsvg.html).

Besides the capabilites reported below,
all qt variants inherit a set 
of [default methods](qt.md#QVariants),
and all qt object classes inherit the capabilities from their 
superclasses and automatically expose 
[properties, slots and signals](qt.md#QObjects).

You can also use the function 
[qtwidget.newpdf](qtwidget.md#qtwidgetnewpdf),
defined in module `qtwidget`,
to easily generate SVG files. 


<a name="qtsvg_loadsvg"></a>
### qtsvg.loadsvg(filename) ###
<a name="qtsvg.loadsvg"></a>

Returns a Qt object of 
class [qt.QSvgRenderer](#qsvgrenderer)
representing the SVG file `filename`.

<a name="qtsvg_paintsvg"></a>
### qtsvg.paintsvg(port,svg,...) ###
<a name="qtsvg.paintsvg"></a>

Draws a SVG image.

Argument `port` must be a 
[qt.QtLuaPainter](qtwidget.md#qtluapainter) or a 
[qtwidget'' high level port descriptor](qtwidget.md#highlevel).
Argument `svg` can be the SVG filename or
an instance of class [qt.QSvgRenderer](#qsvgrenderer)
such as those returned by function [qtsvg.loadsvg](#qtsvg_loadsvg).
The remaining arguments are the same
as those for the C++ function `QSvgRenderer::render`.


<a name="qsvgwidget"></a>
### qt.QSvgWidget ###

Class 
[QSvgWidget](http://doc.trolltech.com/4.4/qsvgwidget.html)
provides a widget that is used to display the contents 
of Scalable Vector Graphics (SVG) files.

<a name="qsvgwidget"></a>
#### qt.QSvgWidget([filename],[parent]) ####

Expression `qt.QSvgWidget(parent)` returns a 
new widget for rendering SVG data.

The optional argument `filename` specifies the name
of a file containing the SVG data.  Without this argument,
you must use slot `qsvgwidget:load()` to load SVG data.

The optional argument `parent` specifies the widget parent.
New widgets are always created from the main thread using
the [thread hopping](qt.md#qtqcall) mechanism.
When argument `parent` is `nil` or not specified,
the new widget is owned by the Lua interpreter 
and is automatically destroyed when the garbage collector
determines that it is no longer referenced.

<a name="qsvgwidget.renderer"></a>
#### qsvgwidget:renderer() ####

Returns the [qt.QSvgRenderer](#qsvgrenderer) object 
associated with this widget.


<a name="qsvgrenderer"></a>
### qt.QSvgRenderer ###

Class 
[QSvgRenderer](http://doc.trolltech.com/4.4/qsvgrenderer.html)
is used to draw the contents of SVG files onto paint devices.
You should use instead function 
[qtsvg.paintsvg](#qtsvg_paintsvg)
to easily display SVG data.

<a name="qsvgrenderer"></a>
#### qt.QSvgRenderer([filename],[parent]) ####

Creates a new instance of class `QSvgRenderer`.

The optional argument `filename` specifies the name
of a file containing the SVG data.  Without this argument,
you must use slot `qsvgwidget:load()` to load SVG data.

The optional argument `parent` specifies the widget parent.
When argument `parent` is `nil` or not specified,
the new widget is owned by the Lua interpreter 
and is automatically destroyed when the garbage collector
determines that it is no longer referenced.


<a name="qtluasvggenerator"></a>
### qt.QtLuaSvgGenerator ###

This is a thin wrapper around the Qt class
[QSvgGenerator](http://doc.trolltech.com/4.4/qsvggenerator.html).

You should use instead function 
[qtwidget.newpdf](qtwidget.md#qtwidgetnewpdf)
to easily generate SVG files.

<a name="qtluasvggenerator"></a>
#### qt.QtLuaSvgGenerator([filename],[parent]) ####

Creates a new instance of class `QtLuaSvgGenerator`.

When argument `filename` is present, the SVG data is written
into the specified file. Otherwise it is written into a memory
buffer accessible using the method 
[qsvggenerator:data()](#qtluasvggeneratordata).

The optional argument `parent` specifies the widget parent.
When argument `parent` is `nil` or not specified,
the new widget is owned by the Lua interpreter 
and is automatically destroyed when the garbage collector
determines that it is no longer referenced.

<a name="qtluasvggeneratordata"></a>
#### qtluasvggenerator:data() ####
<a name="qtluasvggenerator.data"></a>

Assuming the `qtluasvggenerator` was created without the `filename` argument,
this function returns a [qt.QByteArray](qtcore.md#qbytearray)
containing the generated SVG data.  This data may be incomplete
until [painter:close()](qtwidget.md#painterclose) has
been closed on all painters operating on `qtluasvggenerator`.

<a name="qtluasvggenerator.description"></a>
#### qtluasvggenerator.description ####

Starting with Qt-4.5, this string property defines 
the contents of the `<desc>` tag of the SVG file.

<a name="qtluasvggenerator.title"></a>
#### qtluasvggenerator.title ####

Starting with Qt-4.5, this string property defines 
the contents of the `<title>` tag of the SVG file.

<a name="qtluasvggenerator.size"></a>
#### qtluasvggenerator.size ####

This property contains a [qt.QSize](qtcore.md#qsize) 
variant containing the size of the drawable area.
This information is shown in the `viewBox` attribute of the `<svg>` tag.

<a name="qtluasvggenerator.resolution"></a>
#### qtluasvggenerator.resolution ####

This integer property defines the resolution, in dots per inch, 
of the coordinate system.
Together with `qtluasvggenerator.size`, this property determines
the contents of the `width` and `height` attributes of the `<svg>` tag.