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. Finding gap in layouts after adding scrollarea to the dock widget
Qt 6.11 is out! See what's new in the release blog

Finding gap in layouts after adding scrollarea to the dock widget

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 2 Posters 930 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
    sush123
    wrote on last edited by sush123
    #1

    Hi,

    I am trying to set scroll area to the dock widget, which has a vertical layout which gets filled dynamically with custom collapsible group box , when i add two or more collapsible groups i m getting gap between 1st and next collapsible group box .
    i have done setspacing = 0 for layout ;

    Note - it was working fine before i add scroll area .
    before it was something like this without scroll area-
    0_1557834322044_Capture1.PNG

    After adding this code in respective .Cpp
    QScrollArea* scrollArea = new QScrollArea(this);
    scrollArea->setGeometry(10, 10, 390, 800);
    scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    scrollArea->setWidgetResizable(true);
    scrollArea->setWidget(ui->dockWidget);

    0_1557833801436_Capture.PNG

    can anyone suggest me what could be the problem.

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

      hi
      i dont see any
      pLayout->setContentsMargins(0,0,0,0);

      1 Reply Last reply
      2
      • S Offline
        S Offline
        sush123
        wrote on last edited by
        #3

        i have set pLayout->setContentsMargins(0,0,0,0); still i cannot see any changes, same problem occurs.

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

          Ok.
          Since it also seems the TextEdit have space around it , im out of guesses.

          Are you sure you setContentsMargins on the right layout ?
          Did you try to raise the values and see space would become bigger ?

          1 Reply Last reply
          0
          • S Offline
            S Offline
            sush123
            wrote on last edited by sush123
            #5

            Yes i am setting to the right layout,
            after setting ui->pLayout->setContentsMargins(20,20,20,20); it effected left right top bottom, not the gap between two layouts it is happening only after adding scroll area ..

            0_1557913872355_Capture2_LI.jpg

            Also after adding ui->verticalLayout->setContentsMargins(20,20,20,20); to the inside layout results are like this:
            0_1557914571781_Capture3_LI.jpg
            if i close all :
            1_1557914571781_Capture4_LI.jpg !

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

              Hi
              Looks like its that collapse thing that does it.
              when open, there is no space between them.
              in any case, i have no more guesses.
              I would try with plain QFrames and see.

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

                This has been resolved by using QToolbox instead of custom widget
                Thank you

                1 Reply Last reply
                1

                • Login

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