Hello.
I created my own format for reading/writting objects from scene.
It works fine, but when I try to create QPixmap by using QGraphicsItemGroup
I have some problems.
... loading data from file....
painter.
setRenderHints(QPainter::Antialiasing);
itemc->paint(&painter, &opt);
}
scene->addPixmap(pixmap);
QPixmap pixmap(600, 150);
QPainter painter(&pixmap);
... loading data from file....
QGraphicsItem* item = importers.getData().at(0);
QStyleOptionGraphicsItem opt;
painter.setRenderHints(QPainter::Antialiasing);
QGraphicsItemGroup* group = qgraphicsitem_cast<QGraphicsItemGroup*>(item);
BOOST_FOREACH(QGraphicsItem* itemc, group->children()) {
itemc->paint(&painter, &opt);
}
scene->addPixmap(pixmap);
To copy to clipboard, switch view to plain text mode
Below code used to store information:
ds << path();
QTransform parentTransforms;
if(parentItem())
parentTransforms = parentItem()->transform();
ds << parentTransforms;
ds << transform();
QDataStream ds;
ds << path();
QTransform parentTransforms;
if(parentItem())
parentTransforms = parentItem()->transform();
ds << parentTransforms;
ds << transform();
To copy to clipboard, switch view to plain text mode
Below code used to load information:
QTransform parentTransforms;
QTransform transforms;
ds >> path >> parentTransforms >> transforms;
setPath(path);
setTransform(parentTransforms);
setTransform(transforms, true);
QPainterPath path;
QTransform parentTransforms;
QTransform transforms;
ds >> path >> parentTransforms >> transforms;
setPath(path);
setTransform(parentTransforms);
setTransform(transforms, true);
To copy to clipboard, switch view to plain text mode
Problem: QPainterPath starts drawing from position ...x=420(before drawing moveTo is called)
What kind of informations should I save for QPainterPath, to restore it corectly ?
Thanks, for reply.
Bookmarks