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
});
}
MouseArea {
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();
}
Item{
anchors.fill: contentItem
DropArea {
id: dropMainArea
@ -135,58 +108,88 @@ PlasmaExtras.ScrollArea {
}
}
ToolTipInstance {
id: singleTask
visible: !isGroup
}
MouseArea {
id: contentItem
width: childrenRect.width
height: childrenRect.height
Grid {
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 {}
}
hoverEnabled: true
onContainsMouseChanged: {
checkMouseInside();
}
function containsMouse(){
for(var i=0; i<children.length-1; ++i){
if(children[i].containsMouse())
return true;
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();
}
}
return false;
function childrenContainMouse() {
return singleTask.containsMouse() || groupTask.containsMouse();
}
function childAtPos(x, y){
var tasks = groupTask.children;
ToolTipInstance {
id: singleTask
visible: !isGroup
}
for(var i=0; i<tasks.length; ++i){
var task = tasks[i];
Grid {
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)
choords.y = 0;
if(choords.x < 0)
choords.x = 0;
return false;
}
if( (x>=choords.x) && (x<=choords.x+task.width)
&& (y>=choords.y) && (y<=choords.y+task.height)){
return task;
function childAtPos(x, y){
var tasks = groupTask.children;
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