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. Help with QGraphicsScene, QGraphicsView
Forum Updated to NodeBB v4.3 + New Features

Help with QGraphicsScene, QGraphicsView

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 2.8k Views 1 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.
  • H Offline
    H Offline
    holygirl
    wrote on last edited by
    #1

    Hi All!

      I'm trying to develop a project for which I want to split the _mainwindow_ into multiple layouts so that I can add widgets to these layouts at a later stage without having to worry about its positioning. The _mainwindow_ layouts must look something like,
    

    | Layout 1 |

    | Layout 2 |

    | Layout 3 |

    I will be adding widgets onto this layout to display the UI on those widgets. Which is the best method to accomplish this? Should I use QGraphicsScene and QGraphicsView combo or QDockWidget? I'm not so sure about QDockWidget because I don't want the widgets to be moved. I tried setting layouts on a widget that was the centralwidget of the mainwindow but it wasn't so easy to add and delete widgets as needed. I had to reset the layouts each time. Does anybody have any ideas?
    Thanks.

    P.S. : I tries reading "this":http://qt-project.org/forums/viewthread/3119 Would it be an ideal solution for me?

    1 Reply Last reply
    0
    • L Offline
      L Offline
      loctar
      wrote on last edited by
      #2

      You could add three empty QWidgets to your main screen and use a vertical layout on them. This way you can add additional layouts/widgets later without breaking the main layout.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        holygirl
        wrote on last edited by
        #3

        I've tried that. I'm looking forward to using QGraphicsScene and QGraphicsView. Would you be knowing how I could solve my problem using the same? I've tried reading documentations and some examples from books but I can't really understand what they mean.

        1 Reply Last reply
        0
        • E Offline
          E Offline
          eliseev
          wrote on last edited by
          #4

          -I have a feeling you've got to go through some Qt tutorials...-

          All you need is QVBoxLayout with 3 children layouts (type is up to you to define). Then add your widgets to these children layouts. This can be done in like five clicks in the Designer. Where's your problem?

          QGraphicsView is a [derivative from] QWidget thus can be placed inside layouts. However, AFAIK it's not possible to use QLayouts inside QGraphicsScene. At least not directly. Do you really need QGraphicsScene or you just don't know what you need?

          QDockWidget is for docking windows. You don't need them as you've said.

          [quote author="holygirl" date="1359001751"]it wasn't so easy to add and delete widgets as needed. I had to reset the layouts each time.[/quote]
          Would you define "not so easy" with code sample?

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goblincoding
            wrote on last edited by
            #5

            I agree with Sergei, QGraphicsScene and QGraphicsView is mostly used for displaying 2D graphics and I'm pretty sure they aren't what you need for this problem.

            Everything you need can be achieved through layouts. I have written apps that dynamically build GUI's at run-time based on user input so I can assure you it is possible :)

            http://www.goblincoding.com

            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