Skip to content

Commit 3ca6521

Browse files
committed
#46: do not set preferredWidth without fillWidth
1 parent 74af47b commit 3ca6521

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

package/contents/ui/main.qml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -401,23 +401,24 @@ PlasmoidItem {
401401
target: root
402402

403403
function onWidgetElementsLayoutUpdated() {
404-
widgetRow.updatePreferredWidth();
404+
var preferredWidth = plasmoid.configuration.widgetFillWidth ? widgetRow.calculatePreferredWidth() : -1;
405+
widgetRow.Layout.preferredWidth = preferredWidth;
405406
}
406407
}
407408

408-
function updatePreferredWidth() {
409+
function calculatePreferredWidth() {
409410
var repeater = widgetElementsRepeater.visible ? widgetElementsRepeater : widgetElementsMaximizedRepeater;
410411
var preferredWidth = (repeater.count - 1) * widgetRow.spacing;
411412
for (var i = 0; i < repeater.count; i++) {
412413
var item = repeater.itemAt(i);
413414
preferredWidth += Utils.calculateItemPreferredWidth(item);
414415
}
415416
if (preferredWidth < widgetRow.Layout.minimumWidth) {
416-
widgetRow.Layout.preferredWidth = widgetRow.Layout.minimumWidth;
417+
return widgetRow.Layout.minimumWidth;
417418
} else if (preferredWidth > widgetRow.Layout.maximumWidth) {
418-
widgetRow.Layout.preferredWidth = widgetRow.Layout.maximumWidth;
419+
return widgetRow.Layout.maximumWidth;
419420
} else {
420-
widgetRow.Layout.preferredWidth = preferredWidth;
421+
return preferredWidth;
421422
}
422423
}
423424
}

package/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"Id": "com.github.antroids.application-title-bar",
1313
"Name": "Application Title Bar",
1414
"License": "GPL-3.0+",
15-
"Version": "0.6.9",
15+
"Version": "0.7.0",
1616
"Website": "https://github.com/antroids/application-title-bar",
1717
"FormFactors": [
1818
"desktop"

0 commit comments

Comments
 (0)