So you want to know how to add a menu button to the menu bar, but you have no idea where to start?

Start with data/rc/. From there, you probably want either rosegardenmainwindow.rc or notation.rc. It'll be pretty obvious how it goes, from all the other entries there. Invent some unique name for your action; I'll call it “foo”.

One thing you want to watch out for is state, which greys out some entries when there's nothing sensible for them to do. You generally don't need to mess with it, but if your entry greys out for no apparent reason, that's probably it.

Once you've done that, you'll have a menu item that does nothing.

Then you need to add a slotFoo and connect it to command “foo”, probably in src/gui/application/RosegardenMainWindow.cpp or src/gui/editors/notation/NotationView.cpp. Let's say it's RosegardenMainWindow.

In RosegardenMainWindow.h, in class RosegardenMainWindow, after “public slots:” add:

 /* Description of what foo does */
 void slotFoo();

In RosegardenMainWindow.cpp, add:

 createAction("foo", SLOT(slotFoo()));

Please group it nicely with the other actions. From reading the file, it should be fairly obvious how they are grouped.

Now you're created and connected a menu item. Debugging it, well, that's another story.

 
 
dev/how_to_add_menu_items.txt · Last modified: 2013/07/02 12:55 (external edit)
Recent changes RSS feed Creative Commons License Valid XHTML 1.0 Valid CSS Driven by DokuWiki