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. Add Widgets in a Tab to a layout with qt designer
Forum Updated to NodeBB v4.3 + New Features

Add Widgets in a Tab to a layout with qt designer

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 3 Posters 3.2k 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
    codeaway
    wrote on last edited by
    #1

    Hi,

    I am trying to add a TextEdit widget to a Tab Widget. This works as expected.
    But when I do resize the MainWindow widget at runtime, though the tabs themselves do resize, the TextEdit does not.

    Tried my best to add the TextEdit to a layout, but that seemed futile to me ?

    Any idea, how to resolve this ?

    TabbedWin.PNG

    TabbedWinRun.PNG

    Thanks

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

      Hi,

      Your QTextEdit is just "dropped" in your tab widget, you need to put it in a layout.

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

      C 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        Your QTextEdit is just "dropped" in your tab widget, you need to put it in a layout.

        C Offline
        C Offline
        codeaway
        wrote on last edited by
        #3

        @SGaist said in Add Widgets in a Tab to a layout with qt designer:

        Hi,

        Your QTextEdit is just "dropped" in your tab widget, you need to put it in a layout.

        I agree to what you said. But, the problem is the Layout options for textEdit all "appear to be" disabled.

        If I do a right click on the textEdit->Layout, there exists Adjust Size alone.
        Same is the situation with the Toolbar.

        Maybe I am missing something obvious ?

        Thanks

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

          The layout should be applied to the widget you have "under" your QTextEdit.

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

          C 1 Reply Last reply
          0
          • SGaistS SGaist

            The layout should be applied to the widget you have "under" your QTextEdit.

            C Offline
            C Offline
            codeaway
            wrote on last edited by
            #5

            @SGaist said in Add Widgets in a Tab to a layout with qt designer:

            The layout should be applied to the widget you have "under" your QTextEdit.

            I dont follow how to put it in a layout "with the options appeared to be disabled ?"

            Any thoughts, why it looks thus ?

            layout_disabled.png

            Thanks

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

              You have layouts available on the top left corner of the editor.

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

              C 1 Reply Last reply
              0
              • SGaistS SGaist

                You have layouts available on the top left corner of the editor.

                C Offline
                C Offline
                codeaway
                wrote on last edited by
                #7

                @SGaist said in Add Widgets in a Tab to a layout with qt designer:

                You have layouts available on the top left corner of the editor.

                I tried your suggestion, Dragged the QHboxLayout into the Tab, Added plainTextEdit to the layout. That was what you intended ?

                Hmm.. That did not seem to work either... Maybe I did something wrong ?

                hlayout_added.PNG

                hlayout_added_Run.PNG

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  Bonnie
                  wrote on last edited by Bonnie
                  #8

                  Just right click the QTabWidget from the right panel and set layout on it. That will apply the layout to the current page, not to the QTabWidget itself.
                  You should also be able to set the layout by right clicking in the blank part of tab_1 from the center.

                  C 1 Reply Last reply
                  5
                  • B Bonnie

                    Just right click the QTabWidget from the right panel and set layout on it. That will apply the layout to the current page, not to the QTabWidget itself.
                    You should also be able to set the layout by right clicking in the blank part of tab_1 from the center.

                    C Offline
                    C Offline
                    codeaway
                    wrote on last edited by
                    #9

                    @Bonnie said in Add Widgets in a Tab to a layout with qt designer:

                    Just right click the QTabWidget from the right panel and set layout on it. That will apply the layout to the current page, not to the QTabWidget itself.
                    You should also be able to set the layout by right clicking in the blank part of tab_1 from the center.

                    That fixed the issue.

                    Thanks!

                    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