fix: no need to disconnect signal

Signal will auto disconnect on item destruction
This commit is contained in:
2 * r + 2 * t 2026-04-09 23:29:12 +10:00
parent cc54d9bc5b
commit e6c1248bef
2 changed files with 1 additions and 5 deletions

View file

@ -674,8 +674,7 @@ LazyListView::DelegateEntry LazyListView::createDelegate(int modelIndex) {
// Watch attached properties if the delegate uses them // Watch attached properties if the delegate uses them
auto* attached = qobject_cast<LazyListViewAttached*>(qmlAttachedPropertiesObject<LazyListView>(entry.item, false)); auto* attached = qobject_cast<LazyListViewAttached*>(qmlAttachedPropertiesObject<LazyListView>(entry.item, false));
if (attached) { if (attached) {
entry.attachedConnection = connect(attached, &LazyListViewAttached::preferredHeightChanged, this, onHeightChanged);
connect(attached, &LazyListViewAttached::preferredHeightChanged, this, onHeightChanged);
connect(attached, &LazyListViewAttached::visibleHeightChanged, this, [this] { connect(attached, &LazyListViewAttached::visibleHeightChanged, this, [this] {
polish(); polish();
}); });
@ -685,8 +684,6 @@ LazyListView::DelegateEntry LazyListView::createDelegate(int modelIndex) {
} }
void LazyListView::destroyDelegate(DelegateEntry& entry) { void LazyListView::destroyDelegate(DelegateEntry& entry) {
if (entry.attachedConnection)
disconnect(entry.attachedConnection);
if (entry.item) { if (entry.item) {
entry.item->setParentItem(nullptr); entry.item->setParentItem(nullptr);
entry.item->setVisible(false); entry.item->setVisible(false);

View file

@ -164,7 +164,6 @@ private:
int modelIndex = -1; int modelIndex = -1;
QQuickItem* item = nullptr; QQuickItem* item = nullptr;
bool pendingRemoval = false; bool pendingRemoval = false;
QMetaObject::Connection attachedConnection;
}; };
// Layout // Layout