Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[Solved] PaintEvent being displayed underneath a text label



  • When my UI Designer form is instantiated, in the constructor, I start a 1-second timer and connect its timeout signal with the form's update slot. Then, whenever the timer goes off, the paintEvent function of my form is called. In this function, I translate my brush to the proper area on the form, draw a dial and then rotate it depending on the current second count (it basically acts like a second hand on a watch). So far, everything functions fine. I see the dial going around and around on the form.

    What I want to do now is add a picture of a clock to my form. I create a text label and define its pixmap property to the name of a PNG file. It's placed on the form such that the dial I draw in the paintEvent function should show up in the clock face of the picture. When I run the application, I see the picture of the clock, but my dial isn't there (I would assume it's underneath the text label picture). How do I get it to show up on top of the text label picture?


Log in to reply