File indexing completed on 2024-04-28 04:02:31

0001 /***************************************************************************
0002                           dlggrabkey.h  -  keygrabber
0003                              -------------------
0004     begin                : Pi máj 30 2003
0005     copyright            : (C) 2003 by Tomas Mecir
0006     email                : kmuddy@kmuddy.com
0007  ***************************************************************************/
0008 
0009 /***************************************************************************
0010  *                                                                         *
0011  *   This program is free software; you can redistribute it and/or modify  *
0012  *   it under the terms of the GNU General Public License as published by  *
0013  *   the Free Software Foundation; either version 2 of the License, or     *
0014  *   (at your option) any later version.                                   *
0015  *                                                                         *
0016  ***************************************************************************/
0017 
0018 #ifndef DLGGRABKEY_H
0019 #define DLGGRABKEY_H
0020 
0021 #include <QDialog>
0022 
0023 /**
0024 This dialog is used to grab keys. It works in conjuction with event filter
0025 installed in KMuddy class. Maybe I'll rewrite this to use
0026 QWidget::grabKeyboard instead, but current implementation is sufficient now.
0027 
0028 KKeyChooser is partially broken, it cannot handle numpad keys properly,
0029 so I have to create my own keygrabber.
0030 (or maybe it's QAction not supporting numpad keys - at least that's what
0031 KDE people say...). I don't use QAction here, so macro keys are not affected.
0032 
0033   *@author Tomas Mecir
0034   */
0035 
0036 class dlgGrabKey : public QDialog  {
0037    Q_OBJECT
0038 public:
0039   dlgGrabKey (QWidget *parent);
0040   ~dlgGrabKey () override;
0041   QSize sizeHint() const override;
0042   /** key is here - sent by KMuddy::eventFilter */
0043   void gotKey (int key, Qt::KeyboardModifiers state);
0044 
0045   int key() { return _key; };
0046   Qt::KeyboardModifiers state() { return _state; };
0047 protected:
0048   int _key;
0049   Qt::KeyboardModifiers _state;
0050 };
0051 
0052 #endif