Nominate our 2022 Qt Champions!

[Solved]How to change the painting order of widgets?

  • Hi,

    I have a question regarding painting / updating widgets. I have two simple widgets in rectangle shape: rectangle-red and rectangle-yellow. Both are filled with solid color. These two widgets have an overlap area. Some times I want to show the red color (from rectangle-red) on top, and some times I want to show the yellow color on top. I think the widget that painted late will cover the one painted earlier. So I tried to change the update order of the widgets with the "update()". It does not work. Could any one tell me how to solve my problem? Thanks.

  • see QWidget::raise/lower/stackUnder()

  • thanks, tested and worked fine.

Log in to reply