fix: Tooltip parenting on Windows (#5040)

Fixes #5019
This commit is contained in:
nerix
2023-12-25 18:17:25 +01:00
committed by GitHub
parent 25add89b14
commit 485fc5cdb4
2 changed files with 23 additions and 2 deletions
+22 -1
View File
@@ -10,13 +10,34 @@
// number of columns in grid mode
#define GRID_NUM_COLS 3
namespace {
#ifdef Q_OS_WIN
template <typename T>
inline constexpr T *tooltipParentFor(T * /*desiredParent*/)
{
return nullptr;
}
#else
template <typename T>
inline constexpr T *tooltipParentFor(T *desiredParent)
{
return desiredParent;
}
#endif
} // namespace
namespace chatterino {
TooltipWidget::TooltipWidget(BaseWidget *parent)
: BaseWindow({BaseWindow::TopMost, BaseWindow::DontFocus,
BaseWindow::DisableLayoutSave},
parent)
tooltipParentFor(parent))
{
assert(parent != nullptr);
QObject::connect(parent, &QObject::destroyed, this, &QObject::deleteLater);
this->setStyleSheet("color: #fff; background: rgba(11, 11, 11, 0.8)");
this->setAttribute(Qt::WA_TranslucentBackground);
this->setWindowFlag(Qt::WindowStaysOnTopHint, true);