Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions panels/notification/bubble/bubblemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,8 @@ BubbleItem *BubbleModel::replaceBubble(BubbleItem *bubble)
const auto replaceIndex = replaceBubbleIndex(bubble);
const auto oldBubble = m_bubbles[replaceIndex];

// Use remove + insert instead of dataChanged to force the view
// to recreate the delegate, so ListView recalculates its height.
beginRemoveRows(QModelIndex(), replaceIndex, replaceIndex);
m_bubbles.removeAt(replaceIndex);
endRemoveRows();

beginInsertRows(QModelIndex(), replaceIndex, replaceIndex);
m_bubbles.insert(replaceIndex, bubble);
endInsertRows();
m_bubbles.replace(replaceIndex, bubble);
Q_EMIT dataChanged(index(replaceIndex), index(replaceIndex));

return oldBubble;
}
Expand Down
19 changes: 19 additions & 0 deletions panels/notification/bubble/package/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ Window {
bottomMargin: 10
}

// itemGeometryChanged() normally triggers forceLayoutPolish() to
// re-layout with updated height, but it exits early when a transition
// (add/remove/displaced) is running for the first visible item.
// Toggle displayMarginBeginning to force forceLayoutPolish() directly,
// bypassing the transition check.
function requestLayoutFix() {
var m = displayMarginBeginning
displayMarginBeginning = m + 1
displayMarginBeginning = m
}

function updateInputRegion() {
root.DLayerShellWindow.setInputRegionRect(
Math.ceil(bubbleView.x),
Expand Down Expand Up @@ -171,6 +182,14 @@ Window {

delegate: BubbleDelegate {
maxCount: model.bubbleCount

onHeightChanged: {
if (index < 0) {
return
}

bubbleView.requestLayoutFix()
}
}
}
}
Loading