Content going above of my ListView while scrolling
-
Hello there !
I got some troubles with the display in Qt...
I made a ListView displaying content and after fighting with those delegates/model to understand it, i then realized that the content of my ListView sometimes exceeded above it after scrolling.
Here is my ListView Code :
ListView { id: listViewCardStructure anchors.fill: parent orientation: ListView.Vertical spacing: 20 model: listModel delegate: component Component { id: component Column { Text { text: section font.pixelSize: 13 font.bold: true MouseArea { anchors.fill: parent acceptedButtons: Qt.LeftButton | Qt.RightButton onPressed: { parent.style = Text.Sunken parent.color = "blue" } onReleased: { parent.style = Text.Normal parent.color = "black" } onClicked: { //ListView current index listViewCardStructure.currentIndex = index readWrite2.Sector = listViewCardStructure.currentIndex textAreaReadWrite.text = readWrite2.readChip(); } } } Text { text: block0; font.pixelSize: 13 } Text { text: block1; font.pixelSize: 13 } Text { text: block2; font.pixelSize: 13 } } } }
I searched few solutions on the web and found out the ScrollView QML type. I tried it and put my ListView as the one and only child :
ScrollView { anchors.fill: parent anchors.topMargin: 20 anchors.leftMargin: 5 ListView { id: listViewCardStructure [...] } }
It now has a vertical ScrollBar, which is cool ! But it doesn't solve my problems...
I saw some stuff about flickableItem x and y, viewport, etc... but i can't even use it since they ain't recognized in my .qml
It might be an import problem but i can't find any informations about it... Do you guys have any ideas ?
Here are my imports (MyLib 1.0 being a qmlRegisterType) :
import QtQuick 2.6 import QtQuick.Window 2.2 import QtQuick.Controls 2.2 import QtQuick.Controls.Styles 1.2 import QtQuick.Layouts 1.3 import MyLib 1.0
Thankfull for your help, kisses
-
Found those three properties completely randomly on a completely unrelated topic post...
Dropping them right here, just in case someone needs it :
clip: true boundsBehavior: Flickable.DragAndOvershootBounds snapMode: ListView.SnapToItem
They're doing about everything i need. I think that's a common problem beginners fall into but there is not that much topics about it.