Commit df0e7496 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

[KickoffItem] Remove wrapper Item

There's a MouseArea with anchors.fill within an Item, just merge the two. There's no references to the Item.

Differential Revision: https://phabricator.kde.org/D10545
parent 0a7c44ab
......@@ -29,7 +29,6 @@ Item {
id: listItem
width: ListView.view.width
// height: listItemDelegate.height // + listItemDelegate.anchors.margins*2
height: (units.smallSpacing * 2) + Math.max(elementIcon.height, titleElement.height + subTitleElement.height)
signal actionTriggered(string actionId, variant actionArgument)
......@@ -93,82 +92,73 @@ Item {
}
}
Item {
id: listItemDelegate
MouseArea {
id: mouseArea
anchors {
left: parent.left
right: parent.right
top: parent.top
bottom: parent.bottom
//margins: units.smallSpacing
}
MouseArea {
id: mouseArea
anchors.fill: parent
//anchors.margins: -8
property bool pressed: false
property int pressX: -1
property int pressY: -1
property bool pressed: false
property int pressX: -1
property int pressY: -1
hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.RightButton
hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.RightButton
onEntered: {
listItem.ListView.view.currentIndex = index;
}
onEntered: {
listItem.ListView.view.currentIndex = index;
}
onExited: {
listItem.ListView.view.currentIndex = -1;
}
onExited: {
listItem.ListView.view.currentIndex = -1;
onPressed: {
if (mouse.buttons & Qt.RightButton) {
if (hasActionList) {
openActionMenu(mouseArea, mouse.x, mouse.y);
}
} else {
pressed = true;
pressX = mouse.x;
pressY = mouse.y;
}
}
onPressed: {
if (mouse.buttons & Qt.RightButton) {
if (hasActionList) {
openActionMenu(mouseArea, mouse.x, mouse.y);
}
onReleased: {
if (pressed) {
if (appView) {
appViewScrollArea.state = "OutgoingLeft";
} else {
pressed = true;
pressX = mouse.x;
pressY = mouse.y;
listItem.activate();
}
}
onReleased: {
if (pressed) {
if (appView) {
appViewScrollArea.state = "OutgoingLeft";
} else {
listItem.activate();
}
listItem.ListView.view.currentIndex = -1;
}
listItem.ListView.view.currentIndex = -1;
}
pressed = false;
pressX = -1;
pressY = -1;
}
onPositionChanged: {
if (pressX != -1 && model.url && dragHelper.isDrag(pressX, pressY, mouse.x, mouse.y)) {
kickoff.dragSource = listItem;
dragHelper.startDrag(root, model.url, model.decoration);
pressed = false;
pressX = -1;
pressY = -1;
}
}
onPositionChanged: {
if (pressX != -1 && model.url && dragHelper.isDrag(pressX, pressY, mouse.x, mouse.y)) {
kickoff.dragSource = listItem;
dragHelper.startDrag(root, model.url, model.decoration);
pressed = false;
pressX = -1;
pressY = -1;
}
}
onContainsMouseChanged: {
if (!containsMouse) {
pressed = false;
pressX = -1;
pressY = -1;
}
onContainsMouseChanged: {
if (!containsMouse) {
pressed = false;
pressX = -1;
pressY = -1;
}
}
......
Supports Markdown
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