Changeset View
Changeset View
Standalone View
Standalone View
applets/taskmanager/package/contents/ui/ToolTipInstance.qml
Show First 20 Lines • Show All 173 Lines • ▼ Show 20 Line(s) | 173 | Item { | |||
---|---|---|---|---|---|
174 | id: thumbnailSourceItem | 174 | id: thumbnailSourceItem | ||
175 | anchors.fill: parent | 175 | anchors.fill: parent | ||
176 | 176 | | |||
177 | readonly property bool isMinimized: isGroup ? IsMinimized == true : isMinimizedParent | 177 | readonly property bool isMinimized: isGroup ? IsMinimized == true : isMinimizedParent | ||
178 | // TODO: this causes XCB error message when being visible the first time | 178 | // TODO: this causes XCB error message when being visible the first time | ||
179 | property int winId: isWin && windows[flatIndex] !== undefined ? windows[flatIndex] : 0 | 179 | property int winId: isWin && windows[flatIndex] !== undefined ? windows[flatIndex] : 0 | ||
180 | 180 | | |||
181 | PlasmaComponents.Highlight { | 181 | PlasmaComponents.Highlight { | ||
182 | anchors.fill: parent | 182 | anchors.fill: hoverHandler | ||
183 | visible: hoverHandler.containsMouse | 183 | visible: hoverHandler.containsMouse | ||
184 | pressed: hoverHandler.containsPress | 184 | pressed: hoverHandler.containsPress | ||
185 | } | 185 | } | ||
ndavis: I recall seeing a QML dos and don'ts webinar that said not to use large z values. | |||||
186 | 186 | | |||
187 | PlasmaCore.WindowThumbnail { | 187 | PlasmaCore.WindowThumbnail { | ||
188 | anchors.fill: parent | 188 | anchors.fill: hoverHandler | ||
189 | anchors.margins: units.smallSpacing | 189 | // Indent by one pixel to make sure we never cover up the entire highlight | ||
190 | anchors.margins: 1 | ||||
190 | 191 | | |||
191 | visible: !albumArtImage.visible && !thumbnailSourceItem.isMinimized | 192 | visible: !albumArtImage.visible && !thumbnailSourceItem.isMinimized | ||
192 | winId: thumbnailSourceItem.winId | 193 | winId: thumbnailSourceItem.winId | ||
193 | } | 194 | } | ||
194 | 195 | | |||
195 | Image { | 196 | Image { | ||
196 | id: albumArtBackground | 197 | id: albumArtBackground | ||
197 | source: albumArt | 198 | source: albumArt | ||
Show All 9 Lines | |||||
207 | } | 208 | } | ||
208 | } | 209 | } | ||
209 | 210 | | |||
210 | Image { | 211 | Image { | ||
211 | id: albumArtImage | 212 | id: albumArtImage | ||
212 | // also Image.Loading to prevent loading thumbnails just because the album art takes a split second to load | 213 | // also Image.Loading to prevent loading thumbnails just because the album art takes a split second to load | ||
213 | readonly property bool available: status === Image.Ready || status === Image.Loading | 214 | readonly property bool available: status === Image.Ready || status === Image.Loading | ||
214 | 215 | | |||
215 | height: thumbnail.height - playerControlsLoader.realHeight | 216 | anchors.fill: hoverHandler | ||
216 | anchors.horizontalCenter: parent.horizontalCenter | 217 | // Indent by one pixel to make sure we never cover up the entire highlight | ||
218 | anchors.margins: 1 | ||||
217 | sourceSize: Qt.size(parent.width, parent.height) | 219 | sourceSize: Qt.size(parent.width, parent.height) | ||
218 | 220 | | |||
219 | asynchronous: true | 221 | asynchronous: true | ||
220 | source: albumArt | 222 | source: albumArt | ||
221 | fillMode: Image.PreserveAspectFit | 223 | fillMode: Image.PreserveAspectFit | ||
222 | visible: available | 224 | visible: available | ||
223 | } | 225 | } | ||
224 | 226 | | |||
225 | // when minimized, we don't have a preview, so show the icon | 227 | // when minimized, we don't have a preview, so show the icon | ||
226 | PlasmaCore.IconItem { | 228 | PlasmaCore.IconItem { | ||
227 | width: parent.width | 229 | width: parent.width | ||
228 | height: thumbnail.height - playerControlsLoader.realHeight | 230 | height: thumbnail.height - playerControlsLoader.realHeight | ||
229 | anchors.horizontalCenter: parent.horizontalCenter | 231 | anchors.horizontalCenter: parent.horizontalCenter | ||
230 | source: thumbnailSourceItem.isMinimized && !albumArtImage.visible ? icon : "" | 232 | source: thumbnailSourceItem.isMinimized && !albumArtImage.visible ? icon : "" | ||
231 | animated: false | 233 | animated: false | ||
232 | usesPlasmaTheme: false | 234 | usesPlasmaTheme: false | ||
233 | visible: valid | 235 | visible: valid | ||
234 | } | 236 | } | ||
235 | 237 | | |||
236 | ToolTipWindowMouseArea { | 238 | ToolTipWindowMouseArea { | ||
237 | id: hoverHandler | 239 | id: hoverHandler | ||
238 | anchors.fill: parent | 240 | anchors.fill: parent | ||
241 | // Don't go under the player controls bar, when it's visible | ||||
242 | anchors.bottomMargin: playerControlsLoader.realHeight | ||||
239 | rootTask: parentTask | 243 | rootTask: parentTask | ||
240 | modelIndex: submodelIndex | 244 | modelIndex: submodelIndex | ||
241 | winId: thumbnailSourceItem.winId | 245 | winId: thumbnailSourceItem.winId | ||
242 | } | 246 | } | ||
243 | } | 247 | } | ||
244 | 248 | | |||
245 | 249 | | |||
246 | Loader { | 250 | Loader { | ||
▲ Show 20 Lines • Show All 225 Lines • Show Last 20 Lines |
I recall seeing a QML dos and don'ts webinar that said not to use large z values.