From ecad4b052a436c451d7a4d16a92e0f0b1faa2a05 Mon Sep 17 00:00:00 2001 From: nerix Date: Sat, 9 Mar 2024 11:27:42 +0100 Subject: [PATCH] fix(windows): show split tooltip before move (#5230) --- CHANGELOG.md | 1 + src/widgets/splits/SplitHeader.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca00c7a07..c19f6056a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -98,6 +98,7 @@ - Bugfix: Fixed link info not updating without moving the cursor. (#5178) - Bugfix: Fixed an upload sometimes failing when copying an image from a browser if it contained extra properties. (#5156) - Bugfix: Fixed tooltips getting out of bounds when loading images. (#5186) +- Bugfix: Fixed split header tooltips showing in the wrong position on Windows. (#5230) - Bugfix: Fixed split header tooltips appearing too tall. (#5232) - Dev: Run miniaudio in a separate thread, and simplify it to not manage the device ourselves. There's a chance the simplification is a bad idea. (#4978) - Dev: Change clang-format from v14 to v16. (#4929) diff --git a/src/widgets/splits/SplitHeader.cpp b/src/widgets/splits/SplitHeader.cpp index 8f105320f..7e27ad16b 100644 --- a/src/widgets/splits/SplitHeader.cpp +++ b/src/widgets/splits/SplitHeader.cpp @@ -950,13 +950,27 @@ void SplitHeader::enterEvent(QEvent *event) this->tooltipWidget_->setOne({nullptr, this->tooltipText_}); this->tooltipWidget_->setWordWrap(true); this->tooltipWidget_->adjustSize(); + + // On Windows, a lot of the resizing/activating happens when calling + // show() and calling it doesn't synchronously create a visible window, + // so moving the window won't cause the visible window to jump. + // + // On other platforms, this isn't the case, hence we call show() after + // moving. +#ifdef Q_OS_WIN + this->tooltipWidget_->show(); +#endif + auto pos = this->mapToGlobal(this->rect().bottomLeft()) + QPoint((this->width() - this->tooltipWidget_->width()) / 2, 1); this->tooltipWidget_->moveTo(pos, widgets::BoundsChecking::CursorPosition); + +#ifndef Q_OS_WIN this->tooltipWidget_->show(); +#endif } BaseWidget::enterEvent(event);