mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-17 03:45:56 +01:00
Reposition the global search tooltip when new results arrive
This commit is contained in:
parent
3d8c0046a8
commit
ec5f9be27b
@ -310,8 +310,10 @@ void GlobalSearchWidget::AddResults(int id, const SearchProvider::ResultList& re
|
||||
|
||||
order_arrived_counter_ ++;
|
||||
|
||||
if (!closed_since_search_began_)
|
||||
if (!closed_since_search_began_) {
|
||||
RepositionPopup();
|
||||
UpdateTooltipPosition();
|
||||
}
|
||||
}
|
||||
|
||||
void GlobalSearchWidget::RepositionPopup() {
|
||||
@ -690,12 +692,25 @@ void GlobalSearchWidget::UpdateTooltip() {
|
||||
tooltip_->SetActions(actions_);
|
||||
}
|
||||
|
||||
tooltip_->SetResults(results);
|
||||
UpdateTooltipPosition();
|
||||
}
|
||||
|
||||
void GlobalSearchWidget::UpdateTooltipPosition() {
|
||||
if (!tooltip_ || !view_->isVisible())
|
||||
return;
|
||||
|
||||
const QModelIndex current = view_->selectionModel()->currentIndex();
|
||||
if (!current.isValid()) {
|
||||
tooltip_->hide();
|
||||
return;
|
||||
}
|
||||
|
||||
const QRect item_rect = view_->visualRect(current);
|
||||
const QPoint popup_pos = item_rect.topRight() +
|
||||
QPoint(-GlobalSearchTooltip::kArrowWidth,
|
||||
item_rect.height() / 2);
|
||||
|
||||
tooltip_->SetResults(results);
|
||||
tooltip_->ShowAt(view_->mapToGlobal(popup_pos));
|
||||
}
|
||||
|
||||
|
@ -99,6 +99,7 @@ private slots:
|
||||
|
||||
void HidePopup();
|
||||
void UpdateTooltip();
|
||||
void UpdateTooltipPosition();
|
||||
|
||||
void SwapModels();
|
||||
|
||||
|
@ -4542,7 +4542,7 @@ msgstr ""
|
||||
msgid "does not contain"
|
||||
msgstr ""
|
||||
|
||||
#: globalsearch/globalsearchwidget.cpp:711
|
||||
#: globalsearch/globalsearchwidget.cpp:726
|
||||
msgid "e.g."
|
||||
msgstr ""
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user