Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. EventFilter Print Screen key?
QtWS25 Last Chance

EventFilter Print Screen key?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 3.5k Views
  • 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.
  • J Offline
    J Offline
    jnewing
    wrote on last edited by
    #1

    Hey all so I've setup a simple eventfilter to run a few tests on capturing keyboard input to build a QKeySequence, here it what I have setup

    .cpp file
    @test::test(QWidget *parent) : QWidget(parent), ui(new Ui::Options)
    {
    ui->setupUi(this);
    ui->txtHotkey->installEventFilter(this);
    }

    bool test::eventFilter(QObject *obj, QEvent *event)
    {
    if (event->type() == QEvent::KeyPress)
    {
    QKeyEvent keyEvent = static_cast<QKeyEvent>(event);

        qDebug() << "key int: " << keyEvent->key();
    }
    
    return QWidget::eventFilter(obj, event);
    

    }@

    Now this works great for almost all keys however nothing happens when I press the "Print Screen" key on my keyboard why is this? as this is one of the keys I would really like to grab.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tucnak
      wrote on last edited by
      #2

      Hi, ~jnewing!

      Problem not in you - problem is in OS'es. They are not allowing to catch PrintScreen key press event.

      But there are a few solutions specified for systems' API's

      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