Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Best approach to include a graphical scene in a classical GUI
Qt 6.11 is out! See what's new in the release blog

[SOLVED] Best approach to include a graphical scene in a classical GUI

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 1.3k Views 2 Watching
  • 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.
  • J Offline
    J Offline
    JanLaloux
    wrote on last edited by JanLaloux
    #1

    Suppose you have a classical GUI with menu's, tree views etc. You want to include a simple statical graphical scene with lines, circles rectangles that you can click on to trigger events. What is the best approach:

    • QPainter on a QFrame, but then how to know on which graphical item the user clicks?
    • Qt Quick, seems overkill and not sure it can be embedded
    • QGraphicsScene, same remark as it needs QGraphicsView to show it
    • Other possibilities?

    Please advise!

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      @JanLaloux said:

      I vote for QGraphicsView as would be very fast to implement,
      Please see the 40000 sample.

      You could also just use widgets with your own paint event and a property to
      specify if its a circle / rectangle. Sort of a Shape Widget and then just override mouse events and you know when its clicked. But close lines might cause clicking issues.

      Will it change over time or be like a static image ?

      J 1 Reply Last reply
      1
      • mrjjM mrjj

        @JanLaloux said:

        I vote for QGraphicsView as would be very fast to implement,
        Please see the 40000 sample.

        You could also just use widgets with your own paint event and a property to
        specify if its a circle / rectangle. Sort of a Shape Widget and then just override mouse events and you know when its clicked. But close lines might cause clicking issues.

        Will it change over time or be like a static image ?

        J Offline
        J Offline
        JanLaloux
        wrote on last edited by
        #3

        @mrjj It will change but in a "static" way: items can be hidden by clicking on it, the result of calculations will be shown by means of encircling items and drawing arrows between them, so no animations or other fancy stuff.
        I will have a look at the 40000 Chips example, thanks.

        mrjjM 1 Reply Last reply
        0
        • J JanLaloux

          @mrjj It will change but in a "static" way: items can be hidden by clicking on it, the result of calculations will be shown by means of encircling items and drawing arrows between them, so no animations or other fancy stuff.
          I will have a look at the 40000 Chips example, thanks.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @JanLaloux
          Ok, that kind of static.
          Also see the Diagram Scene sample. Its a mini drawing app and it has arrow drawing :)
          The "items" that will be encircled. Those are text or ?

          J 1 Reply Last reply
          0
          • mrjjM mrjj

            @JanLaloux
            Ok, that kind of static.
            Also see the Diagram Scene sample. Its a mini drawing app and it has arrow drawing :)
            The "items" that will be encircled. Those are text or ?

            J Offline
            J Offline
            JanLaloux
            wrote on last edited by
            #5

            @mrjj Correct, it's numbers that are encircled. The Diagram Scene example looks interesting!

            mrjjM 1 Reply Last reply
            0
            • J JanLaloux

              @mrjj Correct, it's numbers that are encircled. The Diagram Scene example looks interesting!

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @JanLaloux
              Aha, sounds interesting.
              Yeah, I assumed that it would as it sort
              of sounded a bit like that.
              Should be easy to adjust it for your needs and is not much more code
              than some basic widget drawing would be.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved