Changeset View
Changeset View
Standalone View
Standalone View
applets/colorpicker/package/contents/ui/main.qml
Show First 20 Lines • Show All 271 Lines • ▼ Show 20 Line(s) | 266 | QtControls.Action { | |||
---|---|---|---|---|---|
272 | } | 272 | } | ||
273 | } | 273 | } | ||
274 | 274 | | |||
275 | QtControls.Action { | 275 | QtControls.Action { | ||
276 | shortcut: "Escape" | 276 | shortcut: "Escape" | ||
277 | onTriggered: plasmoid.expanded = false | 277 | onTriggered: plasmoid.expanded = false | ||
278 | } | 278 | } | ||
279 | 279 | | |||
280 | // This item serves as a drag pixmap and is captured when a drag starts | ||||
281 | Rectangle { | ||||
282 | id: dragImageDummy | ||||
283 | border { | ||||
284 | color: theme.textColor | ||||
285 | width: Math.round(units.devicePixelRatio) | ||||
286 | } | ||||
287 | radius: width | ||||
288 | width: units.iconSizes.large | ||||
289 | height: units.iconSizes.large | ||||
290 | visible: false | ||||
291 | } | ||||
292 | | ||||
280 | delegate: MouseArea { | 293 | delegate: MouseArea { | ||
281 | id: delegateMouse | 294 | id: delegateMouse | ||
282 | 295 | | |||
283 | readonly property color currentColor: modelData | 296 | readonly property color currentColor: modelData | ||
284 | 297 | | |||
285 | width: fullRoot.cellWidth | 298 | width: fullRoot.cellWidth | ||
286 | height: fullRoot.cellHeight | 299 | height: fullRoot.cellHeight | ||
287 | 300 | | |||
Show All 9 Lines | |||||
297 | onContainsMouseChanged: { | 310 | onContainsMouseChanged: { | ||
298 | if (containsMouse) { | 311 | if (containsMouse) { | ||
299 | fullRoot.currentIndex = index | 312 | fullRoot.currentIndex = index | ||
300 | } else { | 313 | } else { | ||
301 | fullRoot.currentIndex = -1 | 314 | fullRoot.currentIndex = -1 | ||
302 | } | 315 | } | ||
303 | } | 316 | } | ||
304 | 317 | | |||
318 | onPressed: { | ||||
319 | // grab pixmap only once | ||||
320 | if (Drag.imageSource.toString() === "") { // cannot just do !Drage.imageSource on QUrl | ||||
321 | dragImageDummy.color = currentColor; | ||||
322 | dragImageDummy.grabToImage(function (result) { | ||||
323 | Drag.imageSource = result.url; | ||||
324 | }); | ||||
325 | } | ||||
326 | } | ||||
327 | | ||||
305 | onClicked: { | 328 | onClicked: { | ||
306 | formattingMenu.model = Logic.menuForColor(delegateMouse.currentColor) | 329 | formattingMenu.model = Logic.menuForColor(delegateMouse.currentColor) | ||
307 | formattingMenu.open(0, rect.height) | 330 | formattingMenu.open(0, rect.height) | ||
308 | } | 331 | } | ||
309 | 332 | | |||
310 | PlasmaCore.ToolTipArea { | 333 | PlasmaCore.ToolTipArea { | ||
311 | anchors.fill: parent | 334 | anchors.fill: parent | ||
312 | active: colorLabel.truncated | 335 | active: colorLabel.truncated | ||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |