On Friday 10 October 2003 10:46, Richard Bown wrote:
> Ok, I'm trying to copy the dynamic QPopupMenu that's used for the
> Track instrument menu (attached to the Tracks menu).   In this case
> though I want to attach the QPopupMenu to an editview (so we can
> create a dynamic menu of Controller Rulers basically).
>
> The bit I'm not sure about is this equivalent piece of code:
>
>     QPopupMenu* addControlRuler =
>         dynamic_cast<QPopupMenu*>(factory()->
>                 container("add_control_ruler", this));
>
>     if (addControlRuler)  { [...] }
>
> When I attach this to a <Menu> item in matrix.rc (modifying the
> "add_control_ruler" element) something goes horribly wrong at runtime.

Er, could you be more precise ? What goes wrong ?

> I've not idea what this factory stuff is doing but it's not working for
> the edit views in the same way as it does for the main window.

It should, this is all KMainWindow stuff.

> Any clues?  I'm looking at you, G.

Yeah, sorry for the late reply. I'm not an expert on KDE's XMLGUI framework, 
but what you want to do sounds like what we're already doing with the edit 
tools RMB menus (except they set their own .rc file and aren't XMLGUI 
clients).

Basically, in the XML .rc file you have <Menu name="foo"> and in the code 
factory()->container("foo", client) will return that menu. 'client' is a 
KXMLGUIClient which needs to be added to the factory with 
KXMLGUIFactory::addClient() prior to calling container(). In the case of a 
KMainWindow, it is already a client, so if the 'this' in your code snippet 
above is a KMainWindow, it should work.

-- 
                                                Guillaume.
                                                http://www.telegraph-road.org


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
Rosegarden-devel mailing list
[EMAIL PROTECTED] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Reply via email to