mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-17 12:02:48 +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_ ++;
|
order_arrived_counter_ ++;
|
||||||
|
|
||||||
if (!closed_since_search_began_)
|
if (!closed_since_search_began_) {
|
||||||
RepositionPopup();
|
RepositionPopup();
|
||||||
|
UpdateTooltipPosition();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalSearchWidget::RepositionPopup() {
|
void GlobalSearchWidget::RepositionPopup() {
|
||||||
@ -690,12 +692,25 @@ void GlobalSearchWidget::UpdateTooltip() {
|
|||||||
tooltip_->SetActions(actions_);
|
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 QRect item_rect = view_->visualRect(current);
|
||||||
const QPoint popup_pos = item_rect.topRight() +
|
const QPoint popup_pos = item_rect.topRight() +
|
||||||
QPoint(-GlobalSearchTooltip::kArrowWidth,
|
QPoint(-GlobalSearchTooltip::kArrowWidth,
|
||||||
item_rect.height() / 2);
|
item_rect.height() / 2);
|
||||||
|
|
||||||
tooltip_->SetResults(results);
|
|
||||||
tooltip_->ShowAt(view_->mapToGlobal(popup_pos));
|
tooltip_->ShowAt(view_->mapToGlobal(popup_pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,6 +99,7 @@ private slots:
|
|||||||
|
|
||||||
void HidePopup();
|
void HidePopup();
|
||||||
void UpdateTooltip();
|
void UpdateTooltip();
|
||||||
|
void UpdateTooltipPosition();
|
||||||
|
|
||||||
void SwapModels();
|
void SwapModels();
|
||||||
|
|
||||||
|
@ -4542,7 +4542,7 @@ msgstr ""
|
|||||||
msgid "does not contain"
|
msgid "does not contain"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: globalsearch/globalsearchwidget.cpp:711
|
#: globalsearch/globalsearchwidget.cpp:726
|
||||||
msgid "e.g."
|
msgid "e.g."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user