Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. Qt Contribution
  4. QSystemHotkey
Qt 6.11 is out! See what's new in the release blog

QSystemHotkey

Scheduled Pinned Locked Moved Qt Contribution
2 Posts 2 Posters 3.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    weblife
    wrote on last edited by
    #1

    Hello,

    I have a system wide hotkey class and created for my Qt5.1 app, "QSystemHotkey":https://github.com/CCi-BClark/SystemHotkey. Since there is not a class that does this I figured I would give a go at submitting it to the Qt5 library. How could I go about making it a better suited candidate?

    Currently it is implemented with the QApplication::processEvents() function to ensure the UIX doesn't freeze like so:
    @
    void hotkeyPressed(int position); //Handle hotkey SIGNAL

    //Create data type.
    STDSystemHotkey *hotkeys;

    //Connect data type to hadler function.
    connect(hotkeys, SIGNAL(runHotkey(int)),this,SLOT(hotkeyPressed(int)));

    hotkeys->addKey(200,MOD_ALT,'X'); //Add hotkey to system.

    QApplication::processEvents();
    hotkeys->beginHotkeys(); //Start listening for hotkeys.

    hotkeyPressed(int position){
    int val = hotkey->getHotkey(position);
    switch (val) {
    case 200:
    //function to run
    break;
    default:
    break;
    }
    }

    hotkeys->haultHotkeys(); //Stop listening for hotkeys.
    @

    Brandon Clark
    www.themindspot.com

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      You can use a queued signal and slot connection plus a QTimer to "order" your hotkey handling function to be run.

      If you want to contribute the code to Qt, you need to follow "the official guidelines":http://wiki.qt-project.org/Main_Page

      Definitely it should work on Mac and Linux, apart from Windows.

      (Z(:^

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved