Cockatrice/cockatrice/src/deck/custom_line_edit.h
Lukas Brübach 12b4d2e1c5 Sort *every* file into a doxygen group.
Took 7 hours 9 minutes

Took 18 seconds

Took 2 minutes
2025-09-30 12:02:12 +02:00

52 lines
1 KiB
C++

/**
* @file custom_line_edit.h
* @ingroup UI
* @brief TODO: Document this.
*/
#ifndef CUSTOMLINEEDIT_H
#define CUSTOMLINEEDIT_H
#include <QLineEdit>
class QTreeView;
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
{
Q_OBJECT
public:
explicit LineEditUnfocusable(QWidget *parent = nullptr);
explicit LineEditUnfocusable(const QString &contents, QWidget *parent = nullptr);
private:
static bool isUnfocusShortcut(QKeyEvent *key);
protected:
void keyPressEvent(QKeyEvent *event) override;
bool eventFilter(QObject *watched, QEvent *event) override;
};
class SearchLineEdit : public LineEditUnfocusable
{
private:
QTreeView *treeView;
protected:
void keyPressEvent(QKeyEvent *event) override;
public:
SearchLineEdit() : treeView(nullptr)
{
}
void setTreeView(QTreeView *_treeView)
{
treeView = _treeView;
}
};
#endif