Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquicktooltip.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
10
11#include <QtCore/qbasictimer.h>
12#include <QtQml/qqmlinfo.h>
13#include <QtQml/qqmlengine.h>
14#include <QtQml/qqmlcontext.h>
15#include <QtQml/qqmlcomponent.h>
16#include <QtQuick/qquickwindow.h>
17
19
20/*!
21 \qmltype ToolTip
22 \inherits Popup
23//! \nativetype QQuickToolTip
24 \inqmlmodule QtQuick.Controls
25 \since 5.7
26 \ingroup qtquickcontrols-popups
27 \brief Provides tool tips for any control.
28
29 A tool tip is a short piece of text that informs the user of a control's
30 function. It is typically placed above or below the parent control. The
31 tip text can be any \l{Rich Text Processing}{rich text} formatted string.
32
33 \image qtquickcontrols-tooltip.png
34 {Tooltip displaying helpful text}
35
36 \section2 Attached Tool Tips
37
38 The most straight-forward way to setup tool tips for controls is to
39 specify \l text and \l {visible}{visibility} via attached properties.
40 The following example illustrates this approach:
41
42 \snippet qtquickcontrols-tooltip.qml 1
43
44 Under normal circumstances, there is only one tool tip visible at a time.
45 In order to save resources, all items that use the ToolTip attached property
46 share the same visual tool tip label instance. Even though the visuals are
47 shared, \c text, \c timeout and \c delay are stored individually for each item
48 that uses the respective attached property. However, multiple items cannot
49 make the shared tool tip visible at the same time. The shared tool tip is only
50 shown for the last item that made it visible. The position of the shared tool
51 tip is determined by the framework.
52
53 \include qquicktooltip.qdocinc customize-note
54
55 \section2 Delay and Timeout
56
57 Tool tips are typically transient in a sense that they are shown as a
58 result of a certain external event or user interaction, and they usually
59 hide after a certain timeout. It is possible to control the delay when
60 a tool tip is shown, and the timeout when it is hidden. This makes it
61 possible to implement varying strategies for showing and hiding tool tips.
62
63 For example, on touch screens, it is a common pattern to show a tool tip
64 as a result of pressing and holding down a button. The following example
65 demonstrates how to delay showing a tool tip until the press-and-hold
66 interval is reached. In this example, the tool tip hides as soon as the
67 button is released.
68
69 \snippet qtquickcontrols-tooltip-pressandhold.qml 1
70
71 With pointer devices, however, it might be desired to show a tool tip as
72 a result of hovering a button for a while. The following example presents
73 how to show a tool tip after hovering a button for a second, and hide it
74 after a timeout of five seconds.
75
76 \snippet qtquickcontrols-tooltip-hover.qml 1
77
78 \section2 Custom Tool Tips
79
80 Should one need more fine-grained control over the tool tip position, or
81 multiple simultaneous tool tip instances are needed, it is also possible
82 to create local tool tip instances. This way, it is possible to
83 \l {Customizing ToolTip}{customize} the tool tip, and the whole \l Popup
84 API is available. The following example presents a tool tip that presents
85 the value of a slider when the handle is dragged.
86
87 \image qtquickcontrols-tooltip-slider.png
88 {Tooltip attached to slider showing current value}
89
90 \snippet qtquickcontrols-tooltip-slider.qml 1
91
92 \sa {Customizing ToolTip}, {Popup Controls},
93 {QtQuick.Controls::Popup::closePolicy}{closePolicy}
94*/
95
96// These enable auto tests to test the default behaviour of delay and timeout when using
97// the automatic policy, while also shortening their execution time.
98#ifdef QT_BUILD_INTERNAL
99Q_CONSTINIT Q_AUTOTEST_EXPORT
100#else
101// Can't be constexpr because we set it in our constructor (which we have to do because
102// toolTipWakeUpDelay() is not constexpr).
103static
104#endif
106
107#ifdef QT_BUILD_INTERNAL
108Q_CONSTINIT Q_AUTOTEST_EXPORT
109#else
110constexpr
111#endif
113
115{
116 Q_DECLARE_PUBLIC(QQuickToolTip)
117
118public:
120
122 void stopDelay();
123
126
128
129 QPalette defaultPalette() const override { return QQuickTheme::palette(QQuickTheme::ToolTip); }
130
131 int delay = 0;
132 int timeout = -1;
136};
137
138QQuickToolTipPrivate::QQuickToolTipPrivate()
139{
140 windowFlags = Qt::ToolTip;
141 if (qt_quicktooltipattachedprivate_delay == -1)
142 qt_quicktooltipattachedprivate_delay = qGuiApp->styleHints()->toolTipWakeUpDelay();
143}
144
146{
147 Q_Q(QQuickToolTip);
148 if (delay > 0)
149 delayTimer.start(delay, q);
150}
151
153{
154 delayTimer.stop();
155}
156
158{
159 Q_Q(QQuickToolTip);
160 if (timeout > 0)
161 timeoutTimer.start(timeout, q);
162}
163
165{
166 timeoutTimer.stop();
167}
168
170{
171 QQuickPopupPrivate::opened();
173}
174
175QQuickToolTip::QQuickToolTip(QQuickItem *parent)
176 : QQuickPopup(*(new QQuickToolTipPrivate), parent)
177{
178 Q_D(QQuickToolTip);
179 d->allowVerticalFlip = true;
180 d->allowHorizontalFlip = true;
181 d->popupItem->setHoverEnabled(false); // QTBUG-63644
182}
183
184/*!
185 \qmlproperty string QtQuick.Controls::ToolTip::text
186
187 This property holds the text shown on the tool tip.
188*/
189QString QQuickToolTip::text() const
190{
191 Q_D(const QQuickToolTip);
192 return d->text;
193}
194
195void QQuickToolTip::setText(const QString &text)
196{
197 Q_D(QQuickToolTip);
198 if (d->text == text)
199 return;
200
201 d->text = text;
202 maybeSetAccessibleName(text);
203 emit textChanged();
204}
205
206/*!
207 \qmlproperty int QtQuick.Controls::ToolTip::delay
208
209 This property holds the delay (milliseconds) after which the tool tip is
210 shown. A tooltip with a negative delay is shown immediately. The default
211 value is \c 0.
212
213 \sa {Delay and Timeout}
214*/
215int QQuickToolTip::delay() const
216{
217 Q_D(const QQuickToolTip);
218 return d->delay;
219}
220
221void QQuickToolTip::setDelay(int delay)
222{
223 Q_D(QQuickToolTip);
224 if (d->delay == delay)
225 return;
226
227 d->delay = delay;
228 emit delayChanged();
229}
230
231/*!
232 \qmlproperty int QtQuick.Controls::ToolTip::timeout
233
234 This property holds the timeout (milliseconds) after which the tool tip is
235 hidden. A tooltip with a negative timeout does not hide automatically. The
236 default value is \c -1.
237
238 \sa {Delay and Timeout}
239*/
240int QQuickToolTip::timeout() const
241{
242 Q_D(const QQuickToolTip);
243 return d->timeout;
244}
245
246void QQuickToolTip::setTimeout(int timeout)
247{
248 Q_D(QQuickToolTip);
249 if (d->timeout == timeout)
250 return;
251
252 d->timeout = timeout;
253
254 if (timeout <= 0)
255 d->stopTimeout();
256 else if (isOpened())
257 d->startTimeout();
258
259 emit timeoutChanged();
260}
261
262void QQuickToolTip::setVisible(bool visible)
263{
264 Q_D(QQuickToolTip);
265 if (visible) {
266 if (!d->visible) {
267 // We are being made visible, and we weren't before.
268 if (d->delay > 0) {
269 d->startDelay();
270 return;
271 }
272 }
273 } else {
274 d->stopDelay();
275 }
276 QQuickPopup::setVisible(visible);
277}
278
279QQuickToolTipAttached *QQuickToolTip::qmlAttachedProperties(QObject *object)
280{
281 return new QQuickToolTipAttached(object);
282}
283
284/*!
285 \since QtQuick.Controls 2.5 (Qt 5.12)
286 \qmlmethod void QtQuick.Controls::ToolTip::show(string text, int timeout)
287
288 This method shows the \a text as a tooltip, which times out in
289 \a timeout (milliseconds).
290*/
291void QQuickToolTip::show(const QString &text, int ms)
292{
293 if (ms >= 0)
294 setTimeout(ms);
295 setText(text);
296 open();
297}
298
299/*!
300 \since QtQuick.Controls 2.5 (Qt 5.12)
301 \qmlmethod void QtQuick.Controls::ToolTip::hide()
302
303 This method hides the tooltip.
304*/
305void QQuickToolTip::hide()
306{
307 close();
308}
309
310QFont QQuickToolTip::defaultFont() const
311{
312 return QQuickTheme::font(QQuickTheme::ToolTip);
313}
314
315void QQuickToolTip::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data)
316{
317 Q_D(QQuickToolTip);
318 QQuickPopup::itemChange(change, data);
319 if (change == QQuickItem::ItemVisibleHasChanged) {
320 if (!data.boolValue)
321 d->stopTimeout();
322
323 QQuickToolTipAttached *attached = qobject_cast<QQuickToolTipAttached *>(qmlAttachedPropertiesObject<QQuickToolTip>(d->parentItem, false));
324 if (attached)
325 emit attached->visibleChanged();
326 }
327}
328
329void QQuickToolTip::timerEvent(QTimerEvent *event)
330{
331 Q_D(QQuickToolTip);
332 if (event->timerId() == d->timeoutTimer.timerId()) {
333 d->stopTimeout();
334 QQuickPopup::setVisible(false);
335 return;
336 }
337 if (event->timerId() == d->delayTimer.timerId()) {
338 d->stopDelay();
339 QQuickPopup::setVisible(true);
340 return;
341 }
342 QQuickPopup::timerEvent(event);
343}
344
345#if QT_CONFIG(accessibility)
346QAccessible::Role QQuickToolTip::accessibleRole() const
347{
348 return QAccessible::ToolTip;
349}
350
351void QQuickToolTip::accessibilityActiveChanged(bool active)
352{
353 Q_D(QQuickToolTip);
354 QQuickPopup::accessibilityActiveChanged(active);
355
356 if (active)
357 maybeSetAccessibleName(d->text);
358}
359#endif
360
361QQuickToolTip *QQuickToolTipAttachedPrivate::instance(bool create) const
362{
363 QQmlEngine *engine = qmlEngine(parent);
364 if (!engine)
365 return nullptr;
366
367 // QQuickAttachedPropertyPropagator uses "_q_QQuickToolTip", so we add "shared_"
368 // to make this unique.
369 static const char *name = "_q_shared_QQuickToolTip";
370
371 QQuickToolTip *tip = engine->property(name).value<QQuickToolTip *>();
372 if (!tip && create) {
373 QQmlComponent component(engine, "QtQuick.Controls", "ToolTip");
374
375 QObject *object = component.create();
376 if (object)
377 object->setParent(engine);
378
379 tip = qobject_cast<QQuickToolTip *>(object);
380 if (!tip)
381 delete object;
382 else
383 engine->setProperty(name, QVariant::fromValue(object));
384 }
385 return tip;
386}
387
388void QQuickToolTipAttachedPrivate::maybeSetVisibleImplicitly(
389 const QObject *attachee, bool visible)
390{
391 auto *toolTipAttached = qobject_cast<QQuickToolTipAttached *>(
392 qmlAttachedPropertiesObject<QQuickToolTip>(attachee, false));
393 // Not using an attached tool tip.
394 if (!toolTipAttached)
395 return;
396
397 auto *toolTipAttachedPrivate = toolTipAttached->d_func();
398 // Don't interfere if the user has set ToolTip.visible explicitly or if they've
399 // set a manual policy.
400 if (toolTipAttachedPrivate->isVisibleExplicitlySet()
401 || toolTipAttachedPrivate->policy == QQuickToolTip::Manual) {
402 return;
403 }
404
405 // Don't show ourselves if we have no text. We save calling code having to get our text and
406 // instead just test it here.
407 const bool effectiveVisible = visible ? visible && !toolTipAttachedPrivate->text.isEmpty() : false;
408 toolTipAttachedPrivate->setVisible(effectiveVisible, QQml::PropertyUtils::State::ImplicitlySet);
409}
410
411void QQuickToolTipAttachedPrivate::setVisible(bool visible, QQml::PropertyUtils::State propertyState)
412{
413 Q_Q(QQuickToolTipAttached);
414 if (warnIfAttacheeIsNotAnItem(QStringLiteral("setVisible")))
415 return;
416
417 explicitVisible = isExplicitlySet(propertyState);
418
419 if (!complete && visible) {
420 pendingShow = true;
421 return;
422 }
423
424 if (visible)
425 q->show(text);
426 else
427 q->hide();
428}
429
430bool QQuickToolTipAttachedPrivate::isVisibleExplicitlySet() const
431{
432 return explicitVisible;
433}
434
435void QQuickToolTipAttachedPrivate::setDelay(int delay, QQml::PropertyUtils::State propertyState)
436{
437 Q_Q(QQuickToolTipAttached);
438 if (warnIfAttacheeIsNotAnItem(QStringLiteral("setDelay")))
439 return;
440
441 explicitDelay = isExplicitlySet(propertyState);
442
443 if (this->delay == delay)
444 return;
445
446 this->delay = delay;
447 emit q->delayChanged();
448
449 if (q->isVisible())
450 instance(true)->setDelay(delay);
451}
452
453bool QQuickToolTipAttachedPrivate::isDelayExplicitlySet() const
454{
455 return explicitDelay;
456}
457
458void QQuickToolTipAttachedPrivate::setTimeout(int timeout, QQml::PropertyUtils::State propertyState)
459{
460 Q_Q(QQuickToolTipAttached);
461 if (warnIfAttacheeIsNotAnItem(QStringLiteral("setTimeout")))
462 return;
463
464 explicitTimeout = isExplicitlySet(propertyState);
465
466 if (this->timeout == timeout)
467 return;
468
469 this->timeout = timeout;
470 emit q->timeoutChanged();
471
472 if (q->isVisible())
473 instance(true)->setTimeout(timeout);
474}
475
476bool QQuickToolTipAttachedPrivate::isTimeoutExplicitlySet() const
477{
478 return explicitTimeout;
479}
480
481void QQuickToolTipAttachedPrivate::inheritPolicy(QQuickToolTip::Policy policy)
482{
483 Q_Q(QQuickToolTipAttached);
484 if (this->policy == policy)
485 return;
486
487 this->policy = policy;
488 propagatePolicy();
489 emit q->policyChanged();
490}
491
492void QQuickToolTipAttachedPrivate::propagatePolicy()
493{
494 Q_Q(QQuickToolTipAttached);
495 const auto attachedToolTipChildren = q->attachedChildren();
496 for (QtPrivate::QQuickAttachedPropertyPropagator *child : attachedToolTipChildren) {
497 auto *attachedToolTipChild = qobject_cast<QQuickToolTipAttached *>(child);
498 if (attachedToolTipChild)
499 attachedToolTipChild->d_func()->inheritPolicy(policy);
500 }
501}
502
503/*!
504 \internal
505
506 We used to warn that the ToolTip attached property must be attached to an object deriving
507 from Item. That made sense before the introduction of ToolTip.policy, but now we need to
508 be able to set a policy on e.g. ApplicationWindow and have it propagate down to the rest
509 of the scene. So instead of warning in the constructor, we warn in the individual functions.
510*/
511bool QQuickToolTipAttachedPrivate::warnIfAttacheeIsNotAnItem(const QString &functionName)
512{
513 QQuickItem *item = qobject_cast<QQuickItem *>(parent);
514 if (Q_LIKELY(item))
515 return false;
516
517 qmlWarning(parent).nospace().noquote() << "The attached function ToolTip::" << functionName
518 << " can only be called when the attachee derives from Item";
519 return true;
520}
521
522int QQuickToolTipAttachedPrivate::calculateTimeout(const QString &text)
523{
524 if (Q_UNLIKELY(qt_quicktooltipattachedprivate_short_timeout)) {
525 // For auto tests, to ensure that the default automatic timeout works.
526 return 123;
527 }
528
529 // Based on QTipLabel::restartExpireTimer.
530 return 10000 + 40 * qMax(0, text.length() - 100);
531}
532
533QQuickToolTipAttached::QQuickToolTipAttached(QObject *parent)
534 : QtPrivate::QQuickAttachedPropertyPropagator(*(new QQuickToolTipAttachedPrivate), parent)
535{
536 initialize();
537}
538
539/*!
540 \qmlattachedproperty string QtQuick.Controls::ToolTip::text
541
542 This attached property holds the text of the shared tool tip.
543 The property can be attached to any item.
544
545 \sa {Attached Tool Tips}
546*/
547QString QQuickToolTipAttached::text() const
548{
549 Q_D(const QQuickToolTipAttached);
550 return d->text;
551}
552
553void QQuickToolTipAttached::setText(const QString &text)
554{
555 Q_D(QQuickToolTipAttached);
556 if (d->warnIfAttacheeIsNotAnItem(QStringLiteral("setText")))
557 return;
558 if (d->text == text)
559 return;
560
561 d->text = text;
562 emit textChanged();
563
564 if (isVisible())
565 d->instance(true)->setText(text);
566}
567
568/*!
569 \qmlattachedproperty int QtQuick.Controls::ToolTip::delay
570
571 This attached property holds the delay (milliseconds) of the shared tool tip.
572 The property can be attached to any item.
573
574 The default value is \c 0 if \l policy is \c ToolTip.Manual, otherwise it
575 is \l QStyleHints::toolTipWakeUpDelay().
576
577 \sa {Attached Tool Tips}, {Delay and Timeout}
578*/
579int QQuickToolTipAttached::delay() const
580{
581 Q_D(const QQuickToolTipAttached);
582 return d->explicitDelay || d->policy == QQuickToolTip::Manual ? d->delay
583 : qt_quicktooltipattachedprivate_delay;
584}
585
586void QQuickToolTipAttached::setDelay(int delay)
587{
588 Q_D(QQuickToolTipAttached);
589 d->setDelay(delay, QQml::PropertyUtils::State::ExplicitlySet);
590}
591
592/*!
593 \qmlattachedproperty int QtQuick.Controls::ToolTip::timeout
594
595 This attached property holds the timeout (milliseconds) of the shared tool tip.
596 The property can be attached to any item.
597
598 The default value is based on the length of the text, and will always be
599 at least 10 seconds long.
600
601 \sa {Attached Tool Tips}, {Delay and Timeout}
602*/
603int QQuickToolTipAttached::timeout() const
604{
605 Q_D(const QQuickToolTipAttached);
606 return d->explicitTimeout || d->policy == QQuickToolTip::Manual ? d->timeout
607 : d->calculateTimeout(d->text);
608}
609
610void QQuickToolTipAttached::setTimeout(int timeout)
611{
612 Q_D(QQuickToolTipAttached);
613 d->setTimeout(timeout, QQml::PropertyUtils::State::ExplicitlySet);
614}
615
616/*!
617 \qmlattachedproperty bool QtQuick.Controls::ToolTip::visible
618
619 This attached property holds whether the shared tool tip is visible.
620 The property can be attached to any item.
621
622 \sa {Attached Tool Tips}
623*/
624bool QQuickToolTipAttached::isVisible() const
625{
626 Q_D(const QQuickToolTipAttached);
627 QQuickToolTip *tip = d->instance(false);
628 if (!tip)
629 return false;
630
631 return tip->isVisible() && tip->parentItem() == parent();
632}
633
634void QQuickToolTipAttached::setVisible(bool visible)
635{
636 Q_D(QQuickToolTipAttached);
637 d->setVisible(visible, QQml::PropertyUtils::State::ExplicitlySet);
638}
639
640/*!
641 \qmlattachedproperty ToolTip QtQuick.Controls::ToolTip::toolTip
642
643 This attached property holds the shared tool tip instance. The property
644 can be attached to any item.
645
646 \sa {Attached Tool Tips}
647*/
648QQuickToolTip *QQuickToolTipAttached::toolTip() const
649{
650 Q_D(const QQuickToolTipAttached);
651 return d->instance(true);
652}
653
654/*!
655 \qmlattachedproperty enumeration QtQuick.Controls::ToolTip::policy
656 \since 6.12
657
658 This attached property controls whether the visibility of the
659 \l {toolTip}{shared tool tip instance} is handled automatically.
660 It only has an effect for items on which \c ToolTip.visible \e {has not}
661 been set. Only items that set \c ToolTip.text will be made visible. It only
662 has an effect for the following items and their derived types: \l Control,
663 \l TextArea and \l TextField. All other types require \l visible to be
664 manually set.
665
666 It also determines the default values for the delay and timeout properties
667 of the shared tool tip instance (regardless of whether \c ToolTip.visible
668 or \c ToolTip.text have been set).
669
670 This property is propagated to attached ToolTip children.
671
672 Available values:
673 \value ToolTip.Automatic The shared tool tip will be shown when the
674 attachee is hovered or long-pressed (if triggered by touch and the
675 attachee is an \l AbstractButton or one of its derived types). If
676 the visible property has been explicitly set, or the text property has
677 not been set, this value has no effect, and the behavior will be
678 equivalent to \c ToolTip.Manual.
679
680 The shared tool tip will also default to platform-specific values
681 for its delay and timeout properties.
682 \value ToolTip.Manual The shared tool tip will not be shown automatically,
683 and the developer is responsible for setting the visible property.
684
685 The shared tool tip will not default to platform-specific values
686 for its delay and timeout properties.
687
688 The default value is \c {ToolTip.Automatic}.
689
690 The property provides a way to opt-out of the default values for shared
691 tool tips introduced in Qt 6.12. This is particularly relevant for legacy
692 code that doesn't explicitly set the visible property before an item is
693 interacted with. For applications that declaratively set the visible
694 property and find the new default values for delay and timeout acceptable,
695 \c policy is not needed.
696
697 \sa {Attached Tool Tips}
698*/
699QQuickToolTip::Policy QQuickToolTipAttached::policy() const
700{
701 Q_D(const QQuickToolTipAttached);
702 return d->policy;
703}
704
705void QQuickToolTipAttached::setVisiblePolicy(QQuickToolTip::Policy policy)
706{
707 Q_D(QQuickToolTipAttached);
708 if (d->policy == policy)
709 return;
710
711 d->policy = policy;
712 d->propagatePolicy();
713 emit policyChanged();
714}
715
716void QQuickToolTipAttached::resetVisiblePolicy()
717{
718 setVisiblePolicy(QQuickToolTip::Automatic);
719}
720
721/*!
722 \qmlattachedmethod void QtQuick.Controls::ToolTip::show(string text, int timeout = -1)
723
724 This attached method shows the shared tooltip with \a text and \a timeout (milliseconds).
725 The method can be attached to any item.
726
727 \sa {Attached Tool Tips}
728*/
729void QQuickToolTipAttached::show(const QString &text, int ms)
730{
731 Q_D(QQuickToolTipAttached);
732 if (d->warnIfAttacheeIsNotAnItem(QStringLiteral("show")))
733 return;
734
735 QQuickToolTip *tip = d->instance(true);
736 if (!tip)
737 return;
738
739 tip->resetWidth();
740 tip->resetHeight();
741 tip->setParentItem(qobject_cast<QQuickItem *>(parent()));
742 tip->setDelay(delay());
743 tip->setTimeout(ms >= 0 ? ms : timeout());
744 tip->show(text);
745}
746
747/*!
748 \qmlattachedmethod void QtQuick.Controls::ToolTip::hide()
749
750 This attached method hides the shared tooltip. The method can be attached to any item.
751
752 \sa {Attached Tool Tips}
753*/
754void QQuickToolTipAttached::hide()
755{
756 Q_D(QQuickToolTipAttached);
757 QQuickToolTip *tip = d->instance(false);
758 if (!tip)
759 return;
760 // check the parent item to prevent unexpectedly closing tooltip by new created invisible tooltip
761 if (parent() == tip->parentItem())
762 tip->close();
763}
764
765void QQuickToolTipAttached::attachedParentChange(QQuickAttachedPropertyPropagator *newParent,
766 QQuickAttachedPropertyPropagator */*oldParent*/)
767{
768 auto *attachedToolTipParent = qobject_cast<QQuickToolTipAttached *>(newParent);
769 if (!attachedToolTipParent)
770 return;
771
772 Q_D(QQuickToolTipAttached);
773 d->inheritPolicy(attachedToolTipParent->policy());
774}
775
776void QQuickToolTipAttached::classBegin()
777{
778 Q_D(QQuickToolTipAttached);
779 d->complete = false;
780}
781
782void QQuickToolTipAttached::componentComplete()
783{
784 Q_D(QQuickToolTipAttached);
785 d->complete = true;
786
787 if (d->pendingShow) {
788 d->pendingShow = false;
789 show(d->text);
790 }
791}
792
793QT_END_NAMESPACE
794
795#include "moc_qquicktooltip_p.cpp"
QPalette defaultPalette() const override
void opened() override
Combined button and popup list for selecting options.
static QT_BEGIN_NAMESPACE int qt_quicktooltipattachedprivate_delay
Provides tool tips for any control.
constexpr bool qt_quicktooltipattachedprivate_short_timeout