diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp index 8aca4db58a7..d46bf3b2bf2 100644 --- a/src/widgets/kernel/qtooltip.cpp +++ b/src/widgets/kernel/qtooltip.cpp @@ -451,24 +451,16 @@ bool QTipLabel::tipChanged(const QPoint &pos, const QString &text, QObject *o) Otherwise this argument can be \nullptr but it is used to determine the appropriate screen on multi-head systems. + The \a msecDisplayTime parameter specifies for how long the tool tip + will be displayed, in milliseconds. With the default value of -1, the + time is based on the length of the text. + If \a text is empty the tool tip is hidden. If the text is the same as the currently shown tooltip, the tip will \e not move. You can force moving by first hiding the tip with an empty text, and then showing the new tip at the new position. */ -void QToolTip::showText(const QPoint &pos, const QString &text, QWidget *w, const QRect &rect) -{ - showText(pos, text, w, rect, -1); -} - -/*! - \since 5.2 - \overload - This is similar to QToolTip::showText(\a pos, \a text, \a w, \a rect) but with an extra parameter \a msecDisplayTime - that specifies how long the tool tip will be displayed, in milliseconds. -*/ - void QToolTip::showText(const QPoint &pos, const QString &text, QWidget *w, const QRect &rect, int msecDisplayTime) { if (QTipLabel::instance && QTipLabel::instance->isVisible()){ // a tip does already exist @@ -522,18 +514,6 @@ void QToolTip::showText(const QPoint &pos, const QString &text, QWidget *w, cons } } -/*! - \overload - - This is analogous to calling QToolTip::showText(\a pos, \a text, \a w, QRect()) -*/ - -void QToolTip::showText(const QPoint &pos, const QString &text, QWidget *w) -{ - QToolTip::showText(pos, text, w, QRect()); -} - - /*! \fn void QToolTip::hideText() \since 4.2 diff --git a/src/widgets/kernel/qtooltip.h b/src/widgets/kernel/qtooltip.h index 9f786bdee1d..c78e4c3251e 100644 --- a/src/widgets/kernel/qtooltip.h +++ b/src/widgets/kernel/qtooltip.h @@ -50,10 +50,8 @@ class Q_WIDGETS_EXPORT QToolTip { QToolTip() = delete; public: - // ### Qt 6 - merge the three showText functions below - static void showText(const QPoint &pos, const QString &text, QWidget *w = nullptr); - static void showText(const QPoint &pos, const QString &text, QWidget *w, const QRect &rect); - static void showText(const QPoint &pos, const QString &text, QWidget *w, const QRect &rect, int msecShowTime); + static void showText(const QPoint &pos, const QString &text, + QWidget *w = nullptr, const QRect &rect = {}, int msecShowTime = -1); static inline void hideText() { showText(QPoint(), QString()); } static bool isVisible();