Changeset View
Changeset View
Standalone View
Standalone View
src/declarativeimports/plasmaextracomponents/qml/PlasmoidHeading.qml
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | 31 | T.Frame { | |||
---|---|---|---|---|---|
47 | /** | 47 | /** | ||
48 | * location: int | 48 | * location: int | ||
49 | * | 49 | * | ||
50 | * Indicates the position of the heading. The default is PlasmoidHeading.Location.Header. | 50 | * Indicates the position of the heading. The default is PlasmoidHeading.Location.Header. | ||
51 | */ | 51 | */ | ||
52 | property int location: PlasmoidHeading.Location.Header | 52 | property int location: PlasmoidHeading.Location.Header | ||
53 | 53 | | |||
54 | Layout.fillWidth: true | 54 | Layout.fillWidth: true | ||
55 | bottomPadding: location == PlasmoidHeading.Location.Footer ? 0 : headingSvg.margins.top | 55 | bottomPadding: location == PlasmoidHeading.Location.Footer ? 0 : headingSvg.fixedMargins.top | ||
56 | topPadding: location == PlasmoidHeading.Location.Footer ? headingSvg.margins.bottom : 0 | 56 | topPadding: location == PlasmoidHeading.Location.Footer ? headingSvg.fixedMargins.bottom : 0 | ||
57 | 57 | | |||
58 | implicitHeight: contentHeight + topPadding + bottomPadding | 58 | implicitHeight: contentHeight + topPadding + bottomPadding | ||
59 | contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) | 59 | contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) | ||
60 | 60 | | |||
61 | leftInset: -headingSvg.fixedMargins.left | 61 | leftInset: -headingSvg.fixedMargins.left | ||
62 | rightInset: -headingSvg.fixedMargins.right | 62 | rightInset: -headingSvg.fixedMargins.right | ||
63 | topInset: location == PlasmoidHeading.Location.Footer ? 0 : -headingSvg.margins.top | 63 | topInset: location == PlasmoidHeading.Location.Footer ? 0 : -headingSvg.fixedMargins.top | ||
64 | bottomInset: location == PlasmoidHeading.Location.Footer ? -headingSvg.fixedMargins.bottom : 0 | 64 | bottomInset: location == PlasmoidHeading.Location.Footer ? -headingSvg.fixedMargins.bottom : 0 | ||
65 | 65 | | |||
66 | background: PlasmaCore.FrameSvgItem { | 66 | background: PlasmaCore.FrameSvgItem { | ||
67 | id: headingSvg | 67 | id: headingSvg | ||
68 | visible: fromCurrentTheme | 68 | visible: fromCurrentTheme | ||
69 | imagePath: "widgets/plasmoidheading" | 69 | imagePath: "widgets/plasmoidheading" | ||
70 | prefix: location == PlasmoidHeading.Location.Header? 'header' : 'footer' | 70 | prefix: location == PlasmoidHeading.Location.Header? 'header' : 'footer' | ||
71 | enabledBorders: { | ||||
72 | var borders = 0 | ||||
broulik: Use `[]` instead of `new Array()` | |||||
73 | borders |= PlasmaCore.FrameSvg.LeftBorder | ||||
broulik: How is operator `|=` supposed to work with an `Array`?! | |||||
74 | borders |= PlasmaCore.FrameSvg.RightBorder | ||||
75 | if (plasmoid.location !== PlasmaCore.Types.TopEdge || location != PlasmoidHeading.Location.Header) { | ||||
broulik: Where is `plasmoid` defined? | |||||
It's not necessary to define it, when you use this in a plasmoid it takes it from the context niccolove: It's not necessary to define it, when you use this in a plasmoid it takes it from the context | |||||
76 | borders |= PlasmaCore.FrameSvg.TopBorder | ||||
77 | } | ||||
78 | if (plasmoid.location !== PlasmaCore.Types.BottomEdge || location != PlasmoidHeading.Location.Footer) { | ||||
79 | borders |= PlasmaCore.FrameSvg.BottomBorder | ||||
80 | } | ||||
81 | return borders | ||||
82 | } | ||||
71 | } | 83 | } | ||
72 | } | 84 | } |
Use [] instead of new Array()