[Solved] ListView problem: Rows look weird when flicked
-
I have modified the "AbstractItemModel":http://doc.qt.nokia.com/qt5/declarative-modelviews-abstractitemmodel.html example a bit.
I wanted to add a header row which is "fixed".
Therefore I've created a "Header" item like this:
Header.qml
@
Item
{
height: row.height
width: 400
Rectangle
{
width: 400
height: row.height
color: "green"
}Row { id: row Text { text: "col1"; font.pixelSize: 20; width: 100} Text { text: "col2"; font.pixelSize: 20; width: 100 } Text { text: "col3"; font.pixelSize: 20; width: 100 } Text { text: "col4"; font.pixelSize: 20; width: 100 } } }
@
I have modified the main.qml so that it also shows the header:
@Rectangle
{
width: 400;
height: 300Header { id: header} ListView { width: 400; height: 250 anchors.topMargin: 50 anchors.fill: parent model: myModel delegate: PointItem {} boundsBehavior: Flickable.StopAtBounds snapMode: ListView.NoSnap }
}
@When starting the application, everything looks fine:
!http://dl.dropbox.com/u/2346027/ModelAppStartup.PNG(Model App Startup)!When I move the columns, it starts looking weird, the header is covered by the first row:
!http://dl.dropbox.com/u/2346027/ModelAppMoving1.PNG(Model App Moving 1)!!http://dl.dropbox.com/u/2346027/ModelAppMoving2.PNG(Model App Moving 2)!
When I increase the size of the application window, I can see that the first item is still visible:
!http://dl.dropbox.com/u/2346027/ModelAppBig.PNG(Model App Big)!When I continue moving the columns it seems to work fine again.
But another problem is, that it snaps to the first row, even though I have set the property snapMode to ListView.NoSnap. Does this only affect the last row?
The first row is moved to the header (even though the topMargin is 50 pixels):
!http://dl.dropbox.com/u/2346027/ModelAppMoving3.PNG(Model App Moving 3)!
And then it gets removed:
!http://dl.dropbox.com/u/2346027/ModelAppMoving4.PNG(Model App Moving 4)!Does anybody know what I'm doing wrong? Or is there a problem in the ListView?
Thank you!