[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Correct way of obtaining an icon
From: Thomas Olsen <tanghus () gmail ! com>
Date: 2009-10-23 7:48:35
Message-ID: 200910230948.35689.tanghus () gmail ! com
[Download RAW message or body]
On Tuesday 20 October 2009 09:17:32 Stefan Majewsky wrote:
> Am Dienstag 20 Oktober 2009 06:57:13 schrieb Thomas Olsen:
> > What is KDE wise the correct way of obtaining an icon?
> >
> > Take e.g. /usr/share/icons/oxygen/16x16/actions/arrow-up.png
> >
> > Get the arrow-up icon in small size from the current Theme based on KDE's
> > location.
>
> Construct an KIcon instance, and retrieve the pixmap with the QIcon::pixmap
> member method. (If you were going to pass the pixmap to something that is
> capable of taking a complete QIcon instance, you should rather do that,
> because QIcon can contain multiple pixmaps with different sizes at once.)
>
> Example:
> > KIcon arrowIcon("arrow-up");
> > const QPixmap arrowPixmap = arrowIcon.pixmap(QSize(16, 16),
> > QIcon::Normal);
>
I must be missing something here. I have tried (Python syntax) the following
ways:
self.arrow_down_icon = KIcon("arrow-down")
self.collapse_button = Plasma.PushButton()
self.collapse_button.setIcon(self.arrow_down_icon)
The Button shows no Icon.
Then to be a bit more explicit I tried:
iconloader = KIconLoader()
print "Path: " + str(iconloader.iconPath("arrow-down", iconloader.Small))
# prints the correct path
self.arrow_down_icon = QIcon(iconloader.iconPath("arrow-down",
iconloader.Small))
# prints false
print "Failure? " + str(self.arrow_down_icon.isNull())
self.collapse_button = Plasma.PushButton()
self.collapse_button.setIcon(self.arrow_down_icon)
And the Button still shows no icon.
I'll probably be slapping my forehead when someone points out what I'm doing
wrong :-)
--
Best Regards / Med venlig hilsen
Thomas Olsen
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic