servatrice/cockatrice/src/lineeditcompleter.h
Xenos6666 63b4f9b2f0
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
2020-03-16 21:48:05 -04:00

29 lines
603 B
C++

#ifndef LINEEDITCOMPLETER_H
#define LINEEDITCOMPLETER_H
#include "customlineedit.h"
#include <QFocusEvent>
#include <QKeyEvent>
#include <QStringList>
class LineEditCompleter : public LineEditUnfocusable
{
Q_OBJECT
private:
QString cursorWord(const QString &line) const;
QCompleter *c;
private slots:
void insertCompletion(QString);
protected:
void keyPressEvent(QKeyEvent *event);
void focusOutEvent(QFocusEvent *e);
public:
explicit LineEditCompleter(QWidget *parent = nullptr);
void setCompleter(QCompleter *);
void setCompletionList(QStringList);
};
#endif