Skip to content

mrousavy/QHotkeys

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QHotkeys

🔠 A small and lightweight cross platform C++ library implementing a system-wide hotkey system for Qt

There are implementations available for the following compilers/platforms:

  • msvc - Windows
  • linux - Linux/X11
  • macx - MacOSX

Usage

Install

Run this command in your project's directory:

git submodule add https://github.com/mrousavy/QHotkeys

Add these lines to your Qt Project file (.pro):

include(QHotkeys/QHotkeys.pri)
DEPENDPATH  += QHotkeys/src/
INCLUDEPATH += QHotkeys/src/

Code

#include <qhotkeys.h>
using namespace Qt;

// ...

void myCallback(const QHotkey& hotkey) {
  // This is executed on a seperate thread!
  cout << "Hotkey pressed!";
}

// ...

// Register the hotkey
QHotkey hotkey(ModifierKey::Control | ModifierKey::Alt, Key_I);
// Connect pressed signal to one or more callback slots
QObject::connect(&hotkey, &QHotkey::pressed, &myCallback);

About

🔠 A small and lightweight cross platform C++ library implementing a system-wide hotkey system for Qt

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published