summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-04-14 14:12:36 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-04-14 14:12:36 +0300
commitca66940ec39047eada21f7900bf0e49d61cb45fb (patch)
tree5c71ab04163061e444c7146f62a356e773a97119 /include
parentBump version to v0.3.1 (diff)
downloadnheko-ca66940ec39047eada21f7900bf0e49d61cb45fb.tar.xz
Popup improvements
- ESC closes the popup.
- Up/Down arrows for navigation.
- BackTab for backwards navigation.

fixes #301
fixes #302
Diffstat (limited to 'include')
-rw-r--r--include/SuggestionsPopup.hpp16
-rw-r--r--include/TextInputWidget.h3
2 files changed, 16 insertions, 3 deletions
diff --git a/include/SuggestionsPopup.hpp b/include/SuggestionsPopup.hpp

index 80f28466..dcbe52fa 100644 --- a/include/SuggestionsPopup.hpp +++ b/include/SuggestionsPopup.hpp
@@ -62,15 +62,27 @@ public: public slots: void addUsers(const QVector<SearchResult> &users); - void cycleThroughSuggestions(); void selectHoveredSuggestion(); + //! Move to the next available suggestion item. + void selectNextSuggestion(); + //! Move to the previous available suggestion item. + void selectPreviousSuggestion(); + //! Remove hovering from all items. + void resetHovering(); + //! Set hovering to the item in the given layout position. + void setHovering(int pos); signals: void itemSelected(const QString &user); private: + void hoverSelection(); + void resetSelection() { selectedItem_ = -1; } + void selectFirstItem() { selectedItem_ = 0; } + void selectLastItem() { selectedItem_ = layout_->count() - 1; } + QVBoxLayout *layout_; //! Counter for tab completion (cycling). - int tab_clicks_; + int selectedItem_ = -1; }; diff --git a/include/TextInputWidget.h b/include/TextInputWidget.h
index 89eb5947..7a52ea77 100644 --- a/include/TextInputWidget.h +++ b/include/TextInputWidget.h
@@ -73,7 +73,8 @@ signals: //! Trigger the suggestion popup. void showSuggestions(const QString &query); void resultsRetrieved(const QVector<SearchResult> &results); - void cycleSuggestions(); + void selectNextSuggestion(); + void selectPreviousSuggestion(); void selectHoveredSuggestion(); public slots: