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. [Solved] Why children widgets overlapping in QGridLayout?
Forum Updated to NodeBB v4.3 + New Features

[Solved] Why children widgets overlapping in QGridLayout?

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 5.6k 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.
  • M Offline
    M Offline
    magurmach
    wrote on last edited by
    #1

    I have an widget x with fixed size. Then at first I took a QScrollArea and then a QGridLayout which I set as the layout of scrollAreaWidgetContent. Then I started adding some widget x in the layout at (0,0), (0,1), (1,0), (1,1)... of grid layout. Then when I ran the program, strangely when I shrink the window vertically, the widgets overlap.

    !http://imgur.com/gMMF5mK.png(Overlapped Widgets)!

    And as expected, when I increase the window size vertically, they are not overlapped anymore.

    !http://i.imgur.com/yGmty8a.png(Non Overlapped when stretched)!

    But strange thing is this problem does not occurring when I shrink window horizontally. For example,

    !http://imgur.com/6nxmotz.png(Horizontal shrinking)!

    My question is, why this is happening and more importantly, keeping in mind I want to use gridlayout, how to solve this problem?

    Edit: I am using Qt Creator 3.1.1 based on Qt 5.2.1

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

      Hi and welcome to devnet,

      You should also add which version of Qt you are using

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

      1 Reply Last reply
      0
      • M Offline
        M Offline
        magurmach
        wrote on last edited by
        #3

        [quote author="SGaist" date="1405028510"]Hi and welcome to devnet,

        You should also add which version of Qt you are using[/quote]

        Hi and thanks. I am using Qt Creator 3.1.1 based on Qt 5.2.1

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

          Did you set the sizePolicy of your widget with QSizePolicy::MinimumExpanding for vertical ?

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

          1 Reply Last reply
          0
          • M Offline
            M Offline
            magurmach
            wrote on last edited by
            #5

            Nope, but I solved the problem anyway. I don't know why it solved the problem. The scrollbar had a minimum height set. I set it back to 0, recompiled and run, and the problem was gone!

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

              Nice you found a solution and thanks for sharing.

              Please update the thread title prepending [solved] so other forum users may know a solution has been found :)

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - 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