Important: Please read the Qt Code of Conduct -

Qt3 to 4 porting. QLabel::setAutoResize()

  • In Qt4 the function QLabel::setAutoResize() disappeared. The porting documentation says that this virtual function is replaced with "Setter".

    What does it mean? I do not find any function to set this value.

    The suggested replacements in Google are:

    • adjustSize()
    • to determine the size of the text and call setFixedSize() on the label

    But both of them requires the additional connection (connect to textChanged() signal and update label size).

    Does anybody know the simpler replacement for this function in Qt4?

  • Put the label in a layout and set the size policy.

  • [quote author="Bradley" date="1291366032"]Put the label in a layout and set the size policy.[/quote]

    Great! Thank you. So simple. I feel stupid :)

Log in to reply