Changeset View
Changeset View
Standalone View
Standalone View
plasmoid/package/contents/ui/PrinterItem.qml
Show All 31 Lines | 29 | Item { | |||
---|---|---|---|---|---|
32 | readonly property bool isPaused: printerState === 5 | 32 | readonly property bool isPaused: printerState === 5 | ||
33 | readonly property bool expanded: ListView.view.currentExpanded == index | 33 | readonly property bool expanded: ListView.view.currentExpanded == index | ||
34 | 34 | | |||
35 | height: container.childrenRect.height + Math.round(units.gridUnit / 2) | 35 | height: container.childrenRect.height + Math.round(units.gridUnit / 2) | ||
36 | width: parent.width - Math.round(units.gridUnit / 2) | 36 | width: parent.width - Math.round(units.gridUnit / 2) | ||
37 | 37 | | |||
38 | MouseArea { | 38 | MouseArea { | ||
39 | id: container | 39 | id: container | ||
40 | anchors { | 40 | anchors.fill: parent | ||
41 | fill: parent | | |||
42 | topMargin: Math.round(units.gridUnit / 2) | | |||
43 | leftMargin: Math.round(units.gridUnit / 2) | | |||
44 | rightMargin: Math.round(units.gridUnit / 2) | | |||
45 | bottomMargin: Math.round(units.gridUnit / 2) | | |||
46 | } | | |||
47 | 41 | | |||
48 | hoverEnabled: true | 42 | hoverEnabled: true | ||
49 | onEntered: { | 43 | onEntered: { | ||
50 | printerItem.ListView.view.currentIndex = index; | 44 | printerItem.ListView.view.currentIndex = index; | ||
51 | 45 | | |||
52 | //this is done to hide the highlight if the mouse moves out of the list view | 46 | //this is done to hide the highlight if the mouse moves out of the list view | ||
53 | //and we are not mouseoverring anything | 47 | //and we are not mouseoverring anything | ||
54 | if (printerItem.ListView.view.highlightItem) { | 48 | if (printerItem.ListView.view.highlightItem) { | ||
Show All 13 Lines | 57 | onClicked: { | |||
68 | printerItem.ListView.view.currentExpanded = expanded ? -1 : index; | 62 | printerItem.ListView.view.currentExpanded = expanded ? -1 : index; | ||
69 | } | 63 | } | ||
70 | 64 | | |||
71 | KQuickControlsAddons.QIconItem { | 65 | KQuickControlsAddons.QIconItem { | ||
72 | id: printerIcon | 66 | id: printerIcon | ||
73 | 67 | | |||
74 | anchors { | 68 | anchors { | ||
75 | left: parent.left | 69 | left: parent.left | ||
70 | leftMargin: units.smallSpacing | ||||
76 | verticalCenter: labelsColumn.verticalCenter | 71 | verticalCenter: labelsColumn.verticalCenter | ||
77 | } | 72 | } | ||
78 | 73 | | |||
79 | height: units.iconSizes.medium | 74 | height: units.iconSizes.medium | ||
80 | width: height | 75 | width: height | ||
81 | icon: iconName | 76 | icon: iconName | ||
82 | Behavior on opacity { PropertyAnimation {} } | 77 | Behavior on opacity { PropertyAnimation {} } | ||
83 | } | 78 | } | ||
84 | 79 | | |||
85 | Column { | 80 | Column { | ||
86 | id: labelsColumn | 81 | id: labelsColumn | ||
87 | 82 | | |||
88 | anchors { | 83 | anchors { | ||
89 | top: parent.top | 84 | top: parent.top | ||
90 | left: printerIcon.right | 85 | left: printerIcon.right | ||
91 | right: stateChangeButton.left | 86 | right: stateChangeButton.left | ||
92 | leftMargin: Math.round(units.gridUnit / 2) | 87 | topMargin: units.smallSpacing | ||
93 | rightMargin: Math.round(units.gridUnit / 2) | 88 | leftMargin: units.smallSpacing | ||
89 | rightMargin: units.smallSpacing | ||||
94 | } | 90 | } | ||
95 | 91 | | |||
96 | PlasmaComponents.Label { | 92 | PlasmaComponents.Label { | ||
97 | id: printerNameLabel | 93 | id: printerNameLabel | ||
98 | 94 | | |||
99 | anchors { | 95 | anchors { | ||
100 | left: parent.left | 96 | left: parent.left | ||
101 | right: parent.right | 97 | right: parent.right | ||
▲ Show 20 Lines • Show All 195 Lines • Show Last 20 Lines |