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

style animated scroll bars might freeze(stop animating) if we do a heavy paint event

    XMLWordPrintable

Details

    • All
    • 04fed9f77e3288f69fe89bcb8a3f1cdbe02ce219 (qt/qtbase/dev) 01474c31ba2a3ca225cbc2440bd0ee28458b2a26 (qt/qtbase/6.0) b048faf869f16891034062d2b047c9c6c12e6b3e (qt/qtbase/5.15)

    Description

      #include <QtWidgets>
      #include <QScrollBar>
      
      class TextBrowser : public QTextBrowser
      {
      public:
          TextBrowser(QWidget *parent = 0) : QTextBrowser(parent)
          {
              for (int i = 0; i < 100; ++i)
                  append(QString(100, 'a'));
              findChild<QScrollBar *>()->installEventFilter(this);
          }
      
          bool eventFilter(QObject *obj, QEvent *event) override
          {
              if (qobject_cast<QScrollBar *>(obj) && event->type() == QEvent::Paint) {
                  QThread::currentThread()->msleep(1000);
              }
              return false;
          }
      };
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          TextBrowser tb;
          tb.show();
          return a.exec();
      }
      

      Run this demo, and drag the scrollbar, you will find that the slider of scrollbar freezing during animation.

      Attachments

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

        Activity

          People

            vhilshei Volker Hilsheimer
            wang_chuan wang chuan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes