feat(Storybook): Utility proxy model for limiting model's count

It's convenient for testing some corner cases (especially when
used with Slider)  when e.g. model is empty or has only one item.
This commit is contained in:
Michał Cieślak 2023-07-20 12:18:29 +02:00 committed by Michał
parent a6815a7ad2
commit 453d75b304
2 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,12 @@
import SortFilterProxyModel 0.2
SortFilterProxyModel {
id: root
property int limit
filters: IndexFilter {
maximumIndex: Math.max(root.limit - 1, 0)
minimumIndex: root.limit === 0 ? 1 : 0
}
}

View File

@ -15,6 +15,7 @@ InspectionItem 1.0 InspectionItem.qml
InspectionItemsList 1.0 InspectionItemsList.qml
InspectionPanel 1.0 InspectionPanel.qml
InspectionWindow 1.0 InspectionWindow.qml
LimitProxyModel 1.0 LimitProxyModel.qml
Logs 1.0 Logs.qml
LogsAndControlsPanel 1.0 LogsAndControlsPanel.qml
LogsView 1.0 LogsView.qml