[PyQt] Rotate QMainWindow 180deg

Rob rob at pixelinspiration.net
Fri May 11 10:37:57 BST 2018


Hi,

For mad reasons I've been asked to see if I can get an app to toggle itself
by 180 degrees. Bit of googling came up with these two posts (in C++):

daringfireball.org/blog/rotating-qt-apps-in-literally-6-lines-of-code.html
https://forum.qt.io/topic/30230/solved-rotating-a-whole-ui/3

Which both suggest the same approach using QGraphicsProxyWidget,
QGraphicsScene and QGraphicsView which I've tried to implement like this
(very cut down code):

class MainWindow(QMainWindow):
    def __init__(self, url):

        self.browserWidget = Browser_Widget(self, url)
        self.setCentralWidget(self.browserWidget)

        self.scene = QGraphicsScene()
        self.view = QGraphicsView(self)
        self.proxy = self.scene.addWidget(self.centralWidget())
        self.view.setScene(self.scene)
        self.view.show()
        self.view.rotate(180)

Which gives me this small white rectangle at the top left:
<http://python.6.x6.nabble.com/file/t380167/pyqt1.jpg> 

Thanks for any thoughts.

Cheers,
Rob



--
Sent from: http://python.6.x6.nabble.com/PyQt-f1792048.html


More information about the PyQt mailing list