StackView inside a Flickable causes Flickable to stop working



  • My end goal is to replicate the android toolbar function. When the user scrolls down the page it will hide the header first then continue scrolling into the page. When the user scrolls up it will show the header first then continue scrolling to the top of the page. This functionality is already built into ListView as headerPosition.PullBackHeader but I cannot use this because the ApplicationWindow header needs to be hidden not ListView header.

    Now, my current implementation is enable scrolling of any objects pushed into the stackview if they have a height that goes outside applicationwindow. However, flickable scrolling is not working and I am not sure why

    import QtQuick 2.9
    import QtQuick.Controls 2.2
    
    ApplicationWindow {
    visible: true
    Flickable {
    	id:child
    	anchors.fill: parent
    	contentWidth: parent.width
    
    	StackView {
    		id:stack
    		anchors.fill: parent
    		Component.onCompleted: {
    			console.log("s",width, height);
    			stack.push(stuff);
    		}
    
    		onCurrentItemChanged: {
    			child.contentHeight = currentItem.height;
    		}
    	}
    }
    
    Component {
    	id:stuff
    	Rectangle {
    		id:what
    		width: 600
    		height: 1000
    		gradient: Gradient {
    			GradientStop { position: 0.0; color: "lightsteelblue" }
    			GradientStop { position: 1.0; color: "blue" }
    		}
    	}
    }
    }

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.