![]() Registered Member ![]()
|
Hello everyone,
i'm trying to make a menu for kde 4.2. I read the api for the kdelibs 4.x and i found the PopupApplet class. I think this is the correct class (also raptor-menu use this!) In the description of the method setPopupIcon(const QString &iconName) there's written: * icon the icon that has to be displayed when the applet is in a panel. so i set-up an icon for my pop-up applet but i cannot see any icon in the panel. how can i do this? i also took a look to the raptor-menu's code but i haven't understood yet how to do it. can anyone help me? thanks in advance
My belly is full of theory but when I play I forget it all - Al di Meola
-------------- darkman, proud to be a member of KDE forums since 2008-Nov. |
![]() Registered Member ![]()
|
Try something like this (my example - painting icon):
By the way: you can learn many things with source code of existing plasmoids.
Last edited by marcin.baszczewski on Wed Jan 07, 2009 9:23 pm, edited 1 time in total.
|
![]() Administrator ![]()
|
The easiest way to have an icon is to enable KIcon to load it, by drawing it in an application such as Krita or Inkscape, and installing it alongside your Plasmoid.
Once this is done, you can simply call setPopupIcon() Note that icon names cannot contain spaces. @marcin.baszczewski: This method will only work if your Plasmoid is designed to be used as an extender. If you just want your Plasmoid to behave in the Panel, then that method will not work, unless you draw it in a QPixmap, convert to QIcon, and then set it.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
Hi, I'm having a similar problem (I think it's not necessary to open another thread right?):
I have made a really simple plasmoid... I want to display a button in the desktop and an icon in the panel... but I can't make it work..
The plasmoid shows the pushbutton in the desktop and in the panel... but I want an icon in the panel ![]() What I'm missing? Thanks! |
![]() Administrator ![]()
|
You need to implement graphicsWidget() to return the QGraphicsWidget you want the Popup to display. This will also be used when your Applet is on the desktop.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
Hi!
I was sure the documentation said I could reimplement widget() or graphicsWiget(), that's why I chose widget()... anyway, it doesn't work with graphicsWidget() either...
The label is shown in the desktop and in the panel... why it doesn't get replaced by an icon? It's driving me crazy :'( Thanks! |
![]() Administrator ![]()
|
You might also be missing the init() function Plasma uses, but this should work.
Try changing this:
To this as well:
Last edited by bcooksley on Thu Jan 22, 2009 10:05 pm, edited 1 time in total.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
No, it didn't work
![]() I've being reading the code and found this: http://websvn.kde.org/trunk/KDE/kdelibs ... iew=markup
these 2 checks: containmentSize.width() >= minimum.width() and containmentSize.height() >= minimum.height() made me believe I had to set a minimum width... and here: http://websvn.kde.org/trunk/KDE/kdeplas ... iew=markup
I've confirmed it... it seems I need to set a minimum size to get it work... so I did it and now it works, but a new problem arose... the label would still be visible on the desktop, and the popup showed me that part of the desktop instead of the label... like this: http://img509.imageshack.us/img509/8755 ... ot1ll4.jpg Finally I realized all I needed was a proper layout, and now it looks like this: http://img232.imageshack.us/img232/7200 ... ot2ay1.jpg And this is the code:
Cheers!! ![]() |
Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell