Commit e0f0400d authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[Color Picker] Allow dragging color button to drag color

One can already drag colors from the popup grid to applications but this wasn't possible
with the recentmost color shown in the compact representation.

Differential Revision: https://phabricator.kde.org/D18700
parent 1e4f1566
......@@ -179,11 +179,12 @@ Item {
}
PlasmaComponents.ToolButton {
id: colorButton
anchors.fill: parent
tooltip: i18nc("@info:tooltip", "Color options")
onClicked: plasmoid.expanded = !plasmoid.expanded
// indicate viable drag...
checked: dropArea.containsAcceptableDrag
checked: dropArea.containsAcceptableDrag || colorButtonDragger.pressed
checkable: checked
Rectangle {
......@@ -224,6 +225,24 @@ Item {
}
}
}
MouseArea {
id: colorButtonDragger
anchors.fill: parent
onClicked: colorButton.clicked()
onPressed: colorCircle.grabToImage(function (result) {
Drag.imageSource = result.url;
});
drag.target: colorCircle
Drag.dragType: Drag.Automatic
Drag.active: drag.active
Drag.mimeData: {
"application/x-color": colorCircle.color,
"text/plain": Logic.formatColor(colorCircle.color, root.defaultFormat)
}
}
}
}
}
......
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