Simplify ordering of stories tooltip.

This commit is contained in:
John Preston 2023-07-28 12:10:01 +04:00
parent fcd1062d78
commit 7d1725b339
5 changed files with 20 additions and 12 deletions

View File

@ -1386,6 +1386,15 @@ void Widget::jumpToTop(bool belowPinned) {
}
}
void Widget::raiseWithTooltip() {
raise();
if (_stories) {
Ui::PostponeCall(this, [=] {
_stories->raiseTooltip();
});
}
}
void Widget::scrollToDefault(bool verytop) {
if (verytop) {
//_scroll->verticalScrollBar()->setMinimum(0);

View File

@ -98,6 +98,7 @@ public:
void setInnerFocus();
void jumpToTop(bool belowPinned = false);
void raiseWithTooltip();
void startWidthAnimation();
void stopWidthAnimation();

View File

@ -957,21 +957,11 @@ void List::setShowTooltip(
using namespace base;
using Event = not_null<QEvent*>;
install_event_filter(tooltip, tooltipParent, [=](Event e) {
if ((e->type() == QEvent::Move)
|| (e->type() == QEvent::ChildAdded)
|| (e->type() == QEvent::ChildRemoved)) {
if (e->type() == QEvent::ChildAdded) {
recompute();
}
return EventFilterResult::Continue;
});
for (const auto &child : tooltipParent->children()) {
install_event_filter(tooltip, child, [=](Event e) {
if (e->type() == QEvent::ZOrderChange) {
recompute();
}
return EventFilterResult::Continue;
});
}
}
rpl::combine(
@ -993,6 +983,12 @@ void List::setShowTooltip(
}, tooltip->lifetime());
}
void List::raiseTooltip() {
if (_tooltip) {
_tooltip->raise();
}
}
void List::toggleTooltip(bool fast) {
const auto shown = !_expanded
&& !_expandedAnimation.animating()

View File

@ -77,6 +77,8 @@ public:
not_null<QWidget*> tooltipParent,
rpl::producer<bool> shown,
Fn<void()> hide);
void raiseTooltip();
struct CollapsedGeometry {
QRect geometry;
float64 expanded = 0.;

View File

@ -1926,7 +1926,7 @@ void MainWidget::showBackFromStack(
void MainWidget::orderWidgets() {
if (_dialogs) {
_dialogs->raise();
_dialogs->raiseWithTooltip();
}
if (_player) {
_player->raise();