Hello peeps.
I got an issue with the usage of QTransform. As you can se in the attachment the pixmap after the transform is ugly and I cant figure out why this is.
The code I use is
{
initMyResource();
qreal width = m_pointer.size().width();
qreal height = m_pointer.size().height();
QTransform transform;
transform.translate(size().width()/2, size().height()/2);
transform.rotate(m_rotation);
transform.translate(-size().width()/2, -size().height()/2);
transform.scale(size().width() / width, size().height() / height);
boolPainter.setTransform(transform);
//boolPainter.setTransform(QTransform().translate(size().width()/2, size().height()/2)
// .rotate(m_rotation).translate(-size().width()/2, -size().height()/2));
boolPainter.drawPixmap(0, 0, m_pointer);
boolPainter.end();
}
void CDIPointer::paintEvent(QPaintEvent *)
{
initMyResource();
QPainter boolPainter(this);
qreal width = m_pointer.size().width();
qreal height = m_pointer.size().height();
QTransform transform;
transform.translate(size().width()/2, size().height()/2);
transform.rotate(m_rotation);
transform.translate(-size().width()/2, -size().height()/2);
transform.scale(size().width() / width, size().height() / height);
boolPainter.setTransform(transform);
//boolPainter.setTransform(QTransform().translate(size().width()/2, size().height()/2)
// .rotate(m_rotation).translate(-size().width()/2, -size().height()/2));
boolPainter.drawPixmap(0, 0, m_pointer);
boolPainter.end();
}
To copy to clipboard, switch view to plain text mode
Can anybody see how I can improve this so the quality stays the same?
Bookmarks