Well, finally solved with the QPainter aproximation.
//Please note this method takes 2 mseg to finish for a 20x20 pixmap.
QPixmap rotatedPixmap
(m_pixOriginal.
size());
rotatedPixmap.
fill(QColor::fromRgb(0,
0,
0,
0));
//the new pixmap must be transparent.QSize size
= m_pxOriginal.
size();
p->translate(size.height()/2,size.height()/2);
p->rotate(m_iAngle);
p->translate(-size.height()/2,-size.height()/2);
p->drawPixmap(0, 0, m_pxOriginal);
p->end();
delete p;
m_pxItem->setPixmap(rotatedPixmap);
//Please note this method takes 2 mseg to finish for a 20x20 pixmap.
QPixmap rotatedPixmap(m_pixOriginal.size());
rotatedPixmap.fill(QColor::fromRgb(0, 0, 0, 0)); //the new pixmap must be transparent.
QPainter* p = new QPainter(&rotatedPixmap);
QSize size = m_pxOriginal.size();
p->translate(size.height()/2,size.height()/2);
p->rotate(m_iAngle);
p->translate(-size.height()/2,-size.height()/2);
p->drawPixmap(0, 0, m_pxOriginal);
p->end();
delete p;
m_pxItem->setPixmap(rotatedPixmap);
To copy to clipboard, switch view to plain text mode
Definitly there is a translation problem when rotating a QPixmap, I don't know if its because the conversion to/from QImage or the known small rotation (according the QtAssistan it's possible to solve it with QPixmap::trueMatrix, but It doesn't solve it in my code) but the pixmap rotation is an issue in Qt.
Bookmarks