Cockatrice 2026-10-19-Development-3.1.2-beta.2
A 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#include <qtmetamacros.h>
12
13class QTreeView;
14class QKeyEvent;
15class QWidget;
16class QString;
17
18// Should be used when the there is a risk of conflict between line editor
19// shortcuts and other shortcuts
20class LineEditUnfocusable : public QLineEdit
21{
22 Q_OBJECT
23public:
24 explicit LineEditUnfocusable(QWidget *parent = nullptr);
25 explicit LineEditUnfocusable(const QString &contents, QWidget *parent = nullptr);
26
27private:
28 static bool isUnfocusShortcut(QKeyEvent *key);
29
30protected:
31 void keyPressEvent(QKeyEvent *event) override;
32 bool eventFilter(QObject *watched, QEvent *event) override;
33};
34
36{
37private:
38 QTreeView *treeView;
39
40protected:
41 void keyPressEvent(QKeyEvent *event) override;
42
43public:
45 {
46 }
47 void setTreeView(QTreeView *_treeView)
48 {
49 treeView = _treeView;
50 }
51};
52
53#endif
static bool isUnfocusShortcut(QKeyEvent *key)
Definition custom_line_edit.cpp:28
void keyPressEvent(QKeyEvent *event) override
Definition custom_line_edit.cpp:59
bool eventFilter(QObject *watched, QEvent *event) override
Definition custom_line_edit.cpp:70
LineEditUnfocusable(QWidget *parent=nullptr)
Definition custom_line_edit.cpp:18
void keyPressEvent(QKeyEvent *event) override
Definition custom_line_edit.cpp:85
SearchLineEdit()
Definition custom_line_edit.h:44
void setTreeView(QTreeView *_treeView)
Definition custom_line_edit.h:47
QTreeView * treeView
Definition custom_line_edit.h:38