@@ -330,8 +330,8 @@ PlasmoidItem {
330
330
id: effectRect
331
331
property bool luisbocanegraPanelColorizerEffectManaged: true
332
332
property QtObject target
333
- height: target .height
334
- width: target .width
333
+ height: target? .height ?? 0
334
+ width: target? .width ?? 0
335
335
anchors .centerIn : parent
336
336
source: target
337
337
colorization: 1
@@ -356,7 +356,8 @@ PlasmoidItem {
356
356
property bool isTrayArrow: itemType === Enums .ItemType .TrayArrow
357
357
property bool inTray: isTray || isTrayArrow
358
358
property bool luisbocanegraPanelColorizerBgManaged: true
359
- property var widgetProperties: isTrayArrow ? { " id" : - 1 , " name" : " org.kde.plasma.systemtray.expand" } :
359
+ property var widgetProperties: isTrayArrow ?
360
+ { " id" : - 1 , " name" : " org.kde.plasma.systemtray.expand" } :
360
361
Utils .getWidgetNameAndId (target)
361
362
property string widgetName: widgetProperties .name
362
363
property int widgetId: widgetProperties .id
@@ -524,17 +525,17 @@ PlasmoidItem {
524
525
}
525
526
}
526
527
527
- property int targetChildren: target .children .length
528
+ property int targetChildren: target? .children .length ?? 0
528
529
onTargetChildrenChanged: {
529
530
// console.error("CHILDREN CHANGED", targetChildren, target)
530
531
recolorTimer .restart ()
531
532
}
532
- property int targetVisibleChildren: target .visibleChildren .length
533
+ property int targetVisibleChildren: target? .visibleChildren .length ?? 0
533
534
onTargetVisibleChildrenChanged: {
534
535
// console.error("CHILDREN CHANGED", targetVisibleChildren, target)
535
536
recolorTimer .restart ()
536
537
}
537
- property int targetCount: target .count || 0
538
+ property int targetCount: target? .count ?? 0
538
539
onTargetCountChanged: {
539
540
// console.error("COUNT CHANGED", targetCount, target)
540
541
recolorTimer .restart ()
@@ -584,8 +585,8 @@ PlasmoidItem {
584
585
recolorTimer .start ()
585
586
}
586
587
587
- height: isTray ? target .height : parent .height
588
- width: isTray ? target .width : parent .width
588
+ height: isTray ? ( target? .height ?? 0 ) : parent .height
589
+ width: isTray ? ( target? .width ?? 0 ) : parent .width
589
590
Behavior on height {
590
591
enabled: animatePropertyChanges
591
592
NumberAnimation {
@@ -654,15 +655,15 @@ PlasmoidItem {
654
655
Binding {
655
656
target: rect
656
657
property: " width"
657
- value: parent .width + horizontalWidth
658
+ value: ( parent? .width ?? 0 ) + horizontalWidth
658
659
when: isWidget
659
660
delayed: true
660
661
}
661
662
662
663
Binding {
663
664
target: rect
664
665
property: " height"
665
- value: parent .height + verticalWidth
666
+ value: ( parent? .height ?? 0 ) + verticalWidth
666
667
when: isWidget && ! horizontal
667
668
delayed: true
668
669
}
@@ -1009,7 +1010,7 @@ PlasmoidItem {
1009
1010
color: {
1010
1011
return getColor (shadowColorCfg, targetIndex, rect .color , itemType, dropShadow)
1011
1012
}
1012
- source: target .applet
1013
+ source: target? .applet ?? null
1013
1014
visible: fgShadowEnabled
1014
1015
Behavior on color {
1015
1016
enabled: animatePropertyChanges
@@ -1448,8 +1449,20 @@ PlasmoidItem {
1448
1449
}
1449
1450
1450
1451
onPanelLayoutCountChanged: {
1451
- if (panelLayoutCount === 0 ) return
1452
1452
console .log (" onPanelLayoutCountChanged" )
1453
+ initAll ()
1454
+ // re-apply customizations after the widget stops being dagged around
1455
+ for (var i = 0 ; i < panelLayout .children .length ; i++ ) {
1456
+ var item = panelLayout .children [i];
1457
+ if (! item || (! item .hasOwnProperty (" draggingChanged" ))) return
1458
+ item .draggingChanged .connect (function () {
1459
+ initAll ()
1460
+ })
1461
+ }
1462
+ }
1463
+
1464
+ function initAll () {
1465
+ if (! panelLayout || panelLayoutCount === 0 ) return
1453
1466
Qt .callLater (function () {
1454
1467
trayInitTimer .restart ()
1455
1468
showWidgets (panelLayout)
@@ -1458,6 +1471,11 @@ PlasmoidItem {
1458
1471
})
1459
1472
}
1460
1473
1474
+ onEditModeChanged: {
1475
+ if (editMode) return
1476
+ initAll ()
1477
+ }
1478
+
1461
1479
onTrayGridViewCountChanged: {
1462
1480
if (trayGridViewCount === 0 ) return
1463
1481
// console.error(trayGridViewCount);
@@ -1632,6 +1650,7 @@ PlasmoidItem {
1632
1650
}
1633
1651
1634
1652
function showWidgets (panelLayout ) {
1653
+ if (! panelLayout) return
1635
1654
console .log (" showWidgets()" )
1636
1655
for (var i in panelLayout .children ) {
1637
1656
const child = panelLayout .children [i];
0 commit comments