17 #include "globalshortcut.h" 18 #include "globalshortcutregistry.h" 35 void GlobalShortcut::setShortcut(
const QVariant &shortcut)
37 if (m_shortcut == shortcut)
40 m_shortcut = shortcut;
41 registry->addShortcut(shortcut,
this);
42 Q_EMIT shortcutChanged(shortcut);
45 bool GlobalShortcut::isActive()
const 50 void GlobalShortcut::setActive(
bool active)
52 if (m_active == active)
56 Q_EMIT activeChanged(active);
59 void GlobalShortcut::keyPressEvent(QKeyEvent * event)
61 if (!m_active)
return;
67 void GlobalShortcut::keyReleaseEvent(QKeyEvent * event)
69 if (!m_active)
return;
72 Q_EMIT
released(m_shortcut.toString());
The GlobalShortcutRegistry class.
void triggered(const QString &shortcut)
The GlobalShortcut class.
void released(const QString &shortcut)