Finding gap in layouts after adding scrollarea to the dock widget

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

    After adding this code in respective .Cpp
    QScrollArea* scrollArea = new QScrollArea(this);
    scrollArea->setGeometry(10, 10, 390, 800);


    can anyone suggest me what could be the problem.

  • Lifetime Qt Champion

    i dont see any

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

  • Lifetime Qt Champion

    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 ?

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


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

  • Lifetime Qt Champion

    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.

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

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.