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

QML Text doesn't reset lineCount when text is empty

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.14.1
    • None
    • 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

            shin1_okada Shinichi Okada
            semlanik Alexey Edelev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes