Commit 3e63fa62 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[Color Picker] Add drag pixmap for color

Differential Revision: https://phabricator.kde.org/D7184
parent 37f7bb26
......@@ -277,6 +277,19 @@ Item {
onTriggered: plasmoid.expanded = false
}
// This item serves as a drag pixmap and is captured when a drag starts
Rectangle {
id: dragImageDummy
border {
color: theme.textColor
width: Math.round(units.devicePixelRatio)
}
radius: width
width: units.iconSizes.large
height: units.iconSizes.large
visible: false
}
delegate: MouseArea {
id: delegateMouse
......@@ -302,6 +315,16 @@ Item {
}
}
onPressed: {
// grab pixmap only once
if (Drag.imageSource.toString() === "") { // cannot just do !Drage.imageSource on QUrl
dragImageDummy.color = currentColor;
dragImageDummy.grabToImage(function (result) {
Drag.imageSource = result.url;
});
}
}
onClicked: {
formattingMenu.model = Logic.menuForColor(delegateMouse.currentColor)
formattingMenu.open(0, rect.height)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment