[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Dynamically generating service menus
From: "David Boosalis" <david.boosalis () gmail ! com>
Date: 2008-07-07 13:17:14
Message-ID: 870c99310807070617x9d79e54wca1ed3ab619026a0 () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Ruben
KMenu has a signal:aboutToShow() and you also can have a handle to
everything in your menu.
For instance I want to change the title of the menu dynamically so I have
something like this:
Create a handle to the title:
popupMenuTitleAction =
(KAction *) my PopupMenu->addAction(KIcon(":images/image.png"),
"generic Title");
Then in a slot connected to the aboutToShow signal I can modify the title
with:
popupMenuTitleAction->setText(str);
I see no reason why you can't also use this technic to dynamically create a
new menu and show it. I t would be best to create the one, or two menu
types ahead of time and just change the text where necessary. I assume what
you are changing on the fly is a rather finite number of actions, else it
might be kind of bewilding to the user to be getting a random popup menu
Hope this helps
David
On Mon, Jul 7, 2008 at 4:51 AM, Ruben Vandamme <vandamme.ruben@belgacom.net>
wrote:
> Hi,
>
> I'm trying to create a dynamic service menu for dolphin. Think of it
> like a "Send file to >" menu-item which opens a sub-menu with a list of
> currently online contacts in my IM client. That list has to be
> dynamically generated (with data received through DBus). However I
> cannot find any tutorial/specification/examples which create a service
> menu dynamically. They all describe static menus.
>
> Is there a way to do the above (create dynamic service menus) or will I
> have to create some sort of dialog which lists the contacts?
> NB: my problem is _not_ how to get the data through DBus or how to
> create simple service menus, that's all working already.
>
> Thanks
>
> Ruben
>
>
> >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to
> unsubscribe <<
>
[Attachment #5 (text/html)]
Ruben<br><br>KMenu has a signal:aboutToShow() and you also can have a handle to \
everything in your menu.<br><br>For instance I want to change the title of the menu \
dynamically so I have something like this:<br><br>Create a handle to the title:<br> \
<br> popupMenuTitleAction = <br> (KAction *) my \
PopupMenu->addAction(KIcon(":images/image.png"),<br> \
\
"generic Title");<br><br>Then in a slot connected to the \
aboutToShow signal I can modify the title with:<br> \
<br>popupMenuTitleAction->setText(str);<br><br><br>I see no reason why you \
can't also use this technic to dynamically create a new menu and show \
it. I t would be best to create the one, or two menu types ahead of time and \
just change the text where necessary. I assume what you are changing on the fly is a \
rather finite number of actions, else it might be kind of bewilding to the user to be \
getting a random popup menu<br> <br>Hope this helps<br>David<br><br><br><div \
class="gmail_quote">On Mon, Jul 7, 2008 at 4:51 AM, Ruben Vandamme <<a \
href="mailto:vandamme.ruben@belgacom.net">vandamme.ruben@belgacom.net</a>> \
wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, \
204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> Hi,<br>
<br>
I'm trying to create a dynamic service menu for dolphin. Think of it<br>
like a "Send file to >" menu-item which opens a sub-menu with a list \
of<br> currently online contacts in my IM client. That list has to be<br>
dynamically generated (with data received through DBus). However I<br>
cannot find any tutorial/specification/examples which create a service<br>
menu dynamically. They all describe static menus.<br>
<br>
Is there a way to do the above (create dynamic service menus) or will I<br>
have to create some sort of dialog which lists the contacts?<br>
NB: my problem is _not_ how to get the data through DBus or how to<br>
create simple service menus, that's all working already.<br>
<br>
Thanks<br>
<br>
Ruben<br>
<br>
<br>
>> Visit <a href="http://mail.kde.org/mailman/listinfo/kde-devel#unsub" \
target="_blank">http://mail.kde.org/mailman/listinfo/kde-devel#unsub</a> to \
unsubscribe <<<br> </blockquote></div><br>
>> 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