Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Building UI with QGraphics

    General and Desktop
    4
    6
    4696
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      decko last edited by

      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.png

      The 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.

      1 Reply Last reply Reply Quote 0
      • S
        Smar last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • M
          mario last edited by

          Have you considered using QML instead of QGraphics (if possible)?

          1 Reply Last reply Reply Quote 0
          • K
            kalle last edited by

            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.

            1 Reply Last reply Reply Quote 0
            • ?
              Guest last edited by

              if u want to explore other widgets, u culd just use the QTabWidget.. with 2 tabs, 2nd tab gets the focus when you pick the album in the first

              1 Reply Last reply Reply Quote 0
              • D
                decko last edited by

                Thanks for all of your answers, much appreciated. I've tried to look at qml and it seems like it can accomplish what I want, and it is relatively simple as well.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post