4#include <QtWidgets/private/qtwidgetsglobal_p.h>
14#include <private/qeffects_p.h>
18#include <qpa/qplatformscreen.h>
19#include <qpa/qplatformcursor.h>
20#include <private/qstylesheetstyle_p.h>
23#include <QtWidgets/private/qlabel_p.h>
24#include <QtGui/private/qhighdpiscaling_p.h>
113#ifndef QT_NO_STYLE_STYLESHEET
120 styleSheetParent =
nullptr;
135 :
QLabel(
w,
Qt::ToolTip |
Qt::BypassGraphicsProxyWidget)
136#ifndef QT_NO_STYLE_STYLESHEET
151 qApp->installEventFilter(
this);
161 const qsizetype textLength =
d->needTextControl() ?
d->control->toPlainText().size() :
text().
size();
163 if (msecDisplayTime > 0)
164 time = msecDisplayTime;
171#ifndef QT_NO_STYLE_STYLESHEET
172 if (styleSheetParent){
175 styleSheetParent =
nullptr;
186 d_func()->setScreenForPoint(
pos);
257 qWarning(
"QToolTip::setTipRect: Cannot pass null widget if rect is set");
292#if defined (Q_OS_QNX) || defined (Q_OS_WASM)
333 return exact ? exact : guess;
338#ifndef QT_NO_STYLE_STYLESHEET
374 if (
p.x() +
this->width() > screenRect.
x() + screenRect.
width())
375 p.rx() -= 4 + this->
width();
376 if (p.
y() +
this->height() > screenRect.
y() + screenRect.
height())
378 if (p.
y() < screenRect.
y())
379 p.setY(screenRect.
y());
380 if (
p.x() +
this->width() > screenRect.
x() + screenRect.
width())
381 p.setX(screenRect.
x() + screenRect.
width() -
this->width());
382 if (
p.x() < screenRect.
x())
383 p.setX(screenRect.
x());
384 if (
p.y() +
this->height() > screenRect.
y() + screenRect.
height())
385 p.setY(screenRect.
y() + screenRect.
height() -
this->height());
438 localPos =
w->mapFromGlobal(
pos);
465#if QT_CONFIG(effects)
525 return *tooltip_palette();
565#include "qtooltip.moc"
static bool isEffectEnabled(Qt::UIEffect)
Returns true if effect is enabled; otherwise returns false.
static QFont font()
Returns the default application font.
static void setFont(const QFont &, const char *className=nullptr)
Changes the default application font to font.
void start(int msec, QObject *obj)
\obsolete Use chrono overload instead.
int timerId() const noexcept
Returns the timer's ID.
void stop()
Stops the timer.
bool isActive() const noexcept
Returns true if the timer is running and has not been stopped; otherwise returns false.
\reentrant \inmodule QtGui
int descent() const
Returns the descent of the font.
int ascent() const
Returns the ascent of the font.
void setFrameStyle(int)
Sets the frame style to style.
QScreen * primaryScreen
the primary (or default) screen of the application.
The QKeyEvent class describes a key event.
The QLabel widget provides a text or image display.
void setText(const QString &)
void paintEvent(QPaintEvent *) override
\reimp
void setAlignment(Qt::Alignment)
void setWordWrap(bool on)
bool wordWrap
the label's word-wrapping policy
QString text
the label's text
void mouseMoveEvent(QMouseEvent *ev) override
\reimp
QSize sizeHint() const override
\reimp
Q_WEAK_OVERLOAD void setObjectName(const QString &name)
Sets the object's name to name.
bool setProperty(const char *name, const QVariant &value)
Sets the value of the object's name property to value.
void destroyed(QObject *=nullptr)
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointe...
void deleteLater()
\threadsafe
The QPaintEvent class contains event parameters for paint events.
The QPalette class contains color groups for each widget state.
constexpr QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
\inmodule QtCore\reentrant
constexpr int y() const noexcept
Returns the y coordinate of this point.
\inmodule QtCore\reentrant
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr bool isNull() const noexcept
Returns true if the rectangle is a null rectangle, otherwise returns false.
bool contains(const QRect &r, bool proper=false) const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
The QResizeEvent class contains event parameters for resize events.
The QScreen class is used to query screen properties. \inmodule QtGui.
QRect geometry
the screen's geometry in pixels
QScreen * virtualSiblingAt(QPoint point)
Returns the screen at point within the set of \l QScreen::virtualSiblings(), or nullptr if outside of...
QPlatformScreen * handle() const
Get the platform screen handle.
QPointF position() const
Returns the position of the point in this event, relative to the widget or item that received the eve...
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
constexpr int & rheight() noexcept
Returns a reference to the height.
\macro QT_RESTRICTED_CAST_FROM_ASCII
qsizetype size() const
Returns the number of characters in this string.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
The QStyleHintReturnMask class provides style hints that return a QRegion.
\variable QStyleOptionFocusRect::backgroundColor
The QStyleOption class stores the parameters used by QStyle functions.
void initFrom(const QWidget *w)
The QStylePainter class is a convenience class for drawing QStyle elements inside a widget.
@ SH_ToolTipLabel_Opacity
@ PM_ToolTipLabelFrameWidth
void reuseTip(const QString &text, int msecDisplayTime, const QPoint &pos)
void restartExpireTimer(int msecDisplayTime)
void resizeEvent(QResizeEvent *e) override
This event handler can be reimplemented in a subclass to receive widget resize events which are passe...
void mouseMoveEvent(QMouseEvent *e) override
\reimp
void styleSheetParentDestroyed()
void hideTipImmediately()
bool tipChanged(const QPoint &pos, const QString &text, QObject *o)
void setTipRect(QWidget *w, const QRect &r)
void paintEvent(QPaintEvent *e) override
\reimp
void timerEvent(QTimerEvent *e) override
This event handler can be reimplemented in a subclass to receive timer events for the object.
void placeTip(const QPoint &pos, QWidget *w)
QTipLabel(const QString &text, const QPoint &pos, QWidget *w, int msecDisplayTime)
static QScreen * getTipScreen(const QPoint &pos, QWidget *w)
static QTipLabel * instance
bool eventFilter(QObject *, QEvent *) override
Filters events if this object has been installed as an event filter for the watched object.
void adjustTooltipScreen(const QPoint &pos)
void updateSize(const QPoint &pos)
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
object setProperty("down", true)
T fromNativePixels(const T &value, const C *context)
Combined button and popup list for selecting options.
Q_GUI_EXPORT bool mightBeRichText(const QString &)
Returns true if the string text is likely to be rich text; otherwise returns false.
void qScrollEffect(QWidget *w, QEffects::DirFlags orient, int time)
void qFadeEffect(QWidget *w, int time)
#define Q_GLOBAL_STATIC(TYPE, NAME,...)
constexpr const T & qMax(const T &a, const T &b)
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLintptr offset
QStyleSheetStyle * qt_styleSheet(QStyle *style)
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)
myObject disconnect()
[26]