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

QML Text doesn't reset lineCount when text is empty

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.14.1
    • Fix Version/s: None
    • Labels:
      None
    • Platform/s:
      Linux/X11

      Description

      When QML Text 'text' property is reset to empty, lineCount remains same as was for prior text:

      import QtQuick 2.12
      import QtQuick.Window 2.12
      
      Window {
          visible: true
          width: 640
          height: 480
          Text {
              id: test
              width: parent.width
              text: "qqqqqqqqqq qqqqqqqqqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqq"
              wrapMode: Text.WordWrap
              onLineCountChanged: {
                  console.log("test: " + test.lineCount)
              }
          }
          Timer {
              interval: 5000
              running: true
              onTriggered: {
                  test.text = ""
                  console.log("test: " + test.lineCount)
              }
          }
      }
      
      

      Expected output:

      test: 2

      test: 1

       

      Actual output

      test: 2

      test: 2

        Attachments

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

          Activity

            People

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            semlanik Alexey Edelev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes