diff options
author | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-07-15 21:26:48 +0300 |
---|---|---|
committer | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-07-15 21:26:48 +0300 |
commit | 21185a44e723d016246af1b03a24ac787790106e (patch) | |
tree | 18ea3992c7d0266f52cb6b7980599a4a1b30651c /src | |
parent | Use MainWindow instead of QApplication::activeWindow to reference the main wi... (diff) | |
download | nheko-21185a44e723d016246af1b03a24ac787790106e.tar.xz |
Properly reset the autocomplete anchor when the popup closes
fixes #305
Diffstat (limited to 'src')
-rw-r--r-- | src/SuggestionsPopup.cpp | 6 | ||||
-rw-r--r-- | src/TextInputWidget.cc | 2 | ||||
-rw-r--r-- | src/dialogs/PreviewUploadOverlay.cc | 2 |
3 files changed, 7 insertions, 3 deletions
diff --git a/src/SuggestionsPopup.cpp b/src/SuggestionsPopup.cpp index 82b7938b..bcfcb233 100644 --- a/src/SuggestionsPopup.cpp +++ b/src/SuggestionsPopup.cpp @@ -9,8 +9,8 @@ #include <QPainter> #include <QStyleOption> -constexpr int PopupHMargin = 5; -constexpr int PopupItemMargin = 4; +constexpr int PopupHMargin = 4; +constexpr int PopupItemMargin = 3; PopupItem::PopupItem(QWidget *parent) : QWidget(parent) @@ -23,6 +23,8 @@ PopupItem::PopupItem(QWidget *parent) topLayout_ = new QHBoxLayout(this); topLayout_->setContentsMargins( PopupHMargin, PopupItemMargin, PopupHMargin, PopupItemMargin); + + setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); } void diff --git a/src/TextInputWidget.cc b/src/TextInputWidget.cc index 7ee7fa16..bb72c533 100644 --- a/src/TextInputWidget.cc +++ b/src/TextInputWidget.cc @@ -217,6 +217,7 @@ FilteredTextEdit::keyPressEvent(QKeyEvent *event) auto word = cursor.selectedText(); if (cursor.position() == 0) { + resetAnchor(); closeSuggestions(); return; } @@ -231,6 +232,7 @@ FilteredTextEdit::keyPressEvent(QKeyEvent *event) emit showSuggestions(query()); } else { + resetAnchor(); closeSuggestions(); } diff --git a/src/dialogs/PreviewUploadOverlay.cc b/src/dialogs/PreviewUploadOverlay.cc index a4e31a7a..a3fe4228 100644 --- a/src/dialogs/PreviewUploadOverlay.cc +++ b/src/dialogs/PreviewUploadOverlay.cc @@ -70,7 +70,7 @@ PreviewUploadOverlay::init() winsize = window->frameGeometry().size(); center = window->frameGeometry().center(); } else { - nhlog::ui()->warn("unable to load the retrieve MainWindow's size"); + nhlog::ui()->warn("unable to retrieve MainWindow's size"); } fileName_.setText(QFileInfo{filePath_}.fileName()); |