Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-38286

QAbstractScrollArea derived class won't fire paintEvent on update(), repaint(), etc.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.2.0
    • GUI: Painting
    • None

    Description

      QAbstractScrollArea derived class, QTableWidget for example, won't fire paintEvent when update() is called, (repaint, updateGeometry, etc - won't work too).

      I.e.:
      QTableWidget* w = new ...;
      ...
      w->update();

      won't work.

      Workaround:
      if(auto a = dynamic_cast<QAbstractScrollArea*>(w))
      a->viewport()->update();
      else
      w->update();

      The attached file contains app reproducing this problem.
      How to use this app:
      Click ‘check_paint_cnt’ – status bar shows “paint_cnt = 1” (so paintEvent is called once)
      Click ‘call_update’
      Click ‘check_paint_cnt’ again – status bar shows “paint_cnt = 1”, but should be 2…
      Resizing the main window do increases paint_cnt.

      Detailed discussion is here: http://qt-project.org/forums/viewthread/41319/#171389
      and here
      http://stackoverflow.com/questions/22996185/qt-5-2-calling-qtablewidgetupdate-does-not-result-in-qtablewidgetpaintevent

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            yuyaryshev Yuri Yaryshev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes