MCPcopy Create free account
hub / github.com/IENT/YUView / addContextMenuActions

Method addContextMenuActions

YUViewLib/src/ui/views/MoveAndZoomableView.cpp:74–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74void MoveAndZoomableView::addContextMenuActions(QMenu *menu)
75{
76 auto addActionToMenu =
77 [this, &menu](QString name, auto functionPointer, const QKeySequence shortcut = {}) {
78 auto action = new QAction(name, menu);
79 action->setShortcut(shortcut);
80 QObject::connect(action, &QAction::triggered, this, functionPointer);
81 menu->addAction(action);
82 };
83
84 addActionToMenu("Zoom to 1:1", &MoveAndZoomableView::resetView, Qt::CTRL | Qt::Key_0);
85 addActionToMenu("Zoom to Fit", &MoveAndZoomableView::zoomToFit, Qt::CTRL | Qt::Key_9);
86 addActionToMenu("Zoom in", &MoveAndZoomableView::zoomIn, Qt::CTRL | Qt::Key_Plus);
87 addActionToMenu("Zoom out", &MoveAndZoomableView::zoomOut, Qt::CTRL | Qt::Key_Minus);
88 menu->addSeparator();
89 addActionToMenu("Zoom to 50%", &MoveAndZoomableView::zoomTo50);
90 addActionToMenu("Zoom to 100%", &MoveAndZoomableView::zoomTo100);
91 addActionToMenu("Zoom to 200%", &MoveAndZoomableView::zoomTo200);
92 addActionToMenu("Zoom to ...", &MoveAndZoomableView::zoomToCustom);
93}
94
95// Handle the key press event (if this widgets handles it). If not, return false.
96bool MoveAndZoomableView::handleKeyPress(QKeyEvent *event)

Callers 1

mouseReleaseEventMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected