I'm trying to display an ActivityIndicator
while my list data is loading. Here's my Page QML:
Page {
signal articleClicked(variant article)
id: root
titleBar: TitleBar {
title: qsTr("All feeds")
visibility: ChromeVisibility.Visible
} // titleBar
Container {
layout: DockLayout {}
ListView {
dataModel: _feedModel
listItemComponents: [
ListItemComponent {
type: "item"
FeedListComponent {
feed: ListItemData
}
}
]
visible: !_manager.working
onTriggered: {
if (indexPath.length > 1) {
root.articleClicked(dataModel.data(indexPath));
}
}
} // ListView
ActivityIndicator {
verticalAlignment: VerticalAlignment.Fill
horizontalAlignment: HorizontalAlignment.Fill
running: _manager.working
}
} // Root container
} // Page
To display the ActivityIndicator
centered, I'm using a DockLayout
. It's working fine. However, when I switch _manager.working
to false
and display the ListView
, I can't scroll. I guess it's not limited to the screen size, so it thinks that it's not needed to scroll, as all items are visible. But they're not. I tried to add verticalAlignment: VerticalAlignment.Fill
and horizontalAlignment: HorizontalAlignment.Fill
to the ListView
, without any change. Any hint on how can I force the ListView
to fit on screen? Thanks.
The problem isn't that your listview won't scroll, it's that the ActivityIndicator is on top of the listview preventing the touch events from propagating down to the listview beneath it. Try adding
visible: _manager.working
to the ActivityIndicator
Now your touch events will pass through to the listview when the listview is visible.