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. What's the best way for doing this?
Forum Updated to NodeBB v4.3 + New Features

What's the best way for doing this?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 506 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.
  • AlveinA Offline
    AlveinA Offline
    Alvein
    wrote on last edited by
    #1

    Hello. Look at this form:

    Preview.PNG

    Imagine that's a fully working form, whose class is MainWindow, with everything encapsulated inside.

    Now, let's say I need another identical form but for a distinct entity (i.e., another instance of MainWindow).

    I create the new instance with some different properties set (identifying the new entity), so another window is shown with distinct data, etc.

    I could group many forms this way inside a MDI window.

    But what if I want each form content tabbed in a normal, parent window? Just imagine the full MainWindow contents (the client area) in one tab, another MainWindow instance contents in another tab, etc.

    Is that possible and how?

    Thanks for reading.

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

      Hi,

      You can have as many QMainWindow as you want however it's rather unusual to have more than one.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      AlveinA 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        You can have as many QMainWindow as you want however it's rather unusual to have more than one.

        AlveinA Offline
        AlveinA Offline
        Alvein
        wrote on last edited by Alvein
        #3

        @SGaist You are not following me.

        Look at this:

        Preview2.PNG

        .See how the contents of each "Entity" tab contain what was in the original MainWindow?

        The class is basically ready. How do I put an instance of that in each Entity tab? I know it's a weird, probably stupid question, though.

        BTW, it's named MainWindow but it could be any window with an associated class.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          So you want each Entity widget in a QTabWidget ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          AlveinA 1 Reply Last reply
          0
          • SGaistS SGaist

            So you want each Entity widget in a QTabWidget ?

            AlveinA Offline
            AlveinA Offline
            Alvein
            wrote on last edited by
            #5

            @SGaist If by "Entity widget" you mean whatever is inside the current MainWindow form/class, then yes.

            How do I do that? I could probably do this programmatically (by inserting the widgets, etc.) but the idea is, one, using the already finished MainWindow class (that can be named something else, you know); and two, still being able to use the form editor to modify elements in that form.

            jsulmJ 1 Reply Last reply
            0
            • AlveinA Alvein

              @SGaist If by "Entity widget" you mean whatever is inside the current MainWindow form/class, then yes.

              How do I do that? I could probably do this programmatically (by inserting the widgets, etc.) but the idea is, one, using the already finished MainWindow class (that can be named something else, you know); and two, still being able to use the form editor to modify elements in that form.

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Alvein Create a QWidget containing what you want to put into MainWindow and these Entities. Then you can edit this QWidget in designer and you can add it to your entities and MainWindow as you like.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              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