
Originally Posted by
jacek
This looks OK (except that image and pixmap variables esentially hold the same data).
How does drawShape() implementation look like?
OK, the problem was with drawShape. drawShape() of ImageItem looked like this:
void ImageItem
::drawShape( QPainter &p
) {
// On Qt/Embedded, we can paint a QImage as fast as a QPixmap,
// but on other platforms, we need to use a QPixmap.
#if defined(Q_WS_QWS)
p.drawImage( int(x()), int(y()), image, 0, 0, -1, -1, OrderedAlphaDither );
#else
p.drawPixmap( int(x()), int(y()), pixmap );
#endif
}
void ImageItem::drawShape( QPainter &p )
{
// On Qt/Embedded, we can paint a QImage as fast as a QPixmap,
// but on other platforms, we need to use a QPixmap.
#if defined(Q_WS_QWS)
p.drawImage( int(x()), int(y()), image, 0, 0, -1, -1, OrderedAlphaDither );
#else
p.drawPixmap( int(x()), int(y()), pixmap );
#endif
}
To copy to clipboard, switch view to plain text mode
And I changed it to this:
void ImageItem
::drawShape( QPainter &p
) {
// On Qt/Embedded, we can paint a QImage as fast as a QPixmap,
// but on other platforms, we need to use a QPixmap.
#if defined(Q_WS_WIN)
p.drawImage( int(x()), int(y()), image, 0, 0, -1, -1, Qt::OrderedAlphaDither );
#else
p.drawPixmap( int(x()), int(y()), pixmap );
#endif
}
void ImageItem::drawShape( QPainter &p )
{
// On Qt/Embedded, we can paint a QImage as fast as a QPixmap,
// but on other platforms, we need to use a QPixmap.
#if defined(Q_WS_WIN)
p.drawImage( int(x()), int(y()), image, 0, 0, -1, -1, Qt::OrderedAlphaDither );
#else
p.drawPixmap( int(x()), int(y()), pixmap );
#endif
}
To copy to clipboard, switch view to plain text mode
And the butterfly was at last displayed !
So the problem is with Q_WS_QWS (maybe because it is from Qtopia?): used for detecting the type of windowing system that is used with Qt. Correspondingly there exist Q_WS_X11 and Q_WS_WIN that are set when compiling with Qt/X11 or Qt/Windows (and there's one
for mac in Qt3 versions).
Of course I can't just remove the macro that easily.... Why it didn't work when using Q_WS_QWS? It is OK to use Q_WS_X11, Q_WS_WIN... instead?
(I'm using windows...)
Bookmarks