First of all, thanks for your answer d_stranz.
It was never my intention to give you headaches about how my app might look, but how could you possibly find out about my nuclear weapon based doomsday device plan?
Actually it's just a frameless window with some buttons, and two slightly rotated widgets stacked behind it on either side (image and notepad). The notepad cannot be written on, it's just there for the user to select entries and rearrange their order.
The whole app should move as one and the single parts aren't supposed to be movable individually.
Since my main widget in the center is frameless, I overwrote the mousePress-, mouseRelease- and mouseMoveEvents to make it movable by clicking and dragging on any empty space. I started with the "putting-everything-in-proxies" approach, and wanted to call QGraphicsView's move(), whenever those events are fired on the main widget, so that it would look like all three embedded widgets would move as one, but it seems that QGraphicsProxy doesn't pass the mouseReleaseEvent down to the embedded widget (I also had to setMouseTracking(True) on the widget to make the mouseMoveEvent fire, which wasn't necessary when I first tried my widget's mouse move functionality outside the whole Proxy-View stuff).
EDIT2: Solved the mouseReleaseEvent problem: I just had to add event.accept() to the mousePressEvent, as explained here
So I can move the whole app, but since the mouseReleaseEvent is never fired, it doesn't stop following the cursor. How should I go about making the whole GraphicsView (i.e. all three widgets as one) move when the user clicks and drags the center widget?
Another strange thing is, that python crashes after I close the application. I could narrow it down to QGraphicsProxyWidget, so that even if I just run this "pythonified" example from the docs, python still crashes, but only after I close the perfectly functional GrapicsView window:
if __name__ == '__main__':
view.show()
sys.exit(app.exec_())
if __name__ == '__main__':
app = QApplication(sys.argv)
scene = QGraphicsScene()
proxy = scene.addWidget(QListView())
view = QGraphicsView(scene)
view.show()
sys.exit(app.exec_())
To copy to clipboard, switch view to plain text mode
What am I missing here? And I apologize if this should go into a new thread, just notify me.
EDIT: The embedded dialogs demo from the PyQt example works like a charm.
I think you could dispense with your QLabel / proxy pair altogether. There are QGraphicsItem classes designed for displaying images.
That of course sounds way better and I'm ashamed I didn't think of it myself. Thanks.
Bookmarks