|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
Correct way of obtaining an iconWhat 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. -- Best Regards / Med venlig hilsen Thomas Olsen >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << |
|
|
Re: Correct way of obtaining an iconAm 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); Greetings Stefan -- Die Zukunft wird nicht gemeistert von denen, die an der Vergangenheit kleben. >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << |
|
|
Re: Correct way of obtaining an iconOn 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); > > Greetings > Stefan > Thanks Stefan. That'll come in handy. Now I just have to make the button - which the icon is for - do what I want it to do :-) -- Best Regards / Med venlig hilsen Thomas Olsen >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << |
|
|
Re: Correct way of obtaining an iconOn 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 << |
|
|
Re: Correct way of obtaining an iconThomas Olsen wrote:
> I must be missing something here. I have tried (Python syntax) the following > ways: > > And the Button still shows no icon. > > I'll probably be slapping my forehead when someone points out what I'm doing > wrong :-) > > I'm not sure what you're doing wrong, but I had similar problems a couple of weeks back, and in the end I just wrote (and it worked): buttonUp->setIcon(KIcon("arrow-up")); You might want to check that you have that icon in the theme that is currently selected (if your current theme is not Oxygen for example, it might not find anything - I had almost all of my icons in the oxygen folder). -- Oszkár Ambrus "Whoever believes in the Son [Jesus Christ] has eternal life" (John 3:36) Masters Student, Digital Enterprise Research Institute, NUIG [http://www.deri.ie] >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << |
|
|
[SOLVED - kinda] Re: Correct way of obtaining an iconOn 23/10-2009 11:08 Oszkar Ambrus <oszkar.ambrus@...> wrote:
> Thomas Olsen wrote: > > I must be missing something here. I have tried (Python syntax) the > > following ways: > > > > And the Button still shows no icon. > > > > I'll probably be slapping my forehead when someone points out what I'm > > doing wrong :-) > > I'm not sure what you're doing wrong, but I had similar problems a > couple of weeks back, > and in the end I just wrote (and it worked): > > buttonUp->setIcon(KIcon("arrow-up")); Thanks for the suggestion. Didn't help though. > You might want to check that you have that icon in the theme that is > currently selected (if your current theme is not Oxygen for example, it > might not find anything - I had almost all of my icons in the oxygen > folder). I tried to check what Icon the IconLoader would find by: iconloader = KIconLoader() print "Path: " + str(iconloader.iconPath("arrow-down", iconloader.Small)) and it prints /usr/share/icons/oxygen/16x16/actions/arrow-down.png which exists. Now I just tried to do: self.collapse_button.nativeWidget().setIcon(KIcon("arrow-down")) so it must be a bug in the Plasma lib. -- Best Regards / Med venlig hilsen Thomas Olsen >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << |
|
|
Re: [SOLVED - kinda] Re: Correct way of obtaining an iconThomas Olsen wrote:
> Now I just tried to do: > > self.collapse_button.nativeWidget().setIcon(KIcon("arrow-down")) > > so it must be a bug in the Plasma lib. > I meant to suggest this, but if you look at pushbutton.cpp in Plasma [1], setIcon does the exact same thing (nativeWidget().setIcon). So it's weird... [1] http://api.kde.org/4.x-api/kdelibs-apidocs/plasma/html/pushbutton_8cpp_source.html#l00264 -- Oszkár Ambrus "Whoever believes in the Son [Jesus Christ] has eternal life" (John 3:36) Masters Student, Digital Enterprise Research Institute, NUIG [http://www.deri.ie] >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << |
|
|
Re: [SOLVED - kinda] Re: Correct way of obtaining an iconOn 23/10-2009 12:09 Oszkar Ambrus <oszkar.ambrus@...> wrote:
> Thomas Olsen wrote: > > Now I just tried to do: > > > > self.collapse_button.nativeWidget().setIcon(KIcon("arrow-down")) > > > > so it must be a bug in the Plasma lib. > > I meant to suggest this, but if you look at pushbutton.cpp in Plasma [1], > setIcon does the exact same thing (nativeWidget().setIcon). > > So it's weird... > > > [1] > http://api.kde.org/4.x-api/kdelibs-apidocs/plasma/html/pushbutton_8cpp_sour > ce.html#l00264 Yes it is. I've mailed about it to plasma-devel where notmart suggested it was an error in the bindings so I forwarded it to kde-bindings. -- Best Regards / Med venlig hilsen Thomas Olsen >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << |
| Free embeddable forum powered by Nabble | Forum Help |