Move mouse area into the delegate

Fixes mouse clicks not being accepted in TabBox in case the view
had started to scroll.
This commit is contained in:
Martin Gräßlin 2011-12-04 18:53:48 +01:00
parent 602f44bf84
commit fdfc479012
5 changed files with 35 additions and 35 deletions

View file

@ -75,6 +75,13 @@ Item {
bottomMargin: hoverItem.margins.bottom
}
}
MouseArea {
anchors.fill: parent
onClicked: {
iconsListView.currentIndex = index;
iconsListView.currentIndexChanged(iconsListView.currentIndex);
}
}
}
}
ListView {
@ -103,12 +110,5 @@ Item {
height: iconSize + margins.top + margins.bottom
}
highlightMoveDuration: 250
MouseArea {
anchors.fill: parent
onClicked: {
iconsListView.currentIndex = iconsListView.indexAt(mouse.x, mouse.y);
iconsListView.currentIndexChanged(iconsListView.currentIndex);
}
}
}
}

View file

@ -124,6 +124,13 @@ Item {
leftMargin: 2 * compactTabBox.textMargin
}
}
MouseArea {
anchors.fill: parent
onClicked: {
compactListView.currentIndex = index;
compactListView.currentIndexChanged(compactListView.currentIndex);
}
}
}
}
ListView {
@ -189,12 +196,5 @@ Item {
width: compactListView.width
}
highlightMoveDuration: 250
MouseArea {
anchors.fill: parent
onClicked: {
compactListView.currentIndex = compactListView.indexAt(mouse.x, mouse.y);
compactListView.currentIndexChanged(compactListView.currentIndex);
}
}
}
}

View file

@ -140,6 +140,13 @@ Item {
rightMargin: hoverItem.margins.right
}
}
MouseArea {
anchors.fill: parent
onClicked: {
listView.currentIndex = index;
listView.currentIndexChanged(listView.currentIndex);
}
}
}
}
ListView {
@ -205,12 +212,5 @@ Item {
width: listView.width
}
highlightMoveDuration: 250
MouseArea {
anchors.fill: parent
onClicked: {
listView.currentIndex = listView.indexAt(mouse.x, mouse.y);
listView.currentIndexChanged(listView.currentIndex);
}
}
}
}

View file

@ -91,6 +91,13 @@ Item {
leftMargin: hoverItem.margins.left
}
}
MouseArea {
anchors.fill: parent
onClicked: {
textListView.currentIndex = index;
textListView.currentIndexChanged(textListView.currentIndex);
}
}
}
}
ListView {
@ -154,12 +161,5 @@ Item {
width: textListView.width
}
highlightMoveDuration: 250
MouseArea {
anchors.fill: parent
onClicked: {
textListView.currentIndex = textListView.indexAt(mouse.x, mouse.y);
textListView.currentIndexChanged(textListView.currentIndex);
}
}
}
}

View file

@ -107,6 +107,13 @@ Item {
bottomMargin: hoverItem.margins.bottom
}
}
MouseArea {
anchors.fill: parent
onClicked: {
thumbnailListView.currentIndex = index;
thumbnailListView.currentIndexChanged(thumbnailListView.currentIndex);
}
}
}
highlight: PlasmaCore.FrameSvgItem {
id: highlightItem
@ -115,13 +122,6 @@ Item {
width: thumbnailListView.thumbnailWidth
height: thumbnailListView.thumbnailWidth*(1.0/screenFactor)
}
MouseArea {
anchors.fill: parent
onClicked: {
thumbnailListView.currentIndex = thumbnailListView.indexAt(mouse.x, mouse.y);
thumbnailListView.currentIndexChanged(thumbnailListView.currentIndex);
}
}
}
Item {
height: 40