首页 > 其他分享 >QHotkey

QHotkey

时间:2024-03-19 17:26:38浏览次数:17  
标签:int app QHotkey argv hotkey include

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

相关文章