MCPcopy Create free account
hub / github.com/KDE/labplot / addActionToMenu

Method addActionToMenu

src/3rdparty/Qt-Advanced-Docking-System/src/DockManager.cpp:478–502  ·  view source on GitHub ↗

============================================================================

Source from the content-addressed store, hash-verified

476
477//============================================================================
478void DockManagerPrivate::addActionToMenu(QAction* Action, QMenu* Menu, bool InsertSorted)
479{
480 if (InsertSorted)
481 {
482 auto Actions = Menu->actions();
483 auto it = std::find_if(Actions.begin(), Actions.end(),
484 [&Action](const QAction* a)
485 {
486 return a->text().compare(Action->text(), Qt::CaseInsensitive) > 0;
487 });
488
489 if (it == Actions.end())
490 {
491 Menu->addAction(Action);
492 }
493 else
494 {
495 Menu->insertAction(*it, Action);
496 }
497 }
498 else
499 {
500 Menu->addAction(Action);
501 }
502}
503
504
505//============================================================================

Callers 1

Calls 3

beginMethod · 0.45
endMethod · 0.45
textMethod · 0.45

Tested by

no test coverage detected