Joe Bloe
Joe Bloe

Reputation: 383

Qt: QGraphicsProxyWidgets for compound application vs. mixing QWidgets and QGraphicsView

I’m planning to write a little application (mainly Windows compatible) using PyQt and need some help to find the right approach. The app shall contain a QLabel to show an image, a frameless window with some QPushButtons and a QListView. Now the problem is, that both the QLabel and the QListView shall be rotated by a fixed angle around the Z-Axis. The idea is to make the whole app look like a photograph and a notepad laying underneath some sort of technical device (the main widget in the center). All three widgets shall form a compound, that has a fixed size and can be moved as one window, however I want to preserve the “clattered” look and make it frameless, the main widget shall have minimize/close buttons.

I managed to make the notepad look like somebody had just thrown it on the desktop by using a transformed QGraphicsProxyWidget inside a frameless, transparent QGraphicsView, which is pretty satisfying as I didn’t have to bother about rotating the area receiving mouse events. Now I’m wondering, how to connect this part with the rest. The possibilities I could think of are:

Two “features” I’d like to have are a drop-shadow for the whole app (I can recall having problems to get a QGraphicsEffect to work simultaneously on different widgets in the past) and a mask for the whole app, so the parts that are inside the bounds of a widget but invisible don’t receive mouse events. I’d also like the app to open up without much delay, but I have no idea if showing a rotated image in a QLabel would be faster or slower than rotating the whole QLabel inside a QGraphicsView (the image is going to be swapped a few times at runtime).

I hope someone can clarify which way to take or point out the pros and cons of the different approaches. Thanks in advance.

*Python Image Library

Upvotes: 2

Views: 462

Answers (1)

Joe Bloe
Joe Bloe

Reputation: 383

I had more luck over at the QtCentre forum, for anyone interested, here's the link, also discussing some other problems I ran into:

http://www.qtcentre.org/threads/53945-Putting-all-widgets-in-QGraphicsView-using-QGraphicsProxyWidgets-Good-idea

I decided to put everything in QGraphicsProxyWidgets and wrap them up inside a frameless, transparent QGraphicsView, which gives me everything I wanted.

Upvotes: 1

Related Questions