Nominate our 2022 Qt Champions!

[SOLVED] onWidthChanged triggered few times

  • Hi,

    I have a GridLayout and the onWidthChanged of the children triggered few times. Is there a way to determine if the trigger is the last call or if the layout is final?

    I encountered this issue when changing orientation from Landscape to portrait.

    Please advise. Thanks.

  • Lifetime Qt Champion


    Why do you need that information for ?

  • @SGaist because inside the children of the GridLayout is a one line text that needs to be scrolled if its width is greater than its container width. I set a function to check its width however it will only be called on the first trigger of onWidthChanged, by then the width isn't final or fully laid out yet. Any advise on this one? Thanks

    Please consider this thread solved. I managed to resolved the issue by creating an Item holder of the text and call the function to check the width on the holder's onwidthchanged signal.

  • Lifetime Qt Champion

    Good !

    Since you have it working now, please mark the thread as solved using the "Topic Tool" button so that other forum users may know a solution has been found :)

Log in to reply