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

onImplicitWidthChanged signals behaviour changes with print statements.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • None
    • 5.0.1
    • None
    • Linux

    Description

      main.qml
      import QtQuick 1.1
      
      Rectangle {
          id:root
          width: 360; height: 360
      
          Label{
              id:label
              x:100; y:100
              width: 100
              text: qsTr("Hello World")
              font.pixelSize: 30
          }
      
          MouseArea {
              anchors.fill: parent
              onPressed: label.width = label.width +2
          }
      }
      
      label.qml
      import QtQuick 1.1
      
      Text {
          id: labelTxt
          verticalAlignment: Text.AlignVCenter; horizontalAlignment: Text.AlignHCenter
      
          onImplicitWidthChanged: {
              console.log("onImplicitWidthChanged");   -- ---- Line 1
              console.log("onImplicitWidthChanged:" + implicitWidth); ----Line 2
          }
      
          onWidthChanged: {
              console.log("onWidthChanged" + implicitWidth)
          }
      }
      

      If Line 2 is commented, onImplicitWidthChanged is called on every mouse click, but if un-commented there is no signal to onImplicitWidthChanged and it doesnt print line 1 & 2.

      Attachments

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

        Activity

          People

            martinj Martin Jones
            tapadar Indrajit Tapadar (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes