I just made my complete working code:
#include <QtCore>
#include <QtGui>
int main(int argc, char **argv)
{
gv.setScene(&scene);
gv.
setRenderHint(QPainter::Antialiasing);
lo.addWidget(&btn);
wi.setLayout(&lo);
QGraphicsProxyWidget *pw = scene.addWidget(&wi);
pw->setPos(0, 0);
pw->setRotation(-20);
gv.show();
return a.exec();
}
#include <QtCore>
#include <QtGui>
int main(int argc, char **argv)
{
QApplication a(argc, argv);
QGraphicsView gv;
QGraphicsScene scene(-200,-200,400,400);
gv.setScene(&scene);
gv.setRenderHint(QPainter::Antialiasing);
gv.setDragMode(QGraphicsView::ScrollHandDrag);
QWidget wi;
QVBoxLayout lo;
QPushButton btn("My Button", &wi);
lo.addWidget(&btn);
wi.setLayout(&lo);
QGraphicsProxyWidget *pw = scene.addWidget(&wi);
pw->setPos(0, 0);
pw->setRotation(-20);
gv.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
And what I get is on the screenshot. Am I missing something in my code?
EDIT:
The button is only displayed correctly when the Aero highlighting animation takes place on hover (when finished it is displayed wrong again)
Bookmarks