Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

flickableItem.atYEnd is false even at the bottom of scroll



  • I have a ListView which is inside a ScrollView and I want to know or listen when the scroll bar is scrolled to the bottom,

       ScrollView {
                            id: moderatorMessagesScrollViewID
    
                            anchors.fill: parent
    
                            function update()
                            {
    							console.debug("<< moderatorMessagesScrollViewID ScrollView::update ", flickableItem.atYEnd);
    	                }
    
                            flickableItem.onAtYBeginningChanged: {
                                update();
                            }
    
                            flickableItem.onAtYEndChanged: {
                                update();
                            }
    
                            flickableItem.onContentYChanged: {
                                update();
                            }
    
                            ListView {
                                id: moderatorMessagesList
                                anchors.leftMargin: 15
                                anchors.rightMargin: 15
                                anchors.bottomMargin: 5
                                layoutDirection: Qt.LeftToRight
                                orientation: ListView.Vertical
                                verticalLayoutDirection: ListView.BottomToTop
                                cacheBuffer: (chatPanel.height <= 0) ? 1000 : (chatPanel.height * 1000)
                                spacing: 0
                                focus: true
    
                                Component.onCompleted: {
                                    updateView();
                                }
    
                                delegate: messageListDelegate
                            }
    
                            style: ScrollViewStyle {
                                incrementControl: Rectangle {
                                    visible: false
                                    implicitWidth: 0
                                    implicitHeight: 0
                                }
                                decrementControl: Rectangle {
                                    visible: false
                                    implicitWidth: 0
                                    implicitHeight: 0
                                }
                                corner: Rectangle {
                                    color: "white"
                                    visible: true
                                    rotation: 180
                                }
                                handle: Rectangle {
                                    implicitWidth: 5 * MyStyle.props.scrollSizeFactor()
                                    implicitHeight: 7 * MyStyle.props.scrollSizeFactor()
                                    color: Qt.rgba(237/255, 237/255, 237/255, 1)
                                    radius: 2
                                    border.width: 1
                                    border.color: "#C3C3C3"
                                }
                                scrollToClickedPosition: true
                                handleOverlap: 1
                                scrollBarBackground: Rectangle {
                                    width: 5 * MyStyle.props.scrollSizeFactor()
                                    height: 10 * MyStyle.props.scrollSizeFactor()
                                    color: MyStyle.props.color("chatChatPanelBackground")
                                }
                                transientScrollBars: false
                            }
                        }
                    }
    

    but my issue here is
    (1) flickableItem.atYEnd is always false
    (2) flickableItem.onAtYEndChanged is not triggered even if I scroll at the bottom
    (3) update() is triggered by onContentYChanged() instead when i try to scroll using scrollbar.

    What is wrong with this and what areas I need to look into?


Log in to reply