Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/package/contents/ui/AppletAppearance.qml
Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Line(s) | 31 | Item { | |||
---|---|---|---|---|---|
78 | 78 | | |||
79 | QtObject { | 79 | QtObject { | ||
80 | id: d | 80 | id: d | ||
81 | 81 | | |||
82 | property real lastX: 0 | 82 | property real lastX: 0 | ||
83 | property real lastY: 0 | 83 | property real lastY: 0 | ||
84 | } | 84 | } | ||
85 | 85 | | |||
86 | onMinimumWidthChanged: { | 86 | Timer { | ||
87 | if (width < minimumWidth) { | 87 | id: positionTimer | ||
88 | | ||||
89 | repeat: false | ||||
90 | running: false | ||||
91 | interval: 100 | ||||
92 | | ||||
93 | onTriggered: { | ||||
88 | releasePosition(); | 94 | releasePosition(); | ||
89 | width = minimumWidth; | | |||
90 | positionItem(); | 95 | positionItem(); | ||
91 | if (showAppletHandle && !handleMerged) | 96 | if (showAppletHandle && !handleMerged) | ||
92 | appletHandle.positionHandle(); | 97 | appletHandle.positionHandle(); | ||
93 | } | 98 | } | ||
94 | } | 99 | } | ||
100 | | ||||
101 | onMinimumWidthChanged: { | ||||
102 | if (width < minimumWidth) { | ||||
103 | width = minimumWidth; | ||||
104 | positionTimer.restart(); | ||||
105 | } | ||||
106 | } | ||||
95 | onMinimumHeightChanged: { | 107 | onMinimumHeightChanged: { | ||
96 | if (height < minimumHeight) { | 108 | if (height < minimumHeight) { | ||
97 | releasePosition(); | | |||
98 | height = minimumHeight; | 109 | height = minimumHeight; | ||
99 | positionItem(); | 110 | positionTimer.restart(); | ||
100 | if (showAppletHandle && !handleMerged) | | |||
101 | appletHandle.positionHandle(); | | |||
102 | } | 111 | } | ||
103 | } | 112 | } | ||
104 | onMaximumWidthChanged: { | 113 | onMaximumWidthChanged: { | ||
105 | if (width > maximumWidth) { | 114 | if (width > maximumWidth) { | ||
106 | releasePosition(); | | |||
107 | width = maximumWidth; | 115 | width = maximumWidth; | ||
108 | positionItem(); | 116 | positionTimer.restart(); | ||
109 | if (showAppletHandle && !handleMerged) | | |||
110 | appletHandle.positionHandle(); | | |||
111 | } | 117 | } | ||
112 | } | 118 | } | ||
113 | onMaximumHeightChanged: { | 119 | onMaximumHeightChanged: { | ||
114 | if (height > maximumHeight) { | 120 | if (height > maximumHeight) { | ||
115 | releasePosition(); | | |||
116 | height = maximumHeight; | 121 | height = maximumHeight; | ||
117 | positionItem(); | 122 | positionTimer.restart(); | ||
118 | if (showAppletHandle && !handleMerged) | | |||
119 | appletHandle.positionHandle(); | | |||
120 | } | 123 | } | ||
121 | } | 124 | } | ||
122 | 125 | | |||
123 | onHeightChanged: { | 126 | onHeightChanged: { | ||
124 | if (height > maximumHeight) | 127 | if (height > maximumHeight) | ||
125 | innerEndHeight = maximumHeight; | 128 | innerEndHeight = maximumHeight; | ||
126 | else if (height < minimumHeight) | 129 | else if (height < minimumHeight) | ||
127 | innerEndHeight = minimumHeight; | 130 | innerEndHeight = minimumHeight; | ||
Show All 28 Lines | 152 | onYChanged: { | |||
156 | d.lastY = y; | 159 | d.lastY = y; | ||
157 | } | 160 | } | ||
158 | 161 | | |||
159 | // use this function to position appletItem instead of root.layoutManager.positionItem(appletItem) | 162 | // use this function to position appletItem instead of root.layoutManager.positionItem(appletItem) | ||
160 | function positionItem() { | 163 | function positionItem() { | ||
161 | if (floating) | 164 | if (floating) | ||
162 | return; | 165 | return; | ||
163 | root.layoutManager.positionItem(appletItem); | 166 | root.layoutManager.positionItem(appletItem); | ||
164 | root.layoutManager.saveItem(appletItem); | | |||
hein: This line was unnecessary, layoutManager.positionItem saves at the end. | |||||
165 | } | 167 | } | ||
166 | 168 | | |||
167 | // use this function to free appletItem position instead of | 169 | // use this function to free appletItem position instead of | ||
168 | // root.layoutManager.setSpaceAvailable(appletItem.x, appletItem.y, appletItem.width, appletItem.height, true) | 170 | // root.layoutManager.setSpaceAvailable(appletItem.x, appletItem.y, appletItem.width, appletItem.height, true) | ||
169 | function releasePosition() { | 171 | function releasePosition() { | ||
170 | if (!floating) | 172 | if (!floating) | ||
171 | root.layoutManager.setSpaceAvailable(x, y, width, height, true); | 173 | root.layoutManager.setSpaceAvailable(x, y, width, height, true); | ||
172 | } | 174 | } | ||
▲ Show 20 Lines • Show All 563 Lines • Show Last 20 Lines |
This line was unnecessary, layoutManager.positionItem saves at the end.