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

QTextEdit does not get drawn correctly after adjusting scrollbar on Mac OS X

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P2: Important
    • Some future release
    • 4.4.0
    • GUI: Painting
    • None
    • macOS

    Description

      On Qt for Mac, If many lines are added quickly using the append slot QTextEdit often misrenders the text after a resizing of the window... it shows multiple instances of the same lines, so that the display looks wrong and is hard to read.

      This can be seen with the following example :

      #include <QtGui>

      //class MyTextEdit : public QPlainTextEdit
      class MyTextEdit : public QTextEdit
      {
      Q_OBJECT

      public:
      MyTextEdit();

      private slots:
      void AddSomeText();
      };

      MyTextEdit :: MyTextEdit()
      {
      setReadOnly(true);
      QTimer::singleShot(200, this, SLOT(AddSomeText()));
      }

      void MyTextEdit :: AddSomeText()
      {
      static int count = 0;
      for (int i=0; i<6; i++)

      { // appendPlainText(QString("This is Plain Text loop %2 with a string containing some text %1").arg(count++).arg(i)); append(QString("This is QTextEdit loop %2 with a string containing some text %1").arg(count++).arg(i)); }

      QScrollBar * sb = verticalScrollBar();
      sb->setValue(sb->maximum());

      QTimer::singleShot(2000, this, SLOT(AddSomeText()));
      }

      int main(int argc, char ** argv)
      {
      QApplication app(argc, argv);

      QWidget w;
      w.setMinimumWidth(640);
      QBoxLayout * vbl = new QBoxLayout(QBoxLayout::TopToBottom, &w);
      vbl->setMargin(5);
      vbl->setSpacing(5);

      MyTextEdit * mpte = new MyTextEdit;
      vbl->addWidget(mpte);

      w.show();

      return app.exec();
      }
      #include "main.moc"

      Attachments

        Issue Links

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

          Activity

            People

              sletta Gunnar Sletta
              dettman Dean Dettman (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes