ashukla
3rd February 2008, 13:46
Dear All!
QGraphicsTextItem *scrItem = new QGraphicsTextItem("WELCOME MY SIR");
scrItem->setDocument(txt->document());
QDir::setCurrent(QDir::currentPath ()+"/media");
QPixmap pico("rose.jpg");
pico=pico.scaled ( t.Font.pointSize(),t.Font.pointSize(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation ));
QGraphicsItem *ship=new MyPixmapItem(pico,0,1);
scrItem->setFont(t.Font);
QGraphicsItemGroup *gpItem=new QGraphicsItemGroup;
gpItem->addToGroup (ship);
gpItem->addToGroup (scrItem);
gpItem->addToGroup (scrItem1);
QGraphicsScene *scene=new QGraphicsScene();
QPointF m(scrItem->mapToItem (ship,QPointF(ship->boundingRect().width(),0)));
qDebug()<<"Before\tText Item POS = "<<scrItem->scenePos()<<" Image Item POS = "<<ship->scenePos();
scrItem->changeGeometry();
QPointF sf=scrItem->mapFromScene(scrItem->mapToScene(m));
qDebug()<<sf;
qDebug()<<"After\tText Item POS = "<<scrItem->scenePos()<<" Image Item POS = "<<ship->scenePos()<<"\n";
view=new QGraphicsView(scene,btgScrollText);
scene->addItem(gpItem);
QGraphicsItemAnimation *animation = new QGraphicsItemAnimation;
animation->setItem(gpItem);
I want to put scrItem after ship object. How to map this.
QGraphicsTextItem *scrItem = new QGraphicsTextItem("WELCOME MY SIR");
scrItem->setDocument(txt->document());
QDir::setCurrent(QDir::currentPath ()+"/media");
QPixmap pico("rose.jpg");
pico=pico.scaled ( t.Font.pointSize(),t.Font.pointSize(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation ));
QGraphicsItem *ship=new MyPixmapItem(pico,0,1);
scrItem->setFont(t.Font);
QGraphicsItemGroup *gpItem=new QGraphicsItemGroup;
gpItem->addToGroup (ship);
gpItem->addToGroup (scrItem);
gpItem->addToGroup (scrItem1);
QGraphicsScene *scene=new QGraphicsScene();
QPointF m(scrItem->mapToItem (ship,QPointF(ship->boundingRect().width(),0)));
qDebug()<<"Before\tText Item POS = "<<scrItem->scenePos()<<" Image Item POS = "<<ship->scenePos();
scrItem->changeGeometry();
QPointF sf=scrItem->mapFromScene(scrItem->mapToScene(m));
qDebug()<<sf;
qDebug()<<"After\tText Item POS = "<<scrItem->scenePos()<<" Image Item POS = "<<ship->scenePos()<<"\n";
view=new QGraphicsView(scene,btgScrollText);
scene->addItem(gpItem);
QGraphicsItemAnimation *animation = new QGraphicsItemAnimation;
animation->setItem(gpItem);
I want to put scrItem after ship object. How to map this.