/** void QMenuBar::addMenu(Menu *menu) * bind/QMenuBar.h:10 */ static int MenuBar_addMenu(lua_State *L) { try { MenuBar *self = *((MenuBar **)dub_checksdata(L, 1, "mimas.MenuBar")); Menu *menu = *((Menu **)dub_checksdata(L, 2, "mimas.Menu")); self->addMenu(menu); return 0; } catch (std::exception &e) { lua_pushfstring(L, "addMenu: %s", e.what()); } catch (...) { lua_pushfstring(L, "addMenu: Unknown exception"); } return dub_error(L); }
bool SkinsPlugIn::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList) { MenuBar* pMenu = Service<DesktopServices>()->getMainMenuBar(); QAction* pBefore = pMenu->getMenuItem("&View/&Status Bar"); mpSkinsMenu = pMenu->addMenu("&View/S&kins", pBefore); mpSkinsMenu->setStatusTip("Change the current application skin."); VERIFY(mpSkinsMenu); VERIFY(connect(mpSkinsMenu, SIGNAL(triggered(QAction*)), this, SLOT(changeSkin(QAction*)))); QActionGroup* pActionGroup = new QActionGroup(mpSkinsMenu); pActionGroup->setExclusive(true); // Add default menu entries mpDefaultAction = mpSkinsMenu->addAction("Default"); mpDefaultAction->setCheckable(true); pActionGroup->addAction(mpDefaultAction); // Scan the skins directory const Filename* pPath = ConfigurationSettings::getSettingSupportFilesPath(); FactoryResource<FileFinder> pFinder; VERIFY(pPath && pFinder.get()); pFinder->findFile(pPath->getFullPathAndName() + "/Skins", "*.css", true); while (pFinder->findNextFile()) { std::string title; pFinder->getFileTitle(title); QAction* pAction = mpSkinsMenu->addAction(QString::fromStdString(title)); pAction->setCheckable(true); pActionGroup->addAction(pAction); } pFinder->findFile(pPath->getFullPathAndName() + "/Skins", "*.rcc", true); while (pFinder->findNextFile()) { std::string fullPath; std::string fileTitle; pFinder->getFullPath(fullPath); pFinder->getFileTitle(fileTitle); QString path = QString::fromStdString(fullPath); QString root = "/" + QString::fromStdString(fileTitle); if (QResource::registerResource(path, root)) { mRegisteredResources[root] = path; } } mDefaultStyleSheet = qApp->styleSheet(); mpDefaultAction->setChecked(true); return true; }