Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QScrollArea hates QTabWidget ?
Qt 6.12 LTS is out! See what's new in the release blog

QScrollArea hates QTabWidget ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 2 Posters 1.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.
  • S Offline
    S Offline
    SamiV123
    wrote on last edited by SamiV123
    #1

    Hello,

    Sorry if this is dupe, I searched and while I found a bunch of (old) threads nothing that seemed to be the same problem.

    Basically I have a QTabWidget that has about 7 tabs.

    I'm trying to put the tab widget inside a scroll area.

    My goal is to have the scroll area resize itself and contents so that the tab
    widget fits and there is no horizontal scrolling needed.

    But whatever I do when I remove horizontal scrolling the scroll area will figure out a size where the tab widget will be clipped horizontally. Even the little buttons to move to a different tab won't appear.

    Is there a right way to do this?

    My QScrollArea has Preferred, Preferred size policy, No horizontal scroll bars. Resize widgets is enabled.

    I tried the tab widget with Preferred, Preferred, Minimum,Maximum etc and none seems to work....

    Thanks for any tips!

    S 1 Reply Last reply
    0
    • S SamiV123

      Hello,

      Sorry if this is dupe, I searched and while I found a bunch of (old) threads nothing that seemed to be the same problem.

      Basically I have a QTabWidget that has about 7 tabs.

      I'm trying to put the tab widget inside a scroll area.

      My goal is to have the scroll area resize itself and contents so that the tab
      widget fits and there is no horizontal scrolling needed.

      But whatever I do when I remove horizontal scrolling the scroll area will figure out a size where the tab widget will be clipped horizontally. Even the little buttons to move to a different tab won't appear.

      Is there a right way to do this?

      My QScrollArea has Preferred, Preferred size policy, No horizontal scroll bars. Resize widgets is enabled.

      I tried the tab widget with Preferred, Preferred, Minimum,Maximum etc and none seems to work....

      Thanks for any tips!

      S Offline
      S Offline
      SamiV123
      wrote on last edited by
      #2

      @SamiV123

      This is how everything looks in the Qt Designer

      1793499b-2b62-4c86-99d4-d9dec68a2fbc-image.png

      This is the reality when using 'Expanding' size policy on the scroll area.

      8224e9bb-4ba5-47bb-8345-01a7c1c842fe-image.png

      Finally this is the reality when using 'Preferred' size policy on the scroll area.

      7a81e732-ec81-4083-9091-3b1f1d0db67b-image.png

      The result that I get in designer is what I'd like in reality.

      The wildly expanding one is the only way I can make it not clip but it's really just not usable as such.

      And the clipping one is not usable because sideways scrolling really sucks. (in general)

      Why is this such a PITA? This is about 180 from WYSIWYG and is an overall garbage dev UX.

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

        Hi,

        If memory serves well, for that kind of thing to happen, you need to trigger a resize of your QScrollArea when you switch widgets so it can resize the way you want it.

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

        S 1 Reply Last reply
        1
        • SGaistS SGaist

          Hi,

          If memory serves well, for that kind of thing to happen, you need to trigger a resize of your QScrollArea when you switch widgets so it can resize the way you want it.

          S Offline
          S Offline
          SamiV123
          wrote on last edited by
          #4

          @SGaist

          Hi, what do you mean by "switch widgets" ?

          SGaistS 1 Reply Last reply
          0
          • S SamiV123

            @SGaist

            Hi, what do you mean by "switch widgets" ?

            SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            When you change tab.

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

            S 1 Reply Last reply
            0
            • SGaistS SGaist

              When you change tab.

              S Offline
              S Offline
              SamiV123
              wrote on last edited by
              #6

              @SGaist

              Continuing my endless grind and fight with QScrollarea..

              what should I call exactly?

              adjustSize() ? On what widget? The scroll area or the scroll area widget contents ?

              I'm really having no luck with this, it's always effed up in some way.

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SamiV123
                wrote on last edited by SamiV123
                #7

                1d9519bb-45a5-4f95-80af-9a0f1014bbdf-image.png

                Things in the middle getting squished, I have no idea why. The vertical size policy is preferred.

                The list widget at the top is set to minimumExpanding.

                The bottom most groupbox has also preferred vertical size policy. But this isn't getting squished.

                why.....

                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
                • Unsolved