Please nominate your Qt Champions for 2021!

Autosize children of a QFrame

  • Hi
    I have a QFrame that contains some QLabel's.
    The width of the frame is set variable based on the content of one of the labels - this works as expected.
    The complete frame is animated instead of only shown and hidden, respecting the variable width - works as expected too.

    Is there a way to automatically extend the width of all child labels of the frame to the same, i.e. the current size the frame gets?
    I know I can set this with some lines of codes manually. However, if there is a functionality in Qt that can di this that would be the nicer solution.


  • Lifetime Qt Champion

    @McLion You can use layouts for those labels

Log in to reply