Okay, I've been sitting on this issue for at least 4 hours now and just am exhausted.
I'm trying to simply rotate a QGraphicsPixmapItem by 45° around its own axis.
{
this
->setPixmap
(QPixmap("wallpaper.jpg"));
QTransform t = this->transform();
t.translate(this->pixmap().width()/2, this->pixmap().height()/2);
t.rotate(45, Qt::XAxis);
t.translate(-this->pixmap().width()/2, -this->pixmap().height()/2);
this->setTransform(t);
}
MyPixmap::MyPixmap() : QGraphicsPixmapItem()
{
this->setPixmap(QPixmap("wallpaper.jpg"));
QTransform t = this->transform();
t.translate(this->pixmap().width()/2, this->pixmap().height()/2);
t.rotate(45, Qt::XAxis);
t.translate(-this->pixmap().width()/2, -this->pixmap().height()/2);
this->setTransform(t);
}
To copy to clipboard, switch view to plain text mode
I tried alot of other options but the image is always moving around the whole screen and this is what comes out:

Shouldn't the lower edge be large and the upper edge small, like a trapezoid? Anyway, that's what I want it to be but it seems like I'm missing something here
Bookmarks