Nominate our 2022 Qt Champions!

Anyway to set global margin and spacing ?

  • As per title - can't seem to find anything in the docs.

    I just want all my containers and widgets to have the same margin and spacing or do I have to do each one individually ?

    Many thanks.

  • Lifetime Qt Champion

    There is none as far as I know.

    You can adjust via style sheets like
    QWidget { padding: 0px; margin:0 px; }
    on a top container widget
    and it will apply to all childs.

    However, using a stylesheet might change the look of some widgets if
    already styled.

    What I normally do is to use the filter function of the
    Creator property editor (in top)
    so only layout Margins are listed, (no scrolling)
    and then select multiple layouts to set in one go.

    It would also be easy to set all from code at start up.

  • Thanks again - I'll have a play with the style sheets.

    If that doesn't work I'll try your other method.

    Cheers :)

Log in to reply