Describe the bug
- When the Albert window spawns, it appears at a fixed position with dimensions
W × H.
- As the user types and results populate the list, the window grows in height, but instead of expanding downward, the window re-centers itself around its previous center point, causing the input bar to visually jump upward with each new result.
Expected behavior
The window's search bar should remain fixed at its spawn position. As results populate, the window grows downward only. The input bar stays visually stable (it does not move).
Actual behavior
Each time results are added and updateGeometry() triggers a resize, Qt re-centers the window around its old center, causing the entire window (including the input bar) to shift upward. The input bar position is not stable.
Root cause
I belive the problem is in resizinglist.cpp.
When ResizingList::onUpdateSelectionAndSize() calls updateGeometry(), which propagates a new sizeHint() up to the top-level window. Qt's default behavior when resizing a top-level window is to keep the center point fixed, which produces the observed shifting.
The fix would be to snapshot window()->pos() before calling updateGeometry() and restore it immediately after, so the top-left corner is always anchored.
Something like:
void ResizingList::onUpdateSelectionAndSize()
{
if (current_row_count_ < maxItems_)
{
QWidget *topLevel = window();
QPoint anchor = (topLevel && topLevel != this) ? topLevel->pos() : QPoint{};
updateGeometry();
if (topLevel && topLevel != this)
topLevel->move(anchor);
}
current_row_count_ = model()->rowCount();
if (!currentIndex().isValid())
setCurrentIndex(model()->index(0, 0));
}
Environment
- OS: Linux
- Albert Version: albert 34.0.10
- Plugin:
widgetsboxmodel (latest main)
Describe the bug
W × H.Expected behavior
The window's search bar should remain fixed at its spawn position. As results populate, the window grows downward only. The input bar stays visually stable (it does not move).
Actual behavior
Each time results are added and
updateGeometry()triggers a resize, Qt re-centers the window around its old center, causing the entire window (including the input bar) to shift upward. The input bar position is not stable.Root cause
I belive the problem is in
resizinglist.cpp.When
ResizingList::onUpdateSelectionAndSize()callsupdateGeometry(), which propagates a newsizeHint()up to the top-level window. Qt's default behavior when resizing a top-level window is to keep the center point fixed, which produces the observed shifting.The fix would be to snapshot
window()->pos()before callingupdateGeometry()and restore it immediately after, so the top-left corner is always anchored.Something like:
Environment
widgetsboxmodel(latestmain)