Merge QToolTip::showText overloads as per ### Qt 6 comments

Change-Id: Ic156fed27bd535daf828e5d95049591833614307
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This commit is contained in:
Volker Hilsheimer 2020-06-08 17:31:10 +02:00
parent ea09e2f466
commit fa5ae76356
2 changed files with 6 additions and 28 deletions

View File

@ -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

View File

@ -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();