[Qt-interest] adding a QGraphicsPixmapItem

Malyushytsky, Alex alex at wai.com
Fri Oct 22 23:23:52 CEST 2010


All I can say without seen full compliable example is that this seems does not happen to me 
and the code you displayed could make it possible.
Animation does not start magically.

Make a small compilable example which displays the problem.
Basically create view, scene, show them, create an item not overriding any of those.
Still have a problem? - Post the code.
No problem? - find what is difference between that code and you application.

Alex



From: pmqt71 [mailto:pmqt71 at gmail.com] 
Sent: Friday, October 22, 2010 2:10 AM
To: Malyushytsky, Alex
Cc: qt-interest at trolltech.com
Subject: Re: [Qt-interest] adding a QGraphicsPixmapItem

 
No, the problem is not in the animate method.
 
the only statement:
QGraphicsPixmapItem* item = gs->addPixmap(pixmap);
removing the animate stuff,  makes the pixmap appear with a short animation.
 
I'll attach the source code on a next post... 
 
thanks
 
pm
 

 
 
2010/10/22 Malyushytsky, Alex <alex at wai.com> 

You re-implemented  advance().
That what caused the item move.
Make it do nothing and it will not animate.
 
Alex
 
 
From: pmqt71 [mailto:pmqt71 at gmail.com] 
Sent: Thursday, October 21, 2010 3:43 PM
To: Malyushytsky, Alex; qt-interest at trolltech.com
Subject: Re: [Qt-interest] adding a QGraphicsPixmapItem
 
I'm using Qt 4.6.2 on xp, VC++ Express 2008.
 
I partially solved overriding the paint method and drawing the pixmap using the painter:
painter->drawPixmap(0, 0, 20, 20, m_pixmap);
 
But I still have the strange problem calling the scene's update method after moving the pixmap:
 
class MyQGraphicsPixmapItem: public QGraphicsPixmapItem
{
...
void advance(int step)
{
    if(!step) return;
    moveBy(1, 0);
    
    //ok
    this->scene()->update();
    
    //nok, the pixmap starts from the scene's center and moves to its position.
    //this->scene()->update( 0, 0, 20, 20);
 
}
};
 
I'm now searching the documentation to improve the update part, but I'd like to know what causes the strange animation.
 
pm

 
2010/10/21 Malyushytsky, Alex <alex at wai.com>
What version of Qt you are using?
That sounds weird, when I use QGraphicsPixmapItem it just displayed at the location it supposed to be . 
 
Alex
 
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of pmqt71
Sent: Thursday, October 21, 2010 6:17 AM
To: qt-interest at trolltech.com
Subject: [Qt-interest] adding a QGraphicsPixmapItem
 
Hi all,
adding a QGraphicsPixmapItem on a QGraphicsScene, I see a short animation showing the pixmap moving from the scene's center to the top-right corner.
How to disable this effect? I just want the pixmap in the top-right corner of the scene.

the statement is:
QGraphicsPixmapItem* item = gs->addPixmap(pixmap);
thanks
pm
 
 


---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.

"This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you."

"Please consider our environment before printing this email."

_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
 

_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest






More information about the Qt-interest-old mailing list