Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/package/contents/ui/AppletAppearance.qml
Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Line(s) | 67 | property int maximumHeight: appletContainer.maximumHeight + | |||
---|---|---|---|---|---|
69 | margins.bottom; | 69 | margins.bottom; | ||
70 | 70 | | |||
71 | property alias applet: appletContainer.applet | 71 | property alias applet: appletContainer.applet | ||
72 | 72 | | |||
73 | property Item contents: appletContainer | 73 | property Item contents: appletContainer | ||
74 | property alias margins: plasmoidBackground.margins | 74 | property alias margins: plasmoidBackground.margins | ||
75 | property alias imagePath: plasmoidBackground.imagePath | 75 | property alias imagePath: plasmoidBackground.imagePath | ||
76 | 76 | | |||
77 | visible: false | 77 | property int lastX: 0 | ||
78 | 78 | property int lastY: 0 | |||
79 | QtObject { | | |||
80 | id: d | | |||
81 | 79 | | |||
82 | property real lastX: 0 | 80 | visible: false | ||
83 | property real lastY: 0 | | |||
84 | } | | |||
85 | 81 | | |||
86 | Timer { | 82 | Timer { | ||
87 | id: positionTimer | 83 | id: positionTimer | ||
88 | 84 | | |||
89 | repeat: false | 85 | repeat: false | ||
90 | running: false | 86 | running: false | ||
91 | interval: 100 | 87 | interval: 100 | ||
92 | 88 | | |||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | 133 | else if (width < minimumWidth) | |||
138 | innerEndWidth = minimumWidth; | 134 | innerEndWidth = minimumWidth; | ||
139 | else | 135 | else | ||
140 | innerEndWidth = width; | 136 | innerEndWidth = width; | ||
141 | } | 137 | } | ||
142 | 138 | | |||
143 | onXChanged: { | 139 | onXChanged: { | ||
144 | if (animationsEnabled) { | 140 | if (animationsEnabled) { | ||
145 | animationsEnabled = false; | 141 | animationsEnabled = false; | ||
146 | mouseListener.x += d.lastX - x; | 142 | mouseListener.x += lastX - x; | ||
147 | animationsEnabled = true; | 143 | animationsEnabled = true; | ||
148 | } | 144 | } | ||
149 | mouseListener.x = mouseListener.endX = (width - innerEndWidth)/2; | 145 | mouseListener.x = mouseListener.endX = (width - innerEndWidth)/2; | ||
150 | d.lastX = x; | 146 | lastX = x; | ||
151 | } | 147 | } | ||
152 | onYChanged: { | 148 | onYChanged: { | ||
153 | if (animationsEnabled) { | 149 | if (animationsEnabled) { | ||
154 | animationsEnabled = false; | 150 | animationsEnabled = false; | ||
155 | mouseListener.y += d.lastY - y; | 151 | mouseListener.y += lastY - y; | ||
156 | animationsEnabled = true; | 152 | animationsEnabled = true; | ||
157 | } | 153 | } | ||
158 | mouseListener.y = mouseListener.endY = (height - innerEndHeight)/2; | 154 | mouseListener.y = mouseListener.endY = (height - innerEndHeight)/2; | ||
159 | d.lastY = y; | 155 | lastY = y; | ||
160 | } | 156 | } | ||
161 | 157 | | |||
162 | // use this function to position appletItem instead of root.layoutManager.positionItem(appletItem) | 158 | // use this function to position appletItem instead of root.layoutManager.positionItem(appletItem) | ||
163 | function positionItem() { | 159 | function positionItem() { | ||
164 | if (floating) | 160 | if (floating) | ||
165 | return; | 161 | return; | ||
166 | root.layoutManager.positionItem(appletItem); | 162 | root.layoutManager.positionItem(appletItem); | ||
167 | } | 163 | } | ||
▲ Show 20 Lines • Show All 570 Lines • Show Last 20 Lines |