Add applets at the correct position when the applet is dropped in the margin
between two existing applets svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=756618
This commit is contained in:
parent
89ab030a89
commit
ee428ee92c
@ -417,24 +417,24 @@ Applet* Containment::addApplet(const QString& name, const QVariantList& args, ui
|
||||
if (formFactor() == Horizontal) {
|
||||
qreal middle = (existingApplet->geometry().left() +
|
||||
existingApplet->geometry().right()) / 2.0;
|
||||
if (position.x() >= existingApplet->geometry().left() &&
|
||||
position.x() <= middle) {
|
||||
// Applets are checked in order so there is no need to check
|
||||
// if the position is equal to or greater than the applet's
|
||||
// leftmost point. This also allows for dropping in the gap
|
||||
// between applets.
|
||||
if (position.x() < middle) {
|
||||
index = l->indexOf(existingApplet);
|
||||
break;
|
||||
} else if (position.x() <= existingApplet->geometry().right() &&
|
||||
position.x() >= middle) {
|
||||
} else if (position.x() <= existingApplet->geometry().right()) {
|
||||
index = l->indexOf(existingApplet) + 1;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
qreal middle = (existingApplet->geometry().top() +
|
||||
existingApplet->geometry().bottom()) / 2.0;
|
||||
if (position.y() >= existingApplet->geometry().top() &&
|
||||
position.y() <= middle) {
|
||||
if (position.y() < middle) {
|
||||
index = l->indexOf(existingApplet);
|
||||
break;
|
||||
} else if (position.y() <= existingApplet->geometry().bottom() &&
|
||||
position.y() >= middle) {
|
||||
} else if (position.y() <= existingApplet->geometry().bottom()) {
|
||||
index = l->indexOf(existingApplet) + 1;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user