fix blank space in preview window for single win

pull/1/head
Michail Vourlakos 8 years ago
parent 6f54efeded
commit 47ca620b76

@ -80,35 +80,8 @@ PlasmaExtras.ScrollArea {
return isVerticalPanel ? contentItem.height > viewport.height : contentItem.width > viewport.width return isVerticalPanel ? contentItem.height > viewport.height : contentItem.width > viewport.width
}); });
} }
Item{
MouseArea { anchors.fill: contentItem
id: contentItem
width: childrenRect.width
height: childrenRect.height
hoverEnabled: true
onContainsMouseChanged: {
checkMouseInside();
}
function checkMouseInside(){
var isInside = containsMouse || childrenContainMouse();
if (isInside){
root.disableRestoreZoom = true;
checkListHovered.stop();
toolTipDelegate.currentItem = parentIndex;
}
else{
root.disableRestoreZoom = false;
toolTipDelegate.currentItem = -1;
checkListHovered.restart();
}
}
function childrenContainMouse() {
return singleTask.containsMouse() || groupTask.containsMouse();
}
DropArea { DropArea {
id: dropMainArea id: dropMainArea
@ -135,58 +108,88 @@ PlasmaExtras.ScrollArea {
} }
} }
ToolTipInstance { MouseArea {
id: singleTask id: contentItem
visible: !isGroup width: childrenRect.width
} height: childrenRect.height
Grid { hoverEnabled: true
id: groupTask
rows: !isVerticalPanel onContainsMouseChanged: {
columns: isVerticalPanel checkMouseInside();
flow: isVerticalPanel ? Grid.TopToBottom : Grid.LeftToRight
spacing: units.largeSpacing
visible: isGroup
Repeater {
id: groupRepeater
model: DelegateModel {
model: tasksModel
rootIndex: tasksModel.makeModelIndex(parentIndex, -1)
delegate: ToolTipInstance {}
}
} }
function containsMouse(){ function checkMouseInside(){
for(var i=0; i<children.length-1; ++i){ var isInside = containsMouse || childrenContainMouse();
if(children[i].containsMouse()) if (isInside){
return true; root.disableRestoreZoom = true;
checkListHovered.stop();
toolTipDelegate.currentItem = parentIndex;
} }
else{
root.disableRestoreZoom = false;
toolTipDelegate.currentItem = -1;
checkListHovered.restart();
}
}
return false; function childrenContainMouse() {
return singleTask.containsMouse() || groupTask.containsMouse();
} }
function childAtPos(x, y){ ToolTipInstance {
var tasks = groupTask.children; id: singleTask
visible: !isGroup
}
for(var i=0; i<tasks.length; ++i){ Grid {
var task = tasks[i]; id: groupTask
rows: !isVerticalPanel
columns: isVerticalPanel
flow: isVerticalPanel ? Grid.TopToBottom : Grid.LeftToRight
spacing: units.largeSpacing
visible: isGroup
Repeater {
id: groupRepeater
model: DelegateModel {
model: tasksModel
rootIndex: tasksModel.makeModelIndex(parentIndex, -1)
delegate: ToolTipInstance {}
}
}
var choords = contentItem.mapFromItem(task,0, 0); function containsMouse(){
for(var i=0; i<children.length-1; ++i){
if(children[i].containsMouse())
return true;
}
if(choords.y < 0) return false;
choords.y = 0; }
if(choords.x < 0)
choords.x = 0;
if( (x>=choords.x) && (x<=choords.x+task.width) function childAtPos(x, y){
&& (y>=choords.y) && (y<=choords.y+task.height)){ var tasks = groupTask.children;
return task;
for(var i=0; i<tasks.length; ++i){
var task = tasks[i];
var choords = contentItem.mapFromItem(task,0, 0);
if(choords.y < 0)
choords.y = 0;
if(choords.x < 0)
choords.x = 0;
if( (x>=choords.x) && (x<=choords.x+task.width)
&& (y>=choords.y) && (y<=choords.y+task.height)){
return task;
}
} }
}
return null; return null;
}
} }
} }
} }

Loading…
Cancel
Save