blob: a382ff8ecd9ed0f700cf8c871f5311b14ef3923f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#pragma once
#include <QBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QWidget>
#include <QtCore>
#include "completion/Adapter.hpp"
#include "utils.hpp"
class InputLine : public QWidget {
Q_OBJECT
public:
InputLine(QString defaultInput = "", QWidget *parentNode = nullptr);
void setInputFocus(bool focussed);
bool isInputFocussed();
void setAdapter(Adapter *adapter);
DELEGATE(input, hasFocus, isInputFocussed)
DELEGATE(input, setText, setInputText)
DELEGATE(input, text, getInputText)
DELEGATE(promptPrefix, text, prompt)
signals:
void submitted(QString text);
void cancelled();
protected:
void keyPressEvent(QKeyEvent *event) override;
void emitSubmit();
private:
QLineEdit *input;
QLabel *promptPrefix;
Adapter *adapterInstance = nullptr;
QVBoxLayout *layout;
};
|