Fix missing parent of tooltips for Wayland (#4998)

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
smc
2023-12-09 12:28:33 +01:00
committed by GitHub
parent 3ad2e4b30a
commit fec8f8c49f
9 changed files with 39 additions and 46 deletions
+11 -9
View File
@@ -223,6 +223,7 @@ namespace chatterino {
SplitHeader::SplitHeader(Split *split)
: BaseWidget(split)
, split_(split)
, tooltipWidget_(new TooltipWidget(this))
{
this->initializeLayout();
@@ -948,15 +949,16 @@ void SplitHeader::enterEvent(QEvent *event)
{
auto *channel = this->split_->getChannel().get();
auto *tooltip = TooltipWidget::instance();
tooltip->setOne({nullptr, this->tooltipText_});
tooltip->setWordWrap(true);
tooltip->adjustSize();
auto pos = this->mapToGlobal(this->rect().bottomLeft()) +
QPoint((this->width() - tooltip->width()) / 2, 1);
this->tooltipWidget_->setOne({nullptr, this->tooltipText_});
this->tooltipWidget_->setWordWrap(true);
this->tooltipWidget_->adjustSize();
auto pos =
this->mapToGlobal(this->rect().bottomLeft()) +
QPoint((this->width() - this->tooltipWidget_->width()) / 2, 1);
tooltip->moveTo(pos, widgets::BoundsChecking::CursorPosition);
tooltip->show();
this->tooltipWidget_->moveTo(pos,
widgets::BoundsChecking::CursorPosition);
this->tooltipWidget_->show();
}
BaseWidget::enterEvent(event);
@@ -964,7 +966,7 @@ void SplitHeader::enterEvent(QEvent *event)
void SplitHeader::leaveEvent(QEvent *event)
{
TooltipWidget::instance()->hide();
this->tooltipWidget_->hide();
BaseWidget::leaveEvent(event);
}