if popup is more than double icon, center align

in vertical panels, align center when the popup height is > than double the icon height
otherwise, center when is more then icon width
This commit is contained in:
Marco Martin 2012-11-19 10:57:54 +01:00
parent b5eacc597d
commit 3a307ee465

View File

@ -260,6 +260,24 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints)
}
}
//If the popup is more than two times larger than the applet
//center it (or taller in case of vertical panels
if (f == Plasma::Vertical) {
if ((gWidget && gWidget->size().height() > q->size().height() *2 ) ||
(qWidget && qWidget->size().height() > q->size().height() *2 )) {
popupAlignment = Qt::AlignCenter;
} else {
popupAlignment = Qt::AlignLeft;
}
} else {
if ((gWidget && gWidget->size().width() > q->size().width() *2 ) ||
(qWidget && qWidget->size().width() > q->size().width() *2 )) {
popupAlignment = Qt::AlignCenter;
} else {
popupAlignment = Qt::AlignLeft;
}
}
//Applet on desktop
if ((!parentApplet || parentApplet->isContainment() ) && icon && (!icon->svg().isEmpty() || !icon->icon().isNull()) && ((f != Plasma::Vertical && f != Plasma::Horizontal) ||
((f == Plasma::Vertical && parentSize.width() >= minimum.width()) ||