Fix a small glitch with windows snapping
This commit is contained in:
parent
4e8144732e
commit
b48997d0bf
1 changed files with 20 additions and 12 deletions
|
@ -155,9 +155,11 @@ BaseWindow::snapWindow(QPoint pos, AttachedWindowMap attached)
|
||||||
|
|
||||||
// test if this widget can snap left or right to another widget
|
// test if this widget can snap left or right to another widget
|
||||||
// and if it can, test if the tops or bottoms can also snap
|
// and if it can, test if the tops or bottoms can also snap
|
||||||
if (!vSnapped && (qAbs (w_left - right) < snapdistance)) {
|
if ((qAbs (w_left - right) < snapdistance)) {
|
||||||
pos.setX (w_left - ref->width () - attached[ref].x ());
|
if (!vSnapped) {
|
||||||
vSnapped = true;
|
pos.setX (w_left - ref->width () - attached[ref].x ());
|
||||||
|
vSnapped = true;
|
||||||
|
}
|
||||||
if (hSnapped) {
|
if (hSnapped) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -170,9 +172,11 @@ BaseWindow::snapWindow(QPoint pos, AttachedWindowMap attached)
|
||||||
hSnapped = true;
|
hSnapped = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (!vSnapped && (qAbs (left - w_right) < snapdistance)) {
|
} else if ((qAbs (left - w_right) < snapdistance)) {
|
||||||
pos.setX (w_right - attached[ref].x ());
|
if (!vSnapped) {
|
||||||
vSnapped = true;
|
pos.setX (w_right - attached[ref].x ());
|
||||||
|
vSnapped = true;
|
||||||
|
}
|
||||||
if (hSnapped) {
|
if (hSnapped) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -188,9 +192,11 @@ BaseWindow::snapWindow(QPoint pos, AttachedWindowMap attached)
|
||||||
}
|
}
|
||||||
// test if this widget can snap to top or bottom of another widget
|
// test if this widget can snap to top or bottom of another widget
|
||||||
// and if it can, test if the left or right edges also can
|
// and if it can, test if the left or right edges also can
|
||||||
if ((!hSnapped) && (qAbs (top - w_bottom) < snapdistance)) {
|
if ((qAbs (top - w_bottom) < snapdistance)) {
|
||||||
pos.setY (w_bottom - attached[ref].y ());
|
if (!hSnapped) {
|
||||||
hSnapped = true;
|
pos.setY (w_bottom - attached[ref].y ());
|
||||||
|
hSnapped = true;
|
||||||
|
}
|
||||||
if (vSnapped) {
|
if (vSnapped) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -203,9 +209,11 @@ BaseWindow::snapWindow(QPoint pos, AttachedWindowMap attached)
|
||||||
vSnapped = true;
|
vSnapped = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if ((!hSnapped) && (qAbs (w_top - bottom) < snapdistance)) {
|
} else if ((qAbs (w_top - bottom) < snapdistance)) {
|
||||||
pos.setY (w_top - ref->height () - attached[ref].y ());
|
if (!hSnapped) {
|
||||||
hSnapped = true;
|
pos.setY (w_top - ref->height () - attached[ref].y ());
|
||||||
|
hSnapped = true;
|
||||||
|
}
|
||||||
if (vSnapped) {
|
if (vSnapped) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue