[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: servicemenu patch
From: Matthias Elter <me () caldera ! de>
Date: 2000-10-27 12:31:47
[Download RAW message or body]
Hi
KIconloader returns large icons when it can't find a small version even if
the KIcon::Small override flag is set. This makes the K-Menu look ugly on
some systems (COL for example ;-). ServiceMenu will now check the size of the
icons returned by KIconLoader and smoothScale 'em if required.
Can I apply to KDE_2_0_BRANCH?
Bye,
Matthias
--
Matthias Elter
me@kde.org
me@caldera.de
["servicemenu.patch" (text/x-c++)]
Index: service_mnu.cpp
===================================================================
RCS file: /home/kde/kdebase/kicker/ui/service_mnu.cpp,v
retrieving revision 1.11
diff -u -b -B -r1.11 service_mnu.cpp
--- service_mnu.cpp 2000/10/27 11:53:28 1.11
+++ service_mnu.cpp 2000/10/27 12:23:36
@@ -22,6 +22,8 @@
******************************************************************/
#include <qdragobject.h>
+#include <qpixmap.h>
+#include <qimage.h>
#include <kapp.h>
#include <kstddirs.h>
@@ -155,8 +157,26 @@
// to accelators, replace them with two ampersands.
serviceName.replace(QRegExp("&"), "&&");
QIconSet iconSet;
- iconSet.setPixmap(loader->loadIcon(s->icon(), KIcon::Small, 0, \
KIcon::DefaultState, 0L, true), QIconSet::Small, QIconSet::Normal);
- iconSet.setPixmap(loader->loadIcon(s->icon(), KIcon::Small, 0, \
KIcon::ActiveState, 0L, true), QIconSet::Small, QIconSet::Active); +
+ QPixmap active = loader->loadIcon(s->icon(), KIcon::Small, 0, \
KIcon::DefaultState, 0L, true); + QPixmap inactive = loader->loadIcon(s->icon(), \
KIcon::Small, 0, KIcon::ActiveState, 0L, true); +
+ // make sure they are not larger than 16x16
+ if (active.width() > 16 || active.height() > 16) {
+ QImage tmp = active.convertToImage();
+ tmp = tmp.smoothScale(16, 16);
+ active.convertFromImage(tmp);
+ }
+
+ if (inactive.width() > 16 || inactive.height() > 16) {
+ QImage tmp = inactive.convertToImage();
+ tmp = tmp.smoothScale(16, 16);
+ inactive.convertFromImage(tmp);
+ }
+
+ iconSet.setPixmap(active, QIconSet::Small, QIconSet::Normal);
+ iconSet.setPixmap(inactive, QIconSet::Small, QIconSet::Active);
+
int newId = insertItem(iconSet, serviceName, id++);
entryMap_.insert(newId, static_cast<KSharedPtr<KSycocaEntry> >(s));
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic