Fix missing parent of tooltips for Wayland (#4998)
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user