Commit 30fe276c authored by Sebastian Kügler's avatar Sebastian Kügler
Browse files

Simply Kickoff's mouse hover selection

This patch removes the MouseArea behind the listviews, which selected
the current item on hover beyond the listview's bounds. The positioning
in here isn't very reliable, especially when the content scrolls.

Simplify this by moving the margins inside the item and expanding the
listviews to the edges. This keeps the mouse interaction along the edges
intact, gives more expected behavior with the scrollbar, and doesn't
have the subtle positioning problems in finding the item.

This fixes wrongly selected entries in Kickoff when hovering over the
edges of the items, left and right, and fixes scrollbar behaviour.

BUG:332808
parent 644664a2
......@@ -40,10 +40,11 @@ Item {
}
function activateCurrentIndex(start) {
if (!applicationsView.currentItem.modelChildren)
if (!start)
if (!applicationsView.currentItem.modelChildren) {
if (!start) {
return;
}
}
appViewScrollArea.state = "OutgoingLeft";
}
......@@ -149,7 +150,7 @@ Item {
focus: true
keyNavigationWraps: true
boundsBehavior: Flickable.StopAtBounds
highlight: PlasmaComponents.Highlight {}
highlight: KickoffHighlight {}
highlightMoveDuration : 0
model: VisualDataModel {
......
......@@ -51,13 +51,11 @@ Item {
ListView {
id: kickoffListView
//anchors.fill: parent
interactive: contentHeight > height
boundsBehavior: Flickable.StopAtBounds
currentIndex: -1
keyNavigationWraps: true
highlight: PlasmaComponents.Highlight {}
highlight: KickoffHighlight {}
highlightMoveDuration : 0
delegate: KickoffItem {}
......
......@@ -177,7 +177,7 @@ Item {
interactive: contentHeight > height
delegate: KickoffItem {}
highlight: PlasmaComponents.Highlight {}
highlight: KickoffHighlight {}
highlightMoveDuration : 0
model: favoritesModel
......
......@@ -72,27 +72,15 @@ Item {
id: header
}
MouseArea {
Item {
id: mainArea
hoverEnabled: true
onPositionChanged: {
if (mainTabGroup.currentTab.listView) {
mainTabGroup.currentTab.listView.currentIndex = mainTabGroup.currentTab.listView.indexAt(units.largeSpacing * 2, mouse.y);
} else {
mainTabGroup.currentTab.item.listView.currentIndex = mainTabGroup.currentTab.item.listView.indexAt(units.largeSpacing * 2, mouse.y);
}
}
onClicked: {
currentView.activateCurrentIndex(1);
}
PlasmaComponents.TabGroup {
id: mainTabGroup
currentTab: favoritesPage
anchors {
fill: parent
leftMargin: units.largeSpacing
rightMargin: units.largeSpacing
}
//pages
......@@ -449,7 +437,6 @@ Item {
}
case Qt.Key_M:
case Qt.Key_Menu: {
print("MENU CLICKED");
currentView.openContextMenu();
event.accepted = true;
break;
......@@ -504,8 +491,4 @@ Item {
}
}
] // states
onStateChanged: {
print("root.state changed to : " + state);
}
}
/*
* Copyright 2014 Sebastian Kügler <sebas@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
import QtQuick 2.0
import org.kde.plasma.components 2.0 as PlasmaComponents
Item {
PlasmaComponents.Highlight {
anchors {
fill: parent
leftMargin: units.gridUnit
rightMargin: units.gridUnit
}
}
}
\ No newline at end of file
......@@ -117,7 +117,7 @@ Item {
anchors {
left: parent.left
leftMargin: (units.gridUnit * 3) - units.iconSizes.medium
leftMargin: (units.gridUnit * 4) - units.iconSizes.medium
verticalCenter: parent.verticalCenter
}
width: units.iconSizes.medium
......
......@@ -54,7 +54,7 @@ Item {
keyNavigationWraps: true
boundsBehavior: Flickable.StopAtBounds
delegate: KickoffItem {}
highlight: PlasmaComponents.Highlight {}
highlight: KickoffHighlight {}
highlightMoveDuration : 0
model: Kickoff.KRunnerModel{}
......
......@@ -45,7 +45,7 @@ Item {
// bottomMargin: units.gridUnit / 4
left: parent.left
right: parent.right
//leftMargin: units.gridUnit
leftMargin: units.gridUnit
}
y: units.gridUnit / 4
......
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