This commit is contained in:
2023-02-22 12:13:09 +01:00
parent 27ea0fd98c
commit 51d21f68ef
2 changed files with 39 additions and 5 deletions

View File

@ -45,10 +45,46 @@ ColumnLayout {
Layout.fillHeight: true
clip: true
highlightRangeMode: ListView.StrictlyEnforceRange
focus: true
// highlightRangeMode: ListView.ApplyRange
onCountChanged: if (count === 0 && currentIndex >= 0) currentIndex = -1
// displaced: Transition {
// NumberAnimation { properties: "x,y"; duration: 1000 }
// }
addDisplaced: Transition {
NumberAnimation { properties: "x,y"; duration: 1000 }
}
add: Transition {
ParallelAnimation {
NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 1000 }
NumberAnimation { properties: "x"; from: 100; duration: 1000 }
}
}
move: Transition {
NumberAnimation { properties: "x,y"; duration: 1000 }
}
moveDisplaced: Transition {
NumberAnimation { properties: "x,y"; duration: 1000 }
}
// populate: Transition {
// NumberAnimation { properties: "x,y"; duration: 100 }
// }
remove: Transition {
ParallelAnimation {
NumberAnimation { property: "opacity"; to: 0; duration: 1000 }
NumberAnimation { properties: "x"; to: 100; duration: 1000 }
}
}
removeDisplaced: Transition {
NumberAnimation { properties: "x,y"; duration: 1000 }
}
delegate: Item {
property variant myData: model
readonly property bool isCurrentItem: ListView.isCurrentItem
@ -77,6 +113,5 @@ ColumnLayout {
visible: index !== (listView.count - 1)
}
}
focus: true
}
}

View File

@ -412,7 +412,7 @@ bool DevicesModel::removeRows(int row, int count, const QModelIndex &parent)
devices.erase(begin, end);
}
if (sliders_state_t &sliderStates = m_controller->sliderStates(); sliderStates.size() >= row)
if (sliders_state_t &sliderStates = m_controller->sliderStates(); sliderStates.size() > row)
{
auto begin = std::begin(sliderStates) + row;
auto end = begin + std::min<size_t>(count, sliderStates.size() - row + count);
@ -422,8 +422,7 @@ bool DevicesModel::removeRows(int row, int count, const QModelIndex &parent)
for (auto &registerGroup : m_controller->lightProject().registerGroups)
{
auto &sliderStates = registerGroup.sliders;
if (sliderStates.size() >= row)
if (auto &sliderStates = registerGroup.sliders; sliderStates.size() > row)
{
auto begin = std::begin(sliderStates) + row;
auto end = begin + std::min<size_t>(count, sliderStates.size() - row + count);