Building UI with QGraphics
-
Hi
I'm trying to learn how to build custom ui's with the QGraphics classes. However there are a lot of those and I'm having trouble finding out where to start, and which of them I should be using.
For testing out the various features I have chosen to make sort of a media center ui for browsing music albums and tracks. This should consist of 2 "pages".
Page 1: "http://i55.tinypic.com/ac6e5v.png":http://i55.tinypic.com/ac6e5v.png
Page 2: "http://i53.tinypic.com/2vkhh7s.png":http://i53.tinypic.com/2vkhh7s.pngThe first page would show album covers and a title, and the user should be able to scroll through these. When an album is picked, some transition should lead the user to the next page.
How should I go about doing this? Should the pages be 2 GraphicsViews or GraphicsScenes or something completely different? Should the individual elements on the pages be grouped in GraphicsLayouts or GraphicsItemGroups?
Thanks in advance.
-
There are different ways to use graphics views, where I prefer using paged layouts where all pages are kept in memory, this wastes memory unnecessarily, so using single graphics view which gets every time you switch to different ”page” data parsed from source, for example using your own scene.
-
Note that these days, you have quite a few options for creating custom UI screens in Qt:
-
Custom widgets with their own custom painting
-
Using stylesheets
-
Developing a custom QStyle
-
Using QGraphicsView
-
Using QML
A lot of developers use QGraphicsView, because it's hot and new and cool (can something be both hot and cool?), but often what they do is not really what QGraphicsView was made for (which is many small independent objects, possibly moving, possibly animated). What you are trying to do could just as well be done using existing widgets and a custom style (and depending on the complexity beyond what you show in the screenshots, maybe even with stylesheets).
Of course, if what you are really after is learning about QGV, then by all means go ahead and have fun, and in that case, I agree with Smar for relatively static scenes.
-