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>
122#ifndef QT_NO_STYLE_STYLESHEET
129 styleSheetParent =
nullptr;
144 :
QLabel(
w,
Qt::ToolTip |
Qt::BypassGraphicsProxyWidget)
145#ifndef QT_NO_STYLE_STYLESHEET
160 qApp->installEventFilter(
this);
170 const qsizetype textLength =
d->needTextControl() ?
d->control->toPlainText().size() :
text().
size();
172 if (msecDisplayTime > 0)
173 time = msecDisplayTime;
180#ifndef QT_NO_STYLE_STYLESHEET
181 if (styleSheetParent){
184 styleSheetParent =
nullptr;
195 d_func()->setScreenForPoint(
pos);
200 if (fm.descent() == 2 && fm.ascent() >= 11)
266 qWarning(
"QToolTip::setTipRect: Cannot pass null widget if rect is set");
301#if defined (Q_OS_QNX) || defined (Q_OS_WASM)
343 return exact ? exact : guess;
348#ifndef QT_NO_STYLE_STYLESHEET
380 if (cursorSize.height() > 2 *
this->height())
386 if (
p.x() +
this->width() > screenRect.
x() + screenRect.
width())
387 p.rx() -= 4 + this->
width();
388 if (p.
y() +
this->height() > screenRect.
y() + screenRect.
height())
390 if (p.
y() < screenRect.
y())
391 p.setY(screenRect.
y());
392 if (
p.x() +
this->width() > screenRect.
x() + screenRect.
width())
393 p.setX(screenRect.
x() + screenRect.
width() -
this->width());
394 if (
p.x() < screenRect.
x())
395 p.setX(screenRect.
x());
396 if (
p.y() +
this->height() > screenRect.
y() + screenRect.
height())
397 p.setY(screenRect.
y() + screenRect.
height() -
this->height());
450 localPos =
w->mapFromGlobal(
pos);
460 if (!
text.isEmpty()) {
477#if QT_CONFIG(effects)
537 return *tooltip_palette();
577#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.
Type type() const
Returns the event type.
\reentrant \inmodule QtGui
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
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 globalPosition() const
Returns the position of the point in this event on the screen or virtual desktop.
QPointF position() const
Returns the position of the point in this event, relative to the widget or item that received the eve...
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 noexcept
Returns the number of characters in this string.
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
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
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)
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 >
T fromNativePixels(const T &value, const C *context)
Combined button and popup list for selecting options.
Q_GUI_EXPORT bool mightBeRichText(QAnyStringView)
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]
args<< 1<< 2;QJSValue threeAgain=fun.call(args);QString fileName="helloworld.qs";QFile scriptFile(fileName);if(!scriptFile.open(QIODevice::ReadOnly)) QTextStream stream(&scriptFile);QString contents=stream.readAll();scriptFile.close();myEngine.evaluate(contents, fileName);myEngine.globalObject().setProperty("myNumber", 123);...QJSValue myNumberPlusOne=myEngine.evaluate("myNumber + 1");QJSValue result=myEngine.evaluate(...);if(result.isError()) qDebug()<< "Uncaught exception at line"<< result.property("lineNumber").toInt()<< ":"<< result.toString();QPushButton *button=new QPushButton;QJSValue scriptButton=myEngine.newQObject(button);myEngine.globalObject().setProperty("button", scriptButton);myEngine.evaluate("button.checkable = true");qDebug()<< scriptButton.property("checkable").toBool();scriptButton.property("show").call();QJSEngine engine;QObject *myQObject=new QObject();myQObject- setProperty)("dynamicProperty", 3)