summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qwidget.cpp
diff options
context:
space:
mode:
authorChristian Ehrlicher <[email protected]>2025-12-05 17:32:54 +0100
committerChristian Ehrlicher <[email protected]>2025-12-15 06:16:20 +0100
commit252efacb0604675044f6022fbcbbc0f14f9eaa55 (patch)
tree3797e1be89411f15e72aa8a4f3cd08df9ad92f34 /src/widgets/kernel/qwidget.cpp
parentfb9f4444fa716f6aa93d3d13d3037b30c005d7a7 (diff)
QToolTip: use qobject_cast<>/metaObject instead string compare
Use qobject_cast<> or the comparision of the QTipLabel staticMetaObject pointer to determine if the object is a QTipLabel instead relying on a string compare. This will give us a compile time error when the name of this internal class changes or goes away. Pick-to: 6.11 6.10 6.8 Change-Id: Ie54342bd87fcb6688f082268464bfda5134de04c Reviewed-by: Volker Hilsheimer <[email protected]>
Diffstat (limited to 'src/widgets/kernel/qwidget.cpp')
-rw-r--r--src/widgets/kernel/qwidget.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 9499c88af12..bd2b5be11aa 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -32,7 +32,7 @@
#include "private/qwidgetwindow_p.h"
#include "qpainter.h"
#if QT_CONFIG(tooltip)
-#include "qtooltip.h"
+#include "private/qtooltip_p.h"
#endif
#if QT_CONFIG(whatsthis)
#include "qwhatsthis.h"
@@ -1435,7 +1435,9 @@ void QWidgetPrivate::createTLSysExtra()
if (extra->topextra->opacity != 255 && q->isWindow())
extra->topextra->window->setOpacity(qreal(extra->topextra->opacity) / qreal(255));
- const bool isTipLabel = q->inherits("QTipLabel");
+#if QT_CONFIG(tooltip)
+ const bool isTipLabel = qobject_cast<const QTipLabel *>(q) != nullptr;
+#endif
const bool isAlphaWidget = !isTipLabel && q->inherits("QAlphaWidget");
#ifdef Q_OS_WIN
// Pass on native parent handle for Widget embedded into Active X.