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

Button.qml read 'width' from 'button.__panel' which can be null

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Out of scope
    • Icon: P2: Important P2: Important
    • None
    • 5.7.0
    • Quick: Controls 1
    • None
    • Linux, KDE 5, Qt 5.7.0

      I am using KDE 5. I can often get tons of this error message from log.

      file:///usr/lib/qt5/qml/QtQuick/Controls/Button.qml:100: TypeError: Cannot read property of null
      file:///usr/lib/qt5/qml/QtQuick/Controls/Button.qml:100: TypeError: Cannot read property of null
      file:///usr/lib/qt5/qml/QtQuick/Controls/Button.qml:100: TypeError: Cannot read property of null
      file:///usr/lib/qt5/qml/QtQuick/Controls/Button.qml:100: TypeError: Cannot read property of null
      

      So I find that line:

      Button.qml:100
          Binding {
              target: menu
              property: "__minimumWidth"
      >      value: button.__panel.width
          }
      

      It seems this line attempted to read width of a null __panel.

      I tried to make it be conditional:

          Binding {
              target: menu
              property: "__minimumWidth"
              value: button.__panel ? button.__panel.width: 0
          }
      

      The 'fix' works perfectly, but I don't know whether it will cause other layout crash or not.

      Why it was null? Was it normal? Or it was caused by wrong implementations?

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

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            lionyang Lion Yang
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes