fix(windows): show split tooltip before move (#5230)

This commit is contained in:
nerix 2024-03-09 11:27:42 +01:00 committed by GitHub
parent 26bb4e236d
commit ecad4b052a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View file

@ -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)

View file

@ -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);