diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-03-16 00:33:33 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-03-16 13:57:55 +0530 |
| commit | 5a2a6aef3703d6aaaee24d9436da9e60ffcae769 (patch) | |
| tree | 565bfebbd41003c0e198739056d9178d279dfa6a /include | |
| parent | 387cf24e389854ecc97f6236fdd6acbc2486dd52 (diff) | |
| download | null-browser-5a2a6aef3703d6aaaee24d9436da9e60ffcae769.tar.gz null-browser-5a2a6aef3703d6aaaee24d9436da9e60ffcae769.zip | |
Fix UI issues with inputline and completer
Diffstat (limited to 'include')
| -rw-r--r-- | include/completion/Completer.hpp | 9 | ||||
| -rw-r--r-- | include/widgets/InputLine.hpp | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/include/completion/Completer.hpp b/include/completion/Completer.hpp index 9ad03d4..c1b77a6 100644 --- a/include/completion/Completer.hpp +++ b/include/completion/Completer.hpp @@ -1,6 +1,7 @@ #pragma once #include <QCompleter> +#include <QHBoxLayout> #include <QSortFilterProxyModel> #include <QWidget> #include <QtCore> @@ -15,9 +16,9 @@ class Completer : public QWidget { Q_OBJECT public: - Completer(); - void setSourceModel(QAbstractItemModel *model); + Completer(QWidget *parentNode = nullptr); + DELEGATE((&proxyModel), setSourceModel, setSourceModel) DELEGATE((&proxyModel), sourceModel, sourceModel) signals: @@ -28,12 +29,14 @@ public slots: bool onKeyPressEvent(QKeyEvent *event); protected: - void keyPressEvent(QKeyEvent *event) override { onKeyPressEvent(event); } void setHighlightedRow(uint32_t); void acceptHighlighted(); + DELEGATE(this, onKeyPressEvent, keyPressEvent) + private: QTreeView *view; FuzzySearchProxyModel proxyModel; CompleterDelegate *viewDelegate; + QHBoxLayout *layout; }; diff --git a/include/widgets/InputLine.hpp b/include/widgets/InputLine.hpp index 45aa559..d5f65be 100644 --- a/include/widgets/InputLine.hpp +++ b/include/widgets/InputLine.hpp @@ -14,6 +14,7 @@ class InputLine : public QWidget { public: InputLine(QString defaultInput = "", QWidget *parentNode = nullptr); + void setInputFocus(bool focussed); bool isInputFocussed(); void setAdapter(Adapter *adapter); @@ -37,4 +38,5 @@ private: QLineEdit *input; QLabel *promptPrefix; Adapter *adapterInstance = nullptr; + QVBoxLayout *layout; }; |
