Created
April 29, 2011 18:43
-
-
Save xlarsx/948788 to your computer and use it in GitHub Desktop.
QT Transformation Widget
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Ref: http://www.qtcentre.org/threads/27130-Rotate-QGraphicsProxyWidget-in-QGraphicsView | |
#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(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment