Important: Please read the Qt Code of Conduct -

Widget Painting Problem in QT 4.8.X

  • Hello All. I have a strange painting problem in QT 4.8.X and am wondering if someone has seen this before. In my app, I have a QMainWindow. (Please see attached screen cap for reference). As a child of this main window, I have a blue menu bar that hold some buttons. Also as a child of the main window, I have a "drawer" (this is the gray thing over the blue bar) that, among other things, displays the current date and time. The drawer is placed over the top of the menu bar and brought to the foreground using ::raise().

    The problem I have is, on some Win7x64 systems, the date/time display on the drawer will not paint. I have placed debug output in the ::paintEvent() function of the drawer, and the ::paintEvent() function is getting called correctly. It is that, for whatever reason, the actual newly painted control contents are never making it out to the screen. The widget contents will get painted once, and then be locked forevermore with the first date/time. As I said, on some systems it works OK, on some systems the widget will not paint correctly. Strange, right?

    Any thoughts?
    ! Pic)!

  • Lifetime Qt Champion


    Maybe a silly question but: Are you calling update regularly so that a repaint is triggered ?

  • Yes, I am most surely calling ::update() regularly. I put debug statements in the ::paintEvent() function where I paint the text onto the drawer (using QPainter and its ::drawText() function). Thus, I know for a fact the ::paintEvent() code is being called and executed. I even dumped out the date/time QString I supposedly painted and it is changing like it should.

    For some reason the results of the paint are not getting out to the screen.

  • Lifetime Qt Champion


    Could you share a minimal implementation example ?

Log in to reply