Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
custom_line_edit.h
Go to the documentation of this file.
1
6
7#ifndef CUSTOMLINEEDIT_H
8#define CUSTOMLINEEDIT_H
9
10#include <QLineEdit>
11
12class QTreeView;
13class QKeyEvent;
14class QWidget;
15class QString;
16
17// Should be used when the there is a risk of conflict between line editor
18// shortcuts and other shortcuts
19class LineEditUnfocusable : public QLineEdit
20{
21 Q_OBJECT
22public:
23 explicit LineEditUnfocusable(QWidget *parent = nullptr);
24 explicit LineEditUnfocusable(const QString &contents, QWidget *parent = nullptr);
25
26private:
27 static bool isUnfocusShortcut(QKeyEvent *key);
28
29protected:
30 void keyPressEvent(QKeyEvent *event) override;
31 bool eventFilter(QObject *watched, QEvent *event) override;
32};
33
35{
36private:
37 QTreeView *treeView;
38
39protected:
40 void keyPressEvent(QKeyEvent *event) override;
41
42public:
44 {
45 }
46 void setTreeView(QTreeView *_treeView)
47 {
48 treeView = _treeView;
49 }
50};
51
52#endif
static bool isUnfocusShortcut(QKeyEvent *key)
Definition custom_line_edit.cpp:22
void keyPressEvent(QKeyEvent *event) override
Definition custom_line_edit.cpp:48
bool eventFilter(QObject *watched, QEvent *event) override
Definition custom_line_edit.cpp:59
LineEditUnfocusable(QWidget *parent=nullptr)
Definition custom_line_edit.cpp:12
void keyPressEvent(QKeyEvent *event) override
Definition custom_line_edit.cpp:74
SearchLineEdit()
Definition custom_line_edit.h:43
void setTreeView(QTreeView *_treeView)
Definition custom_line_edit.h:46
QTreeView * treeView
Definition custom_line_edit.h:37