Can ALT be coded as shortcut key?
Unsolved
General and Desktop
-
In many drawing applications, Alt is the shortcut for the eyedropper tool.
In the application I work on, we want to keep this as the default behavior, but it should be editable, in stead as hardcoded as it usually is.
I can't git it to work. I have tried this:```QAction* eyedropperAlt = nullptr;
in mainWindow.h, and
eyedropperAlt = new QAction(this); connect(eyedropperAlt, &QAction::triggered, mToolBox, &ToolBoxWidget::eyedropperAltOn); eyedropperAlt->setShortcut(Qt::Key_Alt);
in mainWindow.cpp.
I have also tried to set Qt::Altmodifier as shortcut. Nothing works.
Any suggestions? -
@davidlamhauge
Based purely on my intuition, if it doesn't work as-is then Alt is doubtless a modifier only and you need to go into something likekeyPressEvent
(e.g. https://stackoverflow.com/a/25005828/489865) to capture it? -
Thanks! It worked.