#include <q3picture.h>
Inheritance diagram for Q3Picture:


Q3Picture can also read and write SVG (Scalable Vector Graphics) files; these files are in an XML format specified by { http://www.w3.org/Graphics/SVG/ W3C}. Note that when using the load() and save() functions to read and write SVG files, the format must be specified.
Definition at line 33 of file q3picture.h.
Public Member Functions | |
| Q3Picture () | |
| Q3Picture (const QPicture &pic) | |
| bool | load (QIODevice *dev, const char *format=0) |
| bool | load (const QString &fileName, const char *format=0) |
| bool | save (QIODevice *dev, const char *format=0) |
| bool | save (const QString &fileName, const char *format=0) |
| Q3Picture::Q3Picture | ( | ) | [inline] |
| Q3Picture::Q3Picture | ( | const QPicture & | other | ) | [inline] |
| bool Q3Picture::load | ( | QIODevice * | device, | |
| const char * | format = 0 | |||
| ) |
Loads the picture in the specified format from the given device. Returns true if the file is loaded successfully; otherwise returns false.
Note that when using the load() function to read SVG files, the format must be specified. For example:
Reimplemented from QPicture.
Definition at line 141 of file q3picture.cpp.
References QPainter::Antialiasing, b, Q3SvgDevice::boundingRect(), Q3SvgDevice::load(), QPicture::load(), p, Q3SvgDevice::play(), and qstrcmp().
Referenced by load().
00142 { 00143 if (qstrcmp(format, "svg" ) == 0) { 00144 Q3SvgDevice svg; 00145 if (!svg.load(dev)) 00146 return false; 00147 QPainter p(this); 00148 p.setRenderHint(QPainter::Antialiasing); 00149 bool b = svg.play(&p); 00150 d_func()->brect = svg.boundingRect(); 00151 return b; 00152 } 00153 return QPicture::load(dev, format); 00154 }
Here is the call graph for this function:

| bool Q3Picture::load | ( | const QString & | fileName, | |
| const char * | format = 0 | |||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Loads the picture in the specified format from a file with the given fileName. Returns true if the file is loaded successfully; otherwise returns false.
Reimplemented from QPicture.
Definition at line 117 of file q3picture.cpp.
References load(), QFile::open(), and QIODevice::ReadOnly.
00118 { 00119 QFile f(fileName); 00120 if (!f.open(QIODevice::ReadOnly)) 00121 return false; 00122 return load(&f, format); 00123 }
Here is the call graph for this function:

| bool Q3Picture::save | ( | QIODevice * | device, | |
| const char * | format = 0 | |||
| ) |
Saves the picture in the specified format to the given device.
Note that when using the save() function to save SVG files, the format must be specified. For example:
Q3Picture picture; QPainter painter; painter.begin(&picture); // paint in picture ... painter.end(); // painting done picture.save("drawing.svg", SVG); // save picture
Reimplemented from QPicture.
Definition at line 204 of file q3picture.cpp.
References QPicture::boundingRect(), p, QPaintDevice::paintingActive(), QPicture::play(), qstricmp(), qWarning(), QPicture::save(), Q3SvgDevice::save(), and Q3SvgDevice::setBoundingRect().
00205 { 00206 if (paintingActive()) { 00207 qWarning("Q3Picture::save: still being painted on. " 00208 "Call QPainter::end() first"); 00209 return false; 00210 } 00211 00212 if (qstricmp(format, "svg") == 0) { 00213 Q3SvgDevice svg; 00214 QPainter p(&svg); 00215 if (!play(&p)) 00216 return false; 00217 svg.setBoundingRect(boundingRect()); 00218 return svg.save(dev); 00219 } 00220 00221 return QPicture::save(dev, format); 00222 }
Here is the call graph for this function:

| bool Q3Picture::save | ( | const QString & | fileName, | |
| const char * | format = 0 | |||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Saves the picture in the specified format to the file with the given fileName.
Reimplemented from QPicture.
Definition at line 163 of file q3picture.cpp.
References QPicture::boundingRect(), p, QPaintDevice::paintingActive(), QPicture::play(), qstricmp(), qWarning(), QPicture::save(), Q3SvgDevice::save(), and Q3SvgDevice::setBoundingRect().
00164 { 00165 if (paintingActive()) { 00166 qWarning("Q3Picture::save: still being painted on. " 00167 "Call QPainter::end() first"); 00168 return false; 00169 } 00170 00171 // identical to QIODevice* code below but the file name 00172 // makes a difference when it comes to saving pixmaps 00173 if (qstricmp( format, "svg") == 0) { 00174 Q3SvgDevice svg; 00175 QPainter p(&svg); 00176 if (!play(&p)) 00177 return false; 00178 svg.setBoundingRect(boundingRect()); 00179 return svg.save(fileName); 00180 } 00181 00182 return QPicture::save(fileName, format); 00183 }
Here is the call graph for this function:

1.5.1