File indexing completed on 2024-04-28 04:32:01
0001 /* 0002 * Copyright (C) 2009-2015 by Stephen Allewell 0003 * steve.allewell@gmail.com 0004 * 0005 * This program is free software; you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation; either version 2 of the License, or 0008 * (at your option) any later version. 0009 */ 0010 0011 #ifndef KeycodeLineEdit_H 0012 #define KeycodeLineEdit_H 0013 0014 #include <KLineEdit> 0015 #include <QString> 0016 0017 class QKeyEvent; 0018 0019 class KeycodeLineEdit : public KLineEdit 0020 { 0021 Q_OBJECT 0022 0023 public: 0024 explicit KeycodeLineEdit(QWidget *parent); 0025 0026 int key(); 0027 Qt::KeyboardModifiers modifiers(); 0028 void setKeyModifiers(int key, Qt::KeyboardModifiers modifiers); 0029 static QString keyString(int qtKey, Qt::KeyboardModifiers modifiers); 0030 0031 protected: 0032 virtual void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE; 0033 0034 private: 0035 static QString findQtText(int qtKey); 0036 int m_key; 0037 Qt::KeyboardModifiers m_modifiers; 0038 }; 0039 0040 #endif // KeycodeLineEdit_H