From 3a307ee465c9778a3735edeb23421e4604b98cb6 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Mon, 19 Nov 2012 10:57:54 +0100 Subject: [PATCH] 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 --- popupapplet.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/popupapplet.cpp b/popupapplet.cpp index 59a20319c..d714b1abb 100644 --- a/popupapplet.cpp +++ b/popupapplet.cpp @@ -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()) ||