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. Multiple views one document
Forum Updated to NodeBB v4.3 + New Features

Multiple views one document

Scheduled Pinned Locked Moved General and Desktop
6 Posts 5 Posters 5.5k 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.
  • C Offline
    C Offline
    ChicoB
    wrote on last edited by
    #1

    Hello,

    I want to have one document (data source) and multiple views of it, and the user should be able to create/close views from available options.Think about a series of data points and there would be a chart view,table view, list view, etc. All could be available in screen or layouted in a predefined manner.

    So i would like to ask how can i add more than one view in a SDI in QT?
    In MFC i had used MDI but limited the number of documents as one :).

    I am a total beginner in QT, so what do you suggest and is there any such example ?

    Bekir.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on last edited by
      #2

      Did you check the "model-view classes":http://doc.qt.nokia.com/4.7-snapshot/modelview.html? They are basically meant for exactly that usecase (one model holding data and one or more views visualizing it).

      1 Reply Last reply
      0
      • C Offline
        C Offline
        ChicoB
        wrote on last edited by
        #3

        thank you tobias, i could not make myself clear.

        The problem is when visualising actually, I want each widget act like a mdi widget but basically i have one document. For example, The interview demo uses QSplitter
        But I want each widget to be resizeable and can be closed at user's will.

        very basic scenario without using a splitter, two widgets, one showing a chart and the other one lists tabulated values.

        Best Regards

        Bekir

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          It is completely independent if the two views are on the same parent widget with a splitter or on two MDI subwindows. Just create the model in the right place (some controlling class or widget) and pass the pointer to the views.

          http://www.catb.org/~esr/faqs/smart-questions.html

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

            MDI in MFC really is related to documents. The views are then created by the window menu (typically).

            In Qt, The QMdiArea is a Widget frame, that holds MDI sub widgets. How you create them, if each of them has an onw document or not, is totally up to you.

            Nokia Certified Qt Specialist.
            Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #6

              ChicoB: how do you want to present the different views on your data? Do you want them to be separate windows, MDI subwindows? Positioned on different tabs? Items you can position in a bigger view area? The options are nearly endless, so you have to figure out a design that makes sense for your application.

              Then, Gerolf is right that you can use MDI, even if you are dealing with a single document. It really doesn't matter for Qt if you actually put separate documents in your MDI window or if you just present multiple views on the same document, or if you do something else entirely in your subwindows. It is up to you.

              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