============================================================================
| 476 | |
| 477 | //============================================================================ |
| 478 | void 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 | //============================================================================ |
no test coverage detected