This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Icons in panel not resizing correctly

Tags: None
(comma "," separated)
User avatar
Serenity
Registered Member
Posts
27
Karma
0
OS
I'm using Debian Testing and I've recently upgraded to KDE 4.4.1 using the semi-official Qt/KDE repository. It generally works well, but icons in my panels have a strange problem with resizing.

Image

It can be seen most easily on the K Menu (which is actually Lancelot), the Wastebin, and the Device Notifier icons, but is also present on the application icons on the side panel.

The icons resize correctly when the panel is quite small, but beyond a specific point (where the icons seem to scale to just over 48x48) the icons snap back to a size of 32x32 and remain that size no matter how large the panel gets. With the side panel this results in the icons first becoming large enough that not all of them are visible, then suddenly becoming the size you see them there.


pointlessness - A rock of stability in a computing life eternally ruined by 'adventures'...
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
I think the Plasma developers added this size limitation to limit the space used by icons. I would consider it a bug however that the 32x32 size is the maximum when it will scale to 48x48 though...


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
Serenity
Registered Member
Posts
27
Karma
0
OS
It's a feature? Look at the bottom panel! I literally cannot resize it so the system tray has two rows of icons and the K Menu, Wastebin, and Device Notifier fill the height of the panel.

I really thought this must be a bug of some sort, I can't imagine something like this getting past even some basic testing.


pointlessness - A rock of stability in a computing life eternally ruined by 'adventures'...
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
The system tray, at least for the old specification requires padding + 48x48 x 2. For the K Menu, Wastebin and Device Notifier the 48x48 limit is intended, it badly falling back to 32x32 however isn't...


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
mkasick
Registered Member
Posts
1
Karma
0
Hi folks,

I've traced the immediate problem to the addition of the method "IconWidget::sizeHint" in KDE 4.4's libplasma. In KDE 4.3 this method didn't exist, and so would fall back on the superclass QGraphicsWidget's implementation. In the new implementation, sizeHint returns KIconLoader::SizeMedium (i.e., 32x32) when queried for the "PreferredSize".

There's a few solutions to this problem. A simple one is to remove the IconWidget::sizeHint method entirely, so it falls back on QGraphicsWidget's implementation, restoring the behavior of KDE 4.3. Another is to use the following patch, to return SizeLarge (48x48) instead:

Code: Select all
diff --git a/plasma/widgets/iconwidget.cpp b/plasma/widgets/iconwidget.cpp
--- a/plasma/widgets/iconwidget.cpp
+++ b/plasma/widgets/iconwidget.cpp
@@ -604,7 +604,7 @@
 QSizeF IconWidget::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const
 {
     if (which == Qt::PreferredSize) {
-        return sizeFromIconSize(KIconLoader::SizeMedium);
+        return sizeFromIconSize(KIconLoader::SizeLarge);
     } else if (which == Qt::MinimumSize) {
         return sizeFromIconSize(KIconLoader::SizeSmall);
     } else {


It's likely though that neither option is a good long term fix. Presumably IconWidget is used elsewhere besides the panel, and there's a reason for the choice of SizeMedium as its PreferredSize. In that case, the right fix might be to add a IconApplet::sizeHint (or IconApplet::preferredSize? I'm not really sure.) method, which returns (KIconLoader::SizeLarge + margin), or however that math is done. A similar method would have to be added to the kickoff applet, and any other that uses IconWidget and should behave similarly.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
I would recommend discussing this with the Plasma Developers on their mailing list: plasma-devel@kde.org. Whilst KDE 4.5 is now in feature freeze, bugs can be freely fixed.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], q.ignora, watchstar