Place the completion popup under the search widget

This commit is contained in:
Konstantinos Sideris 2017-08-20 21:13:00 +03:00
parent 2644e4acca
commit c6ec20fa40
2 changed files with 74 additions and 27 deletions

View file

@ -17,6 +17,7 @@
#pragma once
#include <QAbstractItemView>
#include <QFrame>
#include <QKeyEvent>
#include <QVBoxLayout>
@ -29,8 +30,14 @@ class RoomSearchInput : public TextField
public:
explicit RoomSearchInput(QWidget *parent = nullptr);
signals:
void selectNextCompletion();
void selectPreviousCompletion();
void hiding();
protected:
void keyPressEvent(QKeyEvent *event) override;
void hideEvent(QHideEvent *event) override;
bool focusNextPrevChild(bool next) override;
};
@ -51,8 +58,12 @@ protected:
void showEvent(QShowEvent *event) override;
private:
// Current highlighted selection from the completer.
int selection_ = -1;
QVBoxLayout *topLayout_;
RoomSearchInput *roomSearch_;
QCompleter *completer_;
QMap<QString, QString> rooms_;
};