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

QSyntaxHighlighter and QTextDocument, re-highlights whole document on first change.

    XMLWordPrintable

Details

    Description

      Using the syntax highlighter example, modified like below.

      The will cause the whole document to be re-highlighted the moment the text is edited (input the first character).

      This only occur the first time after the file is loaded, pressing more characters is not
      causing the file to be re-highlighted.

      Change the following class in the example to reproduce:

      void MainWindow::setupEditor()
      {
      QFont font;
      font.setFamily("Courier");
      font.setFixedPitch(true);
      font.setPointSize(10);

      editor = new QTextEdit;
      editor->setFont(font);

      QFile file("mainwindow.h");
      if (file.open(QFile::ReadOnly | QFile::Text))

      { QTextDocument *tDoc = new QTextDocument(file.readAll()); highlighter = new Highlighter(tDoc); editor->setDocument(tDoc); }

      }

      Attachments

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

        Activity

          People

            sletta Gunnar Sletta
            xcm Martin Petersson (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