1.下载
https://github.com/Skycoder42/QHotkey
2.使用
1 #include <QHotkey> 2 #include <QApplication> 3 #include <QDebug> 4 5 int main(int argc, char *argv[]) 6 { 7 QApplication app(argc, argv); 8 9 QHotkey hotkey(QKeySequence("Ctrl+Alt+Q"), true, &app); //The hotkey will be automatically registered 10 qDebug() << "Is segistered:" << hotkey.isRegistered(); 11 12 QObject::connect(&hotkey, &QHotkey::activated, qApp, [&](){ 13 qDebug() << "Hotkey Activated - the application will quit now"; 14 qApp->quit(); 15 }); 16 17 return app.exec(); 18 }
标签:int,app,QHotkey,argv,hotkey,include From: https://www.cnblogs.com/wuyuan2011woaini/p/18083460