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

TextArea text selection style error

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • P1: Critical
    • None
    • 6.7.2
    • window 11
    • Windows

    Description

      When using TextArea, I insert QTextFrame and a piece of text through C++ code. When I use Qt 6.7.2, selecting text in one QTextFrame causes the text style in other QTextFrames to exhibit strange issues. This problem does not occur in Qt 6.6 and Qt 6.5.

       

      // code placeholder
      
      for (int i = 0; i < 100; i++) {
          QTextFrameFormat contentTextFrameFormat;
          contentTextFrameFormat.setPadding(9);
          contentTextFrameFormat.setLeftMargin(9);
          contentTextFrameFormat.setRightMargin(9);
          contentTextFrameFormat.setBackground(QColor(201, 231, 255));
          auto contentTextFrame = rootFrame->lastCursorPosition().insertFrame(contentTextFrameFormat);    QTextCharFormat contentTextCharFormat;
          auto font = defaultFont;
          font.setPointSize(10);
          contentTextCharFormat.setFont(font);
          contentTextFrame->lastCursorPosition().insertText("sample text", contentTextCharFormat);
      } 

       

       

       

      ===normal text style===

       

      === error text style ===

      Attachments

        1. image-2024-06-24-10-31-19-901.png
          50 kB
          宇机 卢
        2. image-2024-06-24-10-32-05-042.png
          50 kB
          宇机 卢
        3. image-2024-06-24-10-32-15-265.png
          48 kB
          宇机 卢
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            luyuji 宇机 卢
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes