Properly reset the autocomplete anchor when the popup closes
fixes #305
This commit is contained in:
parent
fde066e236
commit
21185a44e7
@ -9,8 +9,8 @@
|
|||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QStyleOption>
|
#include <QStyleOption>
|
||||||
|
|
||||||
constexpr int PopupHMargin = 5;
|
constexpr int PopupHMargin = 4;
|
||||||
constexpr int PopupItemMargin = 4;
|
constexpr int PopupItemMargin = 3;
|
||||||
|
|
||||||
PopupItem::PopupItem(QWidget *parent)
|
PopupItem::PopupItem(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
@ -23,6 +23,8 @@ PopupItem::PopupItem(QWidget *parent)
|
|||||||
topLayout_ = new QHBoxLayout(this);
|
topLayout_ = new QHBoxLayout(this);
|
||||||
topLayout_->setContentsMargins(
|
topLayout_->setContentsMargins(
|
||||||
PopupHMargin, PopupItemMargin, PopupHMargin, PopupItemMargin);
|
PopupHMargin, PopupItemMargin, PopupHMargin, PopupItemMargin);
|
||||||
|
|
||||||
|
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -217,6 +217,7 @@ FilteredTextEdit::keyPressEvent(QKeyEvent *event)
|
|||||||
auto word = cursor.selectedText();
|
auto word = cursor.selectedText();
|
||||||
|
|
||||||
if (cursor.position() == 0) {
|
if (cursor.position() == 0) {
|
||||||
|
resetAnchor();
|
||||||
closeSuggestions();
|
closeSuggestions();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -231,6 +232,7 @@ FilteredTextEdit::keyPressEvent(QKeyEvent *event)
|
|||||||
|
|
||||||
emit showSuggestions(query());
|
emit showSuggestions(query());
|
||||||
} else {
|
} else {
|
||||||
|
resetAnchor();
|
||||||
closeSuggestions();
|
closeSuggestions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ PreviewUploadOverlay::init()
|
|||||||
winsize = window->frameGeometry().size();
|
winsize = window->frameGeometry().size();
|
||||||
center = window->frameGeometry().center();
|
center = window->frameGeometry().center();
|
||||||
} else {
|
} 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());
|
fileName_.setText(QFileInfo{filePath_}.fileName());
|
||||||
|
Loading…
Reference in New Issue
Block a user