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

Add Widgets in a Tab to a layout with qt designer

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 3 Posters 3.1k Views
  • 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 28 Sept 2020, 19:14 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
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 28 Sept 2020, 19:16 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 28 Sept 2020, 19:39
      1
      • S SGaist
        28 Sept 2020, 19:16

        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 28 Sept 2020, 19:39 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
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 28 Sept 2020, 19:40 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 28 Sept 2020, 19:52
          0
          • S SGaist
            28 Sept 2020, 19:40

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

            C Offline
            C Offline
            codeaway
            wrote on 28 Sept 2020, 19:52 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
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 28 Sept 2020, 19:56 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 28 Sept 2020, 20:11
              0
              • S SGaist
                28 Sept 2020, 19:56

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

                C Offline
                C Offline
                codeaway
                wrote on 28 Sept 2020, 20:11 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 29 Sept 2020, 00:10 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 29 Sept 2020, 14:09
                  5
                  • B Bonnie
                    29 Sept 2020, 00:10

                    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 29 Sept 2020, 14:09 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

                    7/9

                    28 Sept 2020, 20:11

                    • Login

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