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

QML Native ScrollBar: Unable to assign [undefined] to int

    XMLWordPrintable

Details

    • Windows

    Description

      Working from QDS, there is a qml file in HelperWidgets named VerticallScrollBar.qml. It extends the QtQuickControls / Native ScrollBar.

      I get the following error on application output when I hover in the app over the scroll bar: 

      qrc:/qt-project.org/imports/QtQuick/Controls/Windows/ScrollBar.qml:69:49: Unable to assign [undefined] to int
      

      which appears to refer to the following line inside quickcontrols2/windows/ScrollBar.qml:

      visible: contentItem instanceof NativeStyle.StyleItem
      Behavior on opacity { NumberAnimation { duration: contentItem.transitionDuration } }     // <---------- this line
      

      The contentItem doesn't have the "transitionDuration" property, and that is because the contentItem is a Rectangle, rather than a NativeStyle.StyleItem. And that's because VerticalScrollBar.qml above  has the contentItem redefined like this:

      contentItem: Rectangle {
          implicitWidth: StudioTheme.Values.scrollBarThickness
          color: StudioTheme.Values.themeScrollBarHandle
      }
      

      This is something that the Qt Quick ScrollBar should have supported (given the  "contentItem instanceof NativeStyle.StyleItem" above), but somehow it seems that this animation is being called, and this NativeStyle.ScrollBar object ends up being visible, although the contentItem is redefined as a Rectangle.

       

      Example project attached.

      When hovering scrollbar with mouse, you get output
      "qrc:/qt-project.org/imports/QtQuick/Controls/Windows/ScrollBar.qml:69:49: Unable to assign [undefined] to int"

      Attachments

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            saghinet Samuel Ghinet
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: