Gui: Use auto and range-based for (#7481)
* On lines where the variable type is obvious from inspection, avoid repeating the type using auto. * When possible use a ranged for loop instead of begin() and end() iterators
This commit is contained in:
@@ -257,31 +257,31 @@ void Workbench::setupCustomToolbars(ToolBarItem* root, const Base::Reference<Par
|
||||
std::vector<Base::Reference<ParameterGrp> > hGrps = hGrp->GetGroups();
|
||||
CommandManager& rMgr = Application::Instance->commandManager();
|
||||
std::string separator = "Separator";
|
||||
for (std::vector<Base::Reference<ParameterGrp> >::iterator it = hGrps.begin(); it != hGrps.end(); ++it) {
|
||||
bool active = (*it)->GetBool("Active", true);
|
||||
for (const auto & it : hGrps) {
|
||||
bool active = it->GetBool("Active", true);
|
||||
if (!active) // ignore this toolbar
|
||||
continue;
|
||||
ToolBarItem* bar = new ToolBarItem(root);
|
||||
auto bar = new ToolBarItem(root);
|
||||
bar->setCommand("Custom");
|
||||
|
||||
// get the elements of the subgroups
|
||||
std::vector<std::pair<std::string,std::string> > items = hGrp->GetGroup((*it)->GetGroupName())->GetASCIIMap();
|
||||
for (std::vector<std::pair<std::string,std::string> >::iterator it2 = items.begin(); it2 != items.end(); ++it2) {
|
||||
if (it2->first.substr(0, separator.size()) == separator) {
|
||||
std::vector<std::pair<std::string,std::string> > items = hGrp->GetGroup(it->GetGroupName())->GetASCIIMap();
|
||||
for (const auto & item : items) {
|
||||
if (item.first.substr(0, separator.size()) == separator) {
|
||||
*bar << "Separator";
|
||||
}
|
||||
else if (it2->first == "Name") {
|
||||
bar->setCommand(it2->second);
|
||||
else if (item.first == "Name") {
|
||||
bar->setCommand(item.second);
|
||||
}
|
||||
else {
|
||||
Command* pCmd = rMgr.getCommandByName(it2->first.c_str());
|
||||
Command* pCmd = rMgr.getCommandByName(item.first.c_str());
|
||||
if (!pCmd) { // unknown command
|
||||
// first try the module name as is
|
||||
std::string pyMod = it2->second;
|
||||
std::string pyMod = item.second;
|
||||
try {
|
||||
Base::Interpreter().loadModule(pyMod.c_str());
|
||||
// Try again
|
||||
pCmd = rMgr.getCommandByName(it2->first.c_str());
|
||||
pCmd = rMgr.getCommandByName(item.first.c_str());
|
||||
}
|
||||
catch(const Base::Exception&) {
|
||||
}
|
||||
@@ -290,18 +290,18 @@ void Workbench::setupCustomToolbars(ToolBarItem* root, const Base::Reference<Par
|
||||
// still not there?
|
||||
if (!pCmd) {
|
||||
// add the 'Gui' suffix
|
||||
std::string pyMod = it2->second + "Gui";
|
||||
std::string pyMod = item.second + "Gui";
|
||||
try {
|
||||
Base::Interpreter().loadModule(pyMod.c_str());
|
||||
// Try again
|
||||
pCmd = rMgr.getCommandByName(it2->first.c_str());
|
||||
pCmd = rMgr.getCommandByName(item.first.c_str());
|
||||
}
|
||||
catch(const Base::Exception&) {
|
||||
}
|
||||
}
|
||||
|
||||
if (pCmd) {
|
||||
*bar << it2->first; // command name
|
||||
*bar << item.first; // command name
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -317,14 +317,14 @@ void Workbench::setupCustomShortcuts() const
|
||||
// Get all user defined shortcuts
|
||||
const CommandManager& cCmdMgr = Application::Instance->commandManager();
|
||||
std::vector<std::pair<std::string,std::string> > items = hGrp->GetASCIIMap();
|
||||
for (std::vector<std::pair<std::string,std::string> >::iterator it = items.begin(); it != items.end(); ++it) {
|
||||
Command* cmd = cCmdMgr.getCommandByName(it->first.c_str());
|
||||
for (const auto & item : items) {
|
||||
Command* cmd = cCmdMgr.getCommandByName(item.first.c_str());
|
||||
if (cmd && cmd->getAction()) {
|
||||
// may be UTF-8 encoded
|
||||
QString str = QString::fromUtf8(it->second.c_str());
|
||||
QString str = QString::fromUtf8(item.second.c_str());
|
||||
QKeySequence shortcut = str;
|
||||
cmd->getAction()->setShortcut(shortcut.toString(QKeySequence::NativeText));
|
||||
cmd->recreateTooltip(it->first.c_str(), cmd->getAction()); // The tooltip has the shortcut in it...
|
||||
cmd->recreateTooltip(item.first.c_str(), cmd->getAction()); // The tooltip has the shortcut in it...
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -343,7 +343,7 @@ void Workbench::createMainWindowPopupMenu(MenuItem*) const
|
||||
void Workbench::createLinkMenu(MenuItem *item) {
|
||||
if(!item || !App::GetApplication().getActiveDocument())
|
||||
return;
|
||||
MenuItem* linkMenu = new MenuItem;
|
||||
auto linkMenu = new MenuItem;
|
||||
linkMenu->setCommand("Link actions");
|
||||
*linkMenu << "Std_LinkMakeGroup" << "Std_LinkMake";
|
||||
|
||||
@@ -352,18 +352,18 @@ void Workbench::createLinkMenu(MenuItem *item) {
|
||||
"Std_LinkImport","Std_LinkImportAll",nullptr,"Std_LinkSelectLinked",
|
||||
"Std_LinkSelectLinkedFinal","Std_LinkSelectAllLinks"};
|
||||
bool separator = true;
|
||||
for(size_t i=0;i<sizeof(cmds)/sizeof(cmds[0]);++i) {
|
||||
if(!cmds[i]) {
|
||||
for(const auto & i : cmds) {
|
||||
if(!i) {
|
||||
if(separator) {
|
||||
separator = false;
|
||||
*linkMenu << "Separator";
|
||||
}
|
||||
continue;
|
||||
}
|
||||
auto cmd = rMgr.getCommandByName(cmds[i]);
|
||||
auto cmd = rMgr.getCommandByName(i);
|
||||
if(cmd->isActive()) {
|
||||
separator = true;
|
||||
*linkMenu << cmds[i];
|
||||
*linkMenu << i;
|
||||
}
|
||||
}
|
||||
*item << linkMenu;
|
||||
@@ -394,7 +394,7 @@ void Workbench::addPermanentMenuItems(MenuItem* mb) const
|
||||
Gui::MenuItem* item = par->findItem(it.second);
|
||||
item = par->afterItem(item);
|
||||
|
||||
Gui::MenuItem* add = new Gui::MenuItem();
|
||||
auto add = new Gui::MenuItem();
|
||||
add->setCommand(it.first);
|
||||
par->insertItem(item, add);
|
||||
}
|
||||
@@ -467,8 +467,8 @@ std::list<std::string> Workbench::listToolbars() const
|
||||
std::unique_ptr<ToolBarItem> tb(setupToolBars());
|
||||
std::list<std::string> bars;
|
||||
QList<ToolBarItem*> items = tb->getItems();
|
||||
for (QList<ToolBarItem*>::ConstIterator item = items.cbegin(); item != items.cend(); ++item)
|
||||
bars.push_back((*item)->command());
|
||||
for (const auto & item : items)
|
||||
bars.push_back(item->command());
|
||||
return bars;
|
||||
}
|
||||
|
||||
@@ -478,14 +478,14 @@ std::list<std::pair<std::string, std::list<std::string>>> Workbench::getToolbarI
|
||||
|
||||
std::list<std::pair<std::string, std::list<std::string>>> itemsList;
|
||||
QList<ToolBarItem*> items = tb->getItems();
|
||||
for (QList<ToolBarItem*>::ConstIterator it = items.cbegin(); it != items.cend(); ++it) {
|
||||
QList<ToolBarItem*> sub = (*it)->getItems();
|
||||
for (const auto & item : items) {
|
||||
QList<ToolBarItem*> sub = item->getItems();
|
||||
std::list<std::string> cmds;
|
||||
for (QList<ToolBarItem*>::ConstIterator jt = sub.cbegin(); jt != sub.cend(); ++jt) {
|
||||
cmds.push_back((*jt)->command());
|
||||
for (const auto & jt : sub) {
|
||||
cmds.push_back(jt->command());
|
||||
}
|
||||
|
||||
itemsList.emplace_back((*it)->command(), cmds);
|
||||
itemsList.emplace_back(item->command(), cmds);
|
||||
}
|
||||
return itemsList;
|
||||
}
|
||||
@@ -495,8 +495,8 @@ std::list<std::string> Workbench::listMenus() const
|
||||
std::unique_ptr<MenuItem> mb(setupMenuBar());
|
||||
std::list<std::string> menus;
|
||||
QList<MenuItem*> items = mb->getItems();
|
||||
for ( QList<MenuItem*>::ConstIterator it = items.cbegin(); it != items.cend(); ++it )
|
||||
menus.push_back((*it)->command());
|
||||
for (const auto & item : items)
|
||||
menus.push_back(item->command());
|
||||
return menus;
|
||||
}
|
||||
|
||||
@@ -505,8 +505,8 @@ std::list<std::string> Workbench::listCommandbars() const
|
||||
std::unique_ptr<ToolBarItem> cb(setupCommandBars());
|
||||
std::list<std::string> bars;
|
||||
QList<ToolBarItem*> items = cb->getItems();
|
||||
for (QList<ToolBarItem*>::ConstIterator item = items.cbegin(); item != items.cend(); ++item)
|
||||
bars.push_back((*item)->command());
|
||||
for (const auto & item : items)
|
||||
bars.push_back(item->command());
|
||||
return bars;
|
||||
}
|
||||
|
||||
@@ -578,14 +578,14 @@ void StdWorkbench::setupContextMenu(const char* recipient, MenuItem* item) const
|
||||
createLinkMenu(item);
|
||||
*item << "Separator";
|
||||
|
||||
MenuItem* StdViews = new MenuItem;
|
||||
auto StdViews = new MenuItem;
|
||||
StdViews->setCommand( "Standard views" );
|
||||
|
||||
*StdViews << "Std_ViewIsometric" << "Separator" << "Std_ViewHome" << "Std_ViewFront" << "Std_ViewTop" << "Std_ViewRight"
|
||||
<< "Std_ViewRear" << "Std_ViewBottom" << "Std_ViewLeft"
|
||||
<< "Separator" << "Std_ViewRotateLeft" << "Std_ViewRotateRight";
|
||||
|
||||
MenuItem *measure = new MenuItem();
|
||||
auto measure = new MenuItem();
|
||||
measure->setCommand("Measure");
|
||||
*measure << "View_Measure_Toggle_All" << "View_Measure_Clear_All";
|
||||
|
||||
@@ -619,10 +619,10 @@ void StdWorkbench::createMainWindowPopupMenu(MenuItem* item) const
|
||||
MenuItem* StdWorkbench::setupMenuBar() const
|
||||
{
|
||||
// Setup the default menu bar
|
||||
MenuItem* menuBar = new MenuItem;
|
||||
auto menuBar = new MenuItem;
|
||||
|
||||
// File
|
||||
MenuItem* file = new MenuItem( menuBar );
|
||||
auto file = new MenuItem( menuBar );
|
||||
file->setCommand("&File");
|
||||
*file << "Std_New" << "Std_Open" << "Separator" << "Std_CloseActiveWindow"
|
||||
<< "Std_CloseAllWindows" << "Separator" << "Std_Save" << "Std_SaveAs"
|
||||
@@ -632,7 +632,7 @@ MenuItem* StdWorkbench::setupMenuBar() const
|
||||
<< "Separator" << "Std_RecentFiles" << "Separator" << "Std_Quit";
|
||||
|
||||
// Edit
|
||||
MenuItem* edit = new MenuItem( menuBar );
|
||||
auto edit = new MenuItem( menuBar );
|
||||
edit->setCommand("&Edit");
|
||||
*edit << "Std_Undo" << "Std_Redo" << "Separator" << "Std_Cut" << "Std_Copy"
|
||||
<< "Std_Paste" << "Std_DuplicateSelection" << "Separator"
|
||||
@@ -641,14 +641,14 @@ MenuItem* StdWorkbench::setupMenuBar() const
|
||||
<< "Separator" << "Std_Placement" << "Std_TransformManip" << "Std_Alignment"
|
||||
<< "Std_Edit" << "Separator" << "Std_UserEditMode" << "Separator" << "Std_DlgPreferences";
|
||||
|
||||
MenuItem* axoviews = new MenuItem;
|
||||
auto axoviews = new MenuItem;
|
||||
axoviews->setCommand("Axonometric");
|
||||
*axoviews << "Std_ViewIsometric"
|
||||
<< "Std_ViewDimetric"
|
||||
<< "Std_ViewTrimetric";
|
||||
|
||||
// Standard views
|
||||
MenuItem* stdviews = new MenuItem;
|
||||
auto stdviews = new MenuItem;
|
||||
stdviews->setCommand("Standard views");
|
||||
*stdviews << "Std_ViewFitAll" << "Std_ViewFitSelection" << axoviews
|
||||
<< "Separator" << "Std_ViewHome" << "Std_ViewFront" << "Std_ViewTop"
|
||||
@@ -657,19 +657,19 @@ MenuItem* StdWorkbench::setupMenuBar() const
|
||||
<< "Separator" << "Std_ViewRotateLeft" << "Std_ViewRotateRight";
|
||||
|
||||
// stereo
|
||||
MenuItem* view3d = new MenuItem;
|
||||
auto view3d = new MenuItem;
|
||||
view3d->setCommand("&Stereo");
|
||||
*view3d << "Std_ViewIvStereoRedGreen" << "Std_ViewIvStereoQuadBuff"
|
||||
<< "Std_ViewIvStereoInterleavedRows" << "Std_ViewIvStereoInterleavedColumns"
|
||||
<< "Std_ViewIvStereoOff" << "Separator" << "Std_ViewIvIssueCamPos";
|
||||
|
||||
// zoom
|
||||
MenuItem* zoom = new MenuItem;
|
||||
auto zoom = new MenuItem;
|
||||
zoom->setCommand("&Zoom");
|
||||
*zoom << "Std_ViewZoomIn" << "Std_ViewZoomOut" << "Separator" << "Std_ViewBoxZoom";
|
||||
|
||||
// Visibility
|
||||
MenuItem* visu = new MenuItem;
|
||||
auto visu = new MenuItem;
|
||||
visu->setCommand("Visibility");
|
||||
*visu << "Std_ToggleVisibility" << "Std_ShowSelection" << "Std_HideSelection"
|
||||
<< "Std_SelectVisibleObjects"
|
||||
@@ -678,7 +678,7 @@ MenuItem* StdWorkbench::setupMenuBar() const
|
||||
<< "Separator" << "View_Measure_Toggle_All" << "View_Measure_Clear_All";
|
||||
|
||||
// View
|
||||
MenuItem* view = new MenuItem( menuBar );
|
||||
auto view = new MenuItem( menuBar );
|
||||
view->setCommand("&View");
|
||||
*view << "Std_ViewCreate" << "Std_OrthographicCamera" << "Std_PerspectiveCamera" << "Std_MainFullscreen" << "Separator"
|
||||
<< stdviews << "Std_FreezeViews" << "Std_DrawStyle" << "Std_SelBoundingBox"
|
||||
@@ -696,7 +696,7 @@ MenuItem* StdWorkbench::setupMenuBar() const
|
||||
<< "Std_ViewStatusBar";
|
||||
|
||||
// Tools
|
||||
MenuItem* tool = new MenuItem( menuBar );
|
||||
auto tool = new MenuItem( menuBar );
|
||||
tool->setCommand("&Tools");
|
||||
*tool << "Std_DlgParameter"
|
||||
<< "Separator"
|
||||
@@ -718,7 +718,7 @@ MenuItem* StdWorkbench::setupMenuBar() const
|
||||
#endif
|
||||
|
||||
// Macro
|
||||
MenuItem* macro = new MenuItem( menuBar );
|
||||
auto macro = new MenuItem( menuBar );
|
||||
macro->setCommand("&Macro");
|
||||
*macro << "Std_DlgMacroRecord"
|
||||
<< "Std_MacroStopRecord"
|
||||
@@ -734,18 +734,18 @@ MenuItem* StdWorkbench::setupMenuBar() const
|
||||
<< "Std_ToggleBreakpoint";
|
||||
|
||||
// Windows
|
||||
MenuItem* wnd = new MenuItem( menuBar );
|
||||
auto wnd = new MenuItem( menuBar );
|
||||
wnd->setCommand("&Windows");
|
||||
*wnd << "Std_ActivateNextWindow" << "Std_ActivatePrevWindow" << "Separator"
|
||||
<< "Std_TileWindows" << "Std_CascadeWindows"
|
||||
<< "Std_ArrangeIcons" << "Separator" << "Std_WindowsMenu" << "Std_Windows";
|
||||
|
||||
// Separator
|
||||
MenuItem* sep = new MenuItem( menuBar );
|
||||
auto sep = new MenuItem( menuBar );
|
||||
sep->setCommand( "Separator" );
|
||||
|
||||
// Help
|
||||
MenuItem* help = new MenuItem( menuBar );
|
||||
auto help = new MenuItem( menuBar );
|
||||
help->setCommand("&Help");
|
||||
*help << "Std_OnlineHelp" << "Std_FreeCADWebsite" << "Std_FreeCADDonation"
|
||||
<< "Std_FreeCADUserHub" << "Std_FreeCADPowerUserHub"
|
||||
@@ -757,28 +757,28 @@ MenuItem* StdWorkbench::setupMenuBar() const
|
||||
|
||||
ToolBarItem* StdWorkbench::setupToolBars() const
|
||||
{
|
||||
ToolBarItem* root = new ToolBarItem;
|
||||
auto root = new ToolBarItem;
|
||||
|
||||
// File
|
||||
ToolBarItem* file = new ToolBarItem( root );
|
||||
auto file = new ToolBarItem( root );
|
||||
file->setCommand("File");
|
||||
*file << "Std_New" << "Std_Open" << "Std_Save" << "Std_Print" << "Separator" << "Std_Cut"
|
||||
<< "Std_Copy" << "Std_Paste" << "Separator" << "Std_Undo" << "Std_Redo" << "Separator"
|
||||
<< "Std_UserEditMode" << "Separator" << "Std_Refresh" << "Separator" << "Std_WhatsThis";
|
||||
|
||||
// Workbench switcher
|
||||
ToolBarItem* wb = new ToolBarItem( root );
|
||||
auto wb = new ToolBarItem( root );
|
||||
wb->setCommand("Workbench");
|
||||
*wb << "Std_Workbench";
|
||||
|
||||
// Macro
|
||||
ToolBarItem* macro = new ToolBarItem( root );
|
||||
auto macro = new ToolBarItem( root );
|
||||
macro->setCommand("Macro");
|
||||
*macro << "Std_DlgMacroRecord" << "Std_MacroStopRecord" << "Std_DlgMacroExecute"
|
||||
<< "Std_DlgMacroExecuteDirect";
|
||||
|
||||
// View
|
||||
ToolBarItem* view = new ToolBarItem( root );
|
||||
auto view = new ToolBarItem( root );
|
||||
view->setCommand("View");
|
||||
*view << "Std_ViewFitAll" << "Std_ViewFitSelection" << "Std_DrawStyle" << "Std_SelBoundingBox"
|
||||
<< "Separator" << "Std_SelBack" << "Std_SelForward" << "Std_LinkSelectActions"
|
||||
@@ -787,7 +787,7 @@ ToolBarItem* StdWorkbench::setupToolBars() const
|
||||
<< "Std_ViewLeft" << "Separator" << "Std_MeasureDistance" ;
|
||||
|
||||
// Structure
|
||||
ToolBarItem* structure = new ToolBarItem( root );
|
||||
auto structure = new ToolBarItem( root );
|
||||
structure->setCommand("Structure");
|
||||
*structure << "Std_Part" << "Std_Group" << "Std_LinkMake" << "Std_LinkActions";
|
||||
|
||||
@@ -796,16 +796,16 @@ ToolBarItem* StdWorkbench::setupToolBars() const
|
||||
|
||||
ToolBarItem* StdWorkbench::setupCommandBars() const
|
||||
{
|
||||
ToolBarItem* root = new ToolBarItem;
|
||||
auto root = new ToolBarItem;
|
||||
|
||||
// View
|
||||
ToolBarItem* view = new ToolBarItem( root );
|
||||
auto view = new ToolBarItem( root );
|
||||
view->setCommand("Standard views");
|
||||
*view << "Std_ViewFitAll" << "Std_ViewFitSelection" << "Std_ViewIsometric" << "Separator"
|
||||
<< "Std_ViewFront" << "Std_ViewRight" << "Std_ViewTop" << "Separator"
|
||||
<< "Std_ViewRear" << "Std_ViewLeft" << "Std_ViewBottom";
|
||||
// Special Ops
|
||||
ToolBarItem* macro = new ToolBarItem( root );
|
||||
auto macro = new ToolBarItem( root );
|
||||
macro->setCommand("Special Ops");
|
||||
*macro << "Std_DlgParameter" << "Std_DlgPreferences" << "Std_DlgMacroRecord" << "Std_MacroStopRecord"
|
||||
<< "Std_DlgMacroExecute" << "Std_DlgCustomize";
|
||||
@@ -815,7 +815,7 @@ ToolBarItem* StdWorkbench::setupCommandBars() const
|
||||
|
||||
DockWindowItems* StdWorkbench::setupDockWindows() const
|
||||
{
|
||||
DockWindowItems* root = new DockWindowItems();
|
||||
auto root = new DockWindowItems();
|
||||
root->addDockWidget("Std_ToolBox", Qt::RightDockWidgetArea, false, false);
|
||||
//root->addDockWidget("Std_HelpView", Qt::RightDockWidgetArea, true, false);
|
||||
root->addDockWidget("Std_TreeView", Qt::LeftDockWidgetArea, true, false);
|
||||
@@ -852,8 +852,8 @@ BlankWorkbench::~BlankWorkbench()
|
||||
void BlankWorkbench::activated()
|
||||
{
|
||||
QList<QDockWidget*> dw = getMainWindow()->findChildren<QDockWidget*>();
|
||||
for (QList<QDockWidget*>::iterator it = dw.begin(); it != dw.end(); ++it)
|
||||
(*it)->toggleViewAction()->setVisible(false);
|
||||
for (auto & it : dw)
|
||||
it->toggleViewAction()->setVisible(false);
|
||||
getMainWindow()->statusBar()->hide();
|
||||
}
|
||||
|
||||
@@ -910,29 +910,29 @@ void NoneWorkbench::setupContextMenu(const char* recipient,MenuItem* item) const
|
||||
MenuItem* NoneWorkbench::setupMenuBar() const
|
||||
{
|
||||
// Setup the default menu bar
|
||||
MenuItem* menuBar = new MenuItem;
|
||||
auto menuBar = new MenuItem;
|
||||
|
||||
// File
|
||||
MenuItem* file = new MenuItem( menuBar );
|
||||
auto file = new MenuItem( menuBar );
|
||||
file->setCommand("&File");
|
||||
*file << "Std_Quit";
|
||||
|
||||
// Edit
|
||||
MenuItem* edit = new MenuItem( menuBar );
|
||||
auto edit = new MenuItem( menuBar );
|
||||
edit->setCommand("&Edit");
|
||||
*edit << "Std_DlgPreferences";
|
||||
|
||||
// View
|
||||
MenuItem* view = new MenuItem( menuBar );
|
||||
auto view = new MenuItem( menuBar );
|
||||
view->setCommand("&View");
|
||||
*view << "Std_Workbench";
|
||||
|
||||
// Separator
|
||||
MenuItem* sep = new MenuItem( menuBar );
|
||||
auto sep = new MenuItem( menuBar );
|
||||
sep->setCommand("Separator");
|
||||
|
||||
// Help
|
||||
MenuItem* help = new MenuItem( menuBar );
|
||||
auto help = new MenuItem( menuBar );
|
||||
help->setCommand("&Help");
|
||||
*help << "Std_OnlineHelp" << "Std_About";
|
||||
|
||||
@@ -941,19 +941,19 @@ MenuItem* NoneWorkbench::setupMenuBar() const
|
||||
|
||||
ToolBarItem* NoneWorkbench::setupToolBars() const
|
||||
{
|
||||
ToolBarItem* root = new ToolBarItem;
|
||||
auto root = new ToolBarItem;
|
||||
return root;
|
||||
}
|
||||
|
||||
ToolBarItem* NoneWorkbench::setupCommandBars() const
|
||||
{
|
||||
ToolBarItem* root = new ToolBarItem;
|
||||
auto root = new ToolBarItem;
|
||||
return root;
|
||||
}
|
||||
|
||||
DockWindowItems* NoneWorkbench::setupDockWindows() const
|
||||
{
|
||||
DockWindowItems* root = new DockWindowItems();
|
||||
auto root = new DockWindowItems();
|
||||
root->addDockWidget("Std_ReportView", Qt::BottomDockWidgetArea, true, false);
|
||||
return root;
|
||||
}
|
||||
@@ -980,14 +980,14 @@ MenuItem* TestWorkbench::setupMenuBar() const
|
||||
item->removeItem(item->findItem("Std_WhatsThis"));
|
||||
|
||||
// Test commands
|
||||
MenuItem* test = new MenuItem;
|
||||
auto test = new MenuItem;
|
||||
menuBar->insertItem( item, test );
|
||||
test->setCommand( "Test &Commands" );
|
||||
*test << "Std_Test1" << "Std_Test2" << "Std_Test3" << "Std_Test4" << "Std_Test5"
|
||||
<< "Std_Test6" << "Std_Test7" << "Std_Test8";
|
||||
|
||||
// Inventor View
|
||||
MenuItem* opiv = new MenuItem;
|
||||
auto opiv = new MenuItem;
|
||||
menuBar->insertItem( item, opiv );
|
||||
opiv->setCommand("&Inventor View");
|
||||
*opiv << "Std_ViewExample1" << "Std_ViewExample2" << "Std_ViewExample3";
|
||||
@@ -1063,8 +1063,8 @@ void PythonBaseWorkbench::setupContextMenu(const char* recipient, MenuItem* item
|
||||
{
|
||||
Q_UNUSED(recipient);
|
||||
QList<MenuItem*> items = _contextMenu->getItems();
|
||||
for (QList<MenuItem*>::Iterator it = items.begin(); it != items.end(); ++it) {
|
||||
item->appendItem((*it)->copy());
|
||||
for (const auto & it : items) {
|
||||
item->appendItem(it->copy());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1073,7 +1073,7 @@ void PythonBaseWorkbench::appendMenu(const std::list<std::string>& menu, const s
|
||||
if ( menu.empty() || items.empty() )
|
||||
return;
|
||||
|
||||
std::list<std::string>::const_iterator jt=menu.begin();
|
||||
auto jt=menu.begin();
|
||||
MenuItem* item = _menuBar->findItem( *jt );
|
||||
if (!item)
|
||||
{
|
||||
@@ -1098,8 +1098,8 @@ void PythonBaseWorkbench::appendMenu(const std::list<std::string>& menu, const s
|
||||
item = subitem;
|
||||
}
|
||||
|
||||
for (std::list<std::string>::const_iterator it = items.begin(); it != items.end(); ++it)
|
||||
*item << *it;
|
||||
for (const auto & it : items)
|
||||
*item << it;
|
||||
}
|
||||
|
||||
void PythonBaseWorkbench::removeMenu(const std::string& menu) const
|
||||
@@ -1114,17 +1114,17 @@ void PythonBaseWorkbench::removeMenu(const std::string& menu) const
|
||||
void PythonBaseWorkbench::appendContextMenu(const std::list<std::string>& menu, const std::list<std::string>& items) const
|
||||
{
|
||||
MenuItem* item = _contextMenu;
|
||||
for (std::list<std::string>::const_iterator jt=menu.begin();jt!=menu.end();++jt) {
|
||||
MenuItem* subitem = item->findItem(*jt);
|
||||
for (const auto & jt : menu) {
|
||||
MenuItem* subitem = item->findItem(jt);
|
||||
if (!subitem) {
|
||||
subitem = new MenuItem(item);
|
||||
subitem->setCommand(*jt);
|
||||
subitem->setCommand(jt);
|
||||
}
|
||||
item = subitem;
|
||||
}
|
||||
|
||||
for (std::list<std::string>::const_iterator it = items.begin(); it != items.end(); ++it)
|
||||
*item << *it;
|
||||
for (const auto & it : items)
|
||||
*item << it;
|
||||
}
|
||||
|
||||
void PythonBaseWorkbench::removeContextMenu(const std::string& menu) const
|
||||
@@ -1150,8 +1150,8 @@ void PythonBaseWorkbench::appendToolbar(const std::string& bar, const std::list<
|
||||
item->setCommand(bar);
|
||||
}
|
||||
|
||||
for (std::list<std::string>::const_iterator it = items.begin(); it != items.end(); ++it)
|
||||
*item << *it;
|
||||
for (const auto & it : items)
|
||||
*item << it;
|
||||
}
|
||||
|
||||
void PythonBaseWorkbench::removeToolbar(const std::string& bar) const
|
||||
@@ -1172,8 +1172,8 @@ void PythonBaseWorkbench::appendCommandbar(const std::string& bar, const std::li
|
||||
item->setCommand(bar);
|
||||
}
|
||||
|
||||
for (std::list<std::string>::const_iterator it = items.begin(); it != items.end(); ++it)
|
||||
*item << *it;
|
||||
for (const auto & it : items)
|
||||
*item << it;
|
||||
}
|
||||
|
||||
void PythonBaseWorkbench::removeCommandbar(const std::string& bar) const
|
||||
|
||||
Reference in New Issue
Block a user