static PyObject *meth_QPictureIO_setFormat(PyObject *sipSelf, PyObject *sipArgs) { PyObject *sipParseErr = NULL; { const char* a0; QPictureIO *sipCpp; if (sipParseArgs(&sipParseErr, sipArgs, "Bs", &sipSelf, sipType_QPictureIO, &sipCpp, &a0)) { sipCpp->setFormat(a0); Py_INCREF(Py_None); return Py_None; } } /* Raise an exception if the arguments couldn't be parsed. */ sipNoMethod(sipParseErr, sipName_QPictureIO, sipName_setFormat, doc_QPictureIO_setFormat); return NULL; }
int main() { QWidget myWidget; { // RECORD //! [0] QPicture picture; QPainter painter; painter.begin(&picture); // paint in picture painter.drawEllipse(10,20, 80,70); // draw an ellipse painter.end(); // painting done picture.save("drawing.pic"); // save picture //! [0] } { // REPLAY //! [1] QPicture picture; picture.load("drawing.pic"); // load picture QPainter painter; painter.begin(&myImage); // paint in myImage painter.drawPicture(0, 0, picture); // draw the picture at (0,0) painter.end(); // painting done //! [1] } QPicture myPicture; { // FORMATS //! [2] QStringList list = QPicture::inputFormatList(); foreach (QString string, list) myProcessing(string); //! [2] } { // OUTPUT //! [3] QStringList list = QPicture::outputFormatList(); foreach (QString string, list) myProcessing(string); //! [3] } { // PIC READ //! [4] QPictureIO iio; QPixmap pixmap; iio.setFileName("vegeburger.pic"); if (iio.read()) { // OK QPicture picture = iio.picture(); QPainter painter(&pixmap); painter.drawPicture(0, 0, picture); } //! [4] } { QPixmap pixmap; // PIC WRITE //! [5] QPictureIO iio; QPicture picture; QPainter painter(&picture); painter.drawPixmap(0, 0, pixmap); iio.setPicture(picture); iio.setFileName("vegeburger.pic"); iio.setFormat("PIC"); if (iio.write()) return true; // returned true if written successfully //! [5] } }