void Workspace::writeMenu(XmlWriter& xml, QMenu* menu) { // Recursively save QMenu for (QAction* action : menu->actions()) { if (action->isSeparator()) xml.tag("action", ""); else if (action->menu()) { xml.stag("Menu name=\"" + findStringFromMenu(action->menu()) + "\""); writeMenu(xml, action->menu()); xml.etag(); } else { xml.tag("action", findStringFromAction(action)); } } }
void TMenuView::writeMenu( opstream& os, TMenu *menu ) { uchar tok = 0xFF; for( TMenuItem *item = menu->items; item != 0; item = item->next ) { os << tok; os.writeString( item->name ); os << item->command << (int)(item->disabled) << item->keyCode << item->helpCtx; if( item->name != 0 ) { if( item->command == 0 ) writeMenu( os, item->subMenu ); else os.writeString( item->param ); } } tok = 0; os << tok; }
void Workspace::writeMenuBar(XmlWriter& xml, QMenuBar* mb) { // Loop through each menu in menubar. For each menu, call writeMenu. xml.stag("MenuBar"); if (!mb) mb = mscore->menuBar(); for (QAction* action : mb->actions()) { if (action->isSeparator()) xml.tag("action", ""); else if (action->menu()) { xml.stag("Menu name=\"" + findStringFromMenu(action->menu()) + "\""); writeMenu(xml, action->menu()); xml.etag(); } else xml.tag("action", findStringFromAction(action)); } xml.etag(); }
void TMenuView::write( opstream& os ) { TView::write( os ); writeMenu( os, menu ); }