Unable to assign [undefined] to int during customizing ScrollBar
-
@Kamichanw Which line is 33?
-
@Kamichanw Which line is 33?
-
@Lahearle I've tried to define
width
, but it still didn't work. In fact, even I just set an empty rectangle ascontentItem
of ScrollBar, like this:contentItem: Rectangle {}
The error occurred still occurred when I hovered the
ScrollBar
. -
@LS-KS I cannot understand... The
width
we discussed earlier is the width ofScrollBar
. AndScrollBar
is assigned toScrollBar.vertical
which is a attached property ofScrollView
. It shouldn't be a child item ofScrollView
.What's more, when the
Rectangle
is assigned tocontentItem
, it doesn't have attached property namedLayout
. -
@sierdzio I don't know. As you can see, the error message shows that error occurred in
qrc:/qt-project.org/imports/QtQuick/Controls/Windows/ScrollBar.qml
which is a qt internal file.@Kamichanw said in Unable to assign [undefined] to int during customizing ScrollBar:
@sierdzio I don't know. As you can see, the error message shows that error occurred in
qrc:/qt-project.org/imports/QtQuick/Controls/Windows/ScrollBar.qml
which is a qt internal file.Well, but looking at it will tell you which property assignment has failed. Then you will know which object in your code is
undefined
. -
@LS-KS I cannot understand... The
width
we discussed earlier is the width ofScrollBar
. AndScrollBar
is assigned toScrollBar.vertical
which is a attached property ofScrollView
. It shouldn't be a child item ofScrollView
.What's more, when the
Rectangle
is assigned tocontentItem
, it doesn't have attached property namedLayout
.@Kamichanw
If you cannot track down which item it is in your code, maybe try commenting each one out till you find out? -
@LS-KS I cannot understand... The
width
we discussed earlier is the width ofScrollBar
. AndScrollBar
is assigned toScrollBar.vertical
which is a attached property ofScrollView
. It shouldn't be a child item ofScrollView
.What's more, when the
Rectangle
is assigned tocontentItem
, it doesn't have attached property namedLayout
.@Kamichanw
I never used that ScrollBar Item so I may be wrong.
In general when you place something into a Layout object (like ScrollView) you can't use width and height but must use Layout -properties like preferredWidth etc.
You used width in your calculations. -
@Kamichanw
If you cannot track down which item it is in your code, maybe try commenting each one out till you find out? -
@Kamichanw
I never used that ScrollBar Item so I may be wrong.
In general when you place something into a Layout object (like ScrollView) you can't use width and height but must use Layout -properties like preferredWidth etc.
You used width in your calculations. -
@Kamichanw said in Unable to assign [undefined] to int during customizing ScrollBar:
@sierdzio I don't know. As you can see, the error message shows that error occurred in
qrc:/qt-project.org/imports/QtQuick/Controls/Windows/ScrollBar.qml
which is a qt internal file.Well, but looking at it will tell you which property assignment has failed. Then you will know which object in your code is
undefined
.@sierdzio Yes, I hope to open that file as well, but when I click the hyperlink in QML debugger console, it shows that
I also tried to searchScrollBar.qml
in qt source directory, but there are too many file namedScrollBar.qml
so that I don't know where to start. -
@sierdzio Yes, I hope to open that file as well, but when I click the hyperlink in QML debugger console, it shows that
I also tried to searchScrollBar.qml
in qt source directory, but there are too many file namedScrollBar.qml
so that I don't know where to start.@Kamichanw
Is there a directory something likeQtQuick\Controls\Windows
in the source tree? If so, how manyScrollBar.qml
files are there in that directory? -
Hey guys, I opened
C:\Qt\6.4.2\Src\qtdeclarative\src\quickcontrols2\windows\ScrollBar.qml
. I think it might be the correctScrollBar.qml
. The line 33 usescontentITem.transitionDuration
. But I cannot set in my file directly.NativeStyle.ScrollBar { // Fade a hovered-looking version of the handle // on top of the default handle when hovering it x: contentItem.x y: contentItem.y z: 1 width: contentItem.width height: contentItem.height control: controlRoot subControl: NativeStyle.ScrollBar.Handle overrideState: NativeStyle.StyleItem.AlwaysHovered opacity: controlRoot.hovered || control.pressed ? 1 : 0 visible: contentItem instanceof NativeStyle.StyleItem-- Behavior on opacity { NumberAnimation { duration: contentItem.transitionDuration } } // line 33 }
-
Hey guys, I opened
C:\Qt\6.4.2\Src\qtdeclarative\src\quickcontrols2\windows\ScrollBar.qml
. I think it might be the correctScrollBar.qml
. The line 33 usescontentITem.transitionDuration
. But I cannot set in my file directly.NativeStyle.ScrollBar { // Fade a hovered-looking version of the handle // on top of the default handle when hovering it x: contentItem.x y: contentItem.y z: 1 width: contentItem.width height: contentItem.height control: controlRoot subControl: NativeStyle.ScrollBar.Handle overrideState: NativeStyle.StyleItem.AlwaysHovered opacity: controlRoot.hovered || control.pressed ? 1 : 0 visible: contentItem instanceof NativeStyle.StyleItem-- Behavior on opacity { NumberAnimation { duration: contentItem.transitionDuration } } // line 33 }
@Kamichanw You should not customize native styles.
https://www.youtube.com/watch?v=mImptIBmWW0&t=1179s -
@Kamichanw You should not customize native styles.
https://www.youtube.com/watch?v=mImptIBmWW0&t=1179s