mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 00:54:53 -07:00
Add keyboard shorcuts to focus and unfocus chat (#3898)
* Added keyboard shorcuts to focus and unfocus chat * Fixed format * Changed the Esc behavior to work on any QLineEdit in the main Window and ignore shortcut conflicts * Fixed a conflict with shortcuts * Configurable unfocus shortcut and format fixes * minor style fix
This commit is contained in:
parent
7285f24a29
commit
63b4f9b2f0
25 changed files with 235 additions and 107 deletions
27
cockatrice/src/customlineedit.h
Normal file
27
cockatrice/src/customlineedit.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
|
||||
#ifndef CUSTOMLINEEDIT_H
|
||||
#define CUSTOMLINEEDIT_H
|
||||
|
||||
#include <QLineEdit>
|
||||
|
||||
class QKeyEvent;
|
||||
class QWidget;
|
||||
class QString;
|
||||
|
||||
// Should be used when the there is a risk of conflict between line editor
|
||||
// shortcuts and other shortcuts
|
||||
class LineEditUnfocusable : public QLineEdit
|
||||
{
|
||||
public:
|
||||
LineEditUnfocusable(QWidget *parent = nullptr);
|
||||
LineEditUnfocusable(const QString &contents, QWidget *parent = nullptr);
|
||||
|
||||
private:
|
||||
bool isUnfocusShortcut(QKeyEvent *key);
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue