Verified Commit 6e597f16 authored by Fushan Wen's avatar Fushan Wen 💬
Browse files

Drop hack after porting back to lastSpacer

The hack depends on the panel's width, but after adding back lastSpacer,
the condition is false and hence the new panel applet order is reverted
again.

This reverts a little more code introduced in panel refactoring to fix
the bug.
parent f2ecf174
Pipeline #185463 passed with stage
in 6 minutes and 45 seconds
......@@ -102,7 +102,11 @@ function indexAtCoordinates(x, y) {
} else {
x = layout.width / 2;
}
var child = undefined;
/*
* When adding a new panel, childAt will return lastSpacer, and that's where
* `index` property works.
*/
var child = layout.childAt(x, y);
while (!child) {
if (root.isHorizontal) {
// Only yields incorrect results for widgets smaller than the
......@@ -112,17 +116,7 @@ function indexAtCoordinates(x, y) {
y -= layout.columnSpacing
}
if (x < 0 || y < 0) {
if (layout.width === 0) {
/*
* childAt won't find any applet when adding a new preset panel
* because all applets don't have a valid width during initialization.
*/
return appletsModel.count;
} else {
// BUG 453998: After initialization, all applets have valid widths, so
// we need to avoid placing the leftmost/topmost applet at the end
return 0;
}
return 0;
}
child = layout.childAt(x, y);
}
......
......@@ -344,6 +344,13 @@ function checkLastSpacer() {
visible: !root.hasSpacer
Layout.fillWidth: true
Layout.fillHeight: true
/**
* This index will be used when adding a new panel.
*
* @see LayoutManager.indexAtCoordinates
*/
readonly property alias index: appletsModel.count
}
// END BUG 454095
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment