Keyboard shortcuts for QWebEngineView navigation
-
Hi @ospf,
There are 2 ways to do it:- Using a QMenu and adding QAction to it using addAction and then setShortcut to it. I see you have already tried it but it works. The prerequisite is it needs a
QMenu
.
For Eg. Check this Browser example especially this class and browse tosetupMenu()
method - Use QShortcut and connect its
activated
signal to a slot which will get executed on trigger.
Eg.
QShortcut *shortcut = new QShortcut(QKeySequence("Ctrl+r"), this); QObject::connect(shortcut, SIGNAL(activated()), view, SLOT(reload())); //view = QWebEngineView and reload() = its slot.
Edit: added example link.
- Using a QMenu and adding QAction to it using addAction and then setShortcut to it. I see you have already tried it but it works. The prerequisite is it needs a