From 51d21f68efc4a89c663e94fc116cd2107075dfab Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Wed, 22 Feb 2023 12:13:09 +0100 Subject: [PATCH] Bugfixes --- EditableListView.qml | 39 +++++++++++++++++++++++++++++++++++++-- devicesmodel.cpp | 5 ++--- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/EditableListView.qml b/EditableListView.qml index 35ffe37..3e9e01d 100644 --- a/EditableListView.qml +++ b/EditableListView.qml @@ -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 } } diff --git a/devicesmodel.cpp b/devicesmodel.cpp index f617216..bbbc895 100644 --- a/devicesmodel.cpp +++ b/devicesmodel.cpp @@ -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(count, sliderStates.size() - row + count); @@ -422,8 +422,7 @@ bool DevicesModel::removeRows(int row, int count, const QModelIndex &parent) for (auto ®isterGroup : 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(count, sliderStates.size() - row + count);