[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-panel-devel
Subject: simplelauncher review request
From: David Johnson <david () usermode ! org>
Date: 2009-01-31 20:56:44
Message-ID: 200901311256.44728.david () usermode ! org
[Download RAW message or body]
The simplelauncher classic menu looks fine under the Oxygen style, but under
most other styles the margins around the menu are too small. While this is
okay for application menus, it looks odd for an application launcher.
Under the Oxygen style there is ample space around the launcher menu, but
under Plastique, Cleanlooks, Phase, etc., there is no space, making the menu
look cramped.
I am attaching a patch that checks the style's menu panel width, and if too
small sets contents margin for the menu to make up for it. This change is
transparent for the default Oxygen style, and only affects styles with a menu
panel width of less than 4.
If this is suitable, I can check it in.
Thank you,
--
David Johnson
["menuview.cpp.diff" (text/x-diff)]
Index: menuview.cpp
===================================================================
--- menuview.cpp (revision 919371)
+++ menuview.cpp (working copy)
@@ -26,6 +26,7 @@
#include <QtCore/QStack>
#include <QtGui/QApplication>
#include <QtGui/QMouseEvent>
+#include <QtGui/QStyleOption>
#include <QtCore/QPersistentModelIndex>
// KDE
@@ -57,6 +58,9 @@
if (model->hasChildren(index)) {
KMenu *childMenu = new KMenu(parent);
+ int l, t, r, b;
+ parent->getContentsMargins(&l, &t, &r, &b);
+ childMenu->setContentsMargins(l, t, r, b);
childMenu->installEventFilter(q);
action = childMenu->menuAction();
@@ -96,6 +100,14 @@
, d(new Private(this))
{
installEventFilter(this);
+
+ // add extra margin for styles that have thin menu panel widths
+ QStyleOption option;
+ option.initFrom(this);
+ int margin = 4 - style()->pixelMetric(QStyle::PM_MenuPanelWidth, &option, this);
+ if (margin > 0) {
+ setContentsMargins(margin, margin, margin, margin);
+ }
}
MenuView::~MenuView()
_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic