[Qt-interest] adding a QGraphicsPixmapItem

Malyushytsky, Alex alex at wai.com
Fri Oct 22 01:38:12 CEST 2010


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<mailto: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> [mailto: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<mailto: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<mailto:Qt-interest at trolltech.com>
http://lists.trolltech.com/mailman/listinfo/qt-interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101021/c93ef042/attachment.html 


More information about the Qt-interest-old mailing list