Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickcontrol.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
4#include "qquickcontrol_p.h"
5#include "qquickcontrol_p_p.h"
6
7#include <QtGui/qstylehints.h>
8#include <QtGui/qguiapplication.h>
9#include "qquicklabel_p.h"
10#include "qquicklabel_p_p.h"
11#include "qquicktextarea_p.h"
12#include "qquicktextarea_p_p.h"
13#include "qquicktextfield_p.h"
14#include "qquicktextfield_p_p.h"
15#include "qquickpopup_p.h"
16#include "qquickpopupitem_p_p.h"
19#include "qquickcontentitem_p.h"
20
21#if QT_CONFIG(accessibility)
22#include <QtQuick/private/qquickaccessibleattached_p.h>
23#endif
24
26
27Q_LOGGING_CATEGORY(lcItemManagement, "qt.quick.controls.control.itemmanagement")
28
29
33
116const QQuickItemPrivate::ChangeTypes QQuickControlPrivate::ImplicitSizeChanges = QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight | QQuickItemPrivate::Destroyed;
117
118static bool isKeyFocusReason(Qt::FocusReason reason)
119{
120 return reason == Qt::TabFocusReason || reason == Qt::BacktabFocusReason || reason == Qt::ShortcutFocusReason;
121}
122
124{
125#if QT_CONFIG(accessibility)
126 QAccessible::installActivationObserver(this);
127#endif
128}
129
133
139
140#if QT_CONFIG(quicktemplates2_multitouch)
141bool QQuickControlPrivate::acceptTouch(const QTouchEvent::TouchPoint &point)
142{
143 if (point.id() == touchId)
144 return true;
145
146 if (touchId == -1 && point.state() == QEventPoint::Pressed) {
147 touchId = point.id();
148 return true;
149 }
150
151 return false;
152}
153#endif
154
156{
157 return true;
158}
159
161{
162#if QT_CONFIG(quicktemplates2_hover)
163 Q_Q(QQuickControl);
164 q->setHovered(hoverEnabled && q->contains(point));
165#else
166 Q_UNUSED(point);
167#endif
168 return true;
169}
170
172{
173 touchId = -1;
174 return true;
175}
176
181
183{
184 Q_Q(QQuickControl);
185 q->mirrorChange();
186}
187
189{
190 Q_Q(QQuickControl);
191 const QMarginsF oldPadding = getPadding();
192 extra.value().topPadding = value;
193 extra.value().hasTopPadding = !reset;
194 if ((!reset && !qFuzzyCompare(oldPadding.top(), value)) || (reset && !qFuzzyCompare(oldPadding.top(), getVerticalPadding()))) {
195 emit q->topPaddingChanged();
196 emit q->availableHeightChanged();
197 q->paddingChange(getPadding(), oldPadding);
198 }
199}
200
202{
203 Q_Q(QQuickControl);
204 const QMarginsF oldPadding = getPadding();
205 extra.value().leftPadding = value;
206 extra.value().hasLeftPadding = !reset;
207 if ((!reset && !qFuzzyCompare(oldPadding.left(), value)) || (reset && !qFuzzyCompare(oldPadding.left(), getHorizontalPadding()))) {
208 emit q->leftPaddingChanged();
209 emit q->availableWidthChanged();
210 q->paddingChange(getPadding(), oldPadding);
211 }
212}
213
215{
216 Q_Q(QQuickControl);
217 const QMarginsF oldPadding = getPadding();
218 extra.value().rightPadding = value;
219 extra.value().hasRightPadding = !reset;
220 if ((!reset && !qFuzzyCompare(oldPadding.right(), value)) || (reset && !qFuzzyCompare(oldPadding.right(), getHorizontalPadding()))) {
221 emit q->rightPaddingChanged();
222 emit q->availableWidthChanged();
223 q->paddingChange(getPadding(), oldPadding);
224 }
225}
226
228{
229 Q_Q(QQuickControl);
230 const QMarginsF oldPadding = getPadding();
231 extra.value().bottomPadding = value;
232 extra.value().hasBottomPadding = !reset;
233 if ((!reset && !qFuzzyCompare(oldPadding.bottom(), value)) || (reset && !qFuzzyCompare(oldPadding.bottom(), getVerticalPadding()))) {
234 emit q->bottomPaddingChanged();
235 emit q->availableHeightChanged();
236 q->paddingChange(getPadding(), oldPadding);
237 }
238}
239
241{
242 Q_Q(QQuickControl);
243 const QMarginsF oldPadding = getPadding();
244 const qreal oldHorizontalPadding = getHorizontalPadding();
247 if ((!reset && !qFuzzyCompare(oldHorizontalPadding, value)) || (reset && !qFuzzyCompare(oldHorizontalPadding, padding))) {
248 const QMarginsF newPadding = getPadding();
249 if (!qFuzzyCompare(newPadding.left(), oldPadding.left()))
250 emit q->leftPaddingChanged();
251 if (!qFuzzyCompare(newPadding.right(), oldPadding.right()))
252 emit q->rightPaddingChanged();
253 emit q->horizontalPaddingChanged();
254 emit q->availableWidthChanged();
255 q->paddingChange(newPadding, oldPadding);
256 }
257}
258
260{
261 Q_Q(QQuickControl);
262 const QMarginsF oldPadding = getPadding();
263 const qreal oldVerticalPadding = getVerticalPadding();
266 if ((!reset && !qFuzzyCompare(oldVerticalPadding, value)) || (reset && !qFuzzyCompare(oldVerticalPadding, padding))) {
267 const QMarginsF newPadding = getPadding();
268 if (!qFuzzyCompare(newPadding.top(), oldPadding.top()))
269 emit q->topPaddingChanged();
270 if (!qFuzzyCompare(newPadding.bottom(), oldPadding.bottom()))
271 emit q->bottomPaddingChanged();
272 emit q->verticalPaddingChanged();
273 emit q->availableHeightChanged();
274 q->paddingChange(newPadding, oldPadding);
275 }
276}
277
279{
280 Q_Q(QQuickControl);
281 const QMarginsF oldInset = getInset();
282 extra.value().topInset = value;
283 extra.value().hasTopInset = !reset;
284 if (!qFuzzyCompare(oldInset.top(), value)) {
285 emit q->topInsetChanged();
286 q->insetChange(getInset(), oldInset);
287 }
288}
289
291{
292 Q_Q(QQuickControl);
293 const QMarginsF oldInset = getInset();
294 extra.value().leftInset = value;
295 extra.value().hasLeftInset = !reset;
296 if (!qFuzzyCompare(oldInset.left(), value)) {
297 emit q->leftInsetChanged();
298 q->insetChange(getInset(), oldInset);
299 }
300}
301
303{
304 Q_Q(QQuickControl);
305 const QMarginsF oldInset = getInset();
306 extra.value().rightInset = value;
307 extra.value().hasRightInset = !reset;
308 if (!qFuzzyCompare(oldInset.right(), value)) {
309 emit q->rightInsetChanged();
310 q->insetChange(getInset(), oldInset);
311 }
312}
313
315{
316 Q_Q(QQuickControl);
317 const QMarginsF oldInset = getInset();
318 extra.value().bottomInset = value;
319 extra.value().hasBottomInset = !reset;
320 if (!qFuzzyCompare(oldInset.bottom(), value)) {
321 emit q->bottomInsetChanged();
322 q->insetChange(getInset(), oldInset);
323 }
324}
325
327{
328 if (!background)
329 return;
330
331 resizingBackground = true;
332
334 bool changeWidth = false;
335 bool changeHeight = false;
336 if (((!p->widthValid() || !extra.isAllocated() || !extra->hasBackgroundWidth) && qFuzzyIsNull(background->x()))
337 || (extra.isAllocated() && (extra->hasLeftInset || extra->hasRightInset))) {
338 const auto leftInset = getLeftInset();
339 if (!qt_is_nan(leftInset) && p->x.valueBypassingBindings() != leftInset) {
340 // We bypass the binding here to prevent it from being removed
341 p->x.setValueBypassingBindings(leftInset);
342 p->dirty(DirtyType::Position);
343 }
344 changeWidth = !p->width.hasBinding();
345 }
346 if (((!p->heightValid() || !extra.isAllocated() || !extra->hasBackgroundHeight) && qFuzzyIsNull(background->y()))
347 || (extra.isAllocated() && (extra->hasTopInset || extra->hasBottomInset))) {
348 const auto topInset = getTopInset();
349 if (!qt_is_nan(topInset) && p->y.valueBypassingBindings() != topInset) {
350 // We bypass the binding here to prevent it from being removed
351 p->y.setValueBypassingBindings(topInset);
352 p->dirty(DirtyType::Position);
353 }
354 changeHeight = !p->height.hasBinding();
355 }
356 if (changeHeight || changeWidth) {
357 auto newWidth = changeWidth ?
358 width.valueBypassingBindings() - getLeftInset() - getRightInset() :
359 p->width.valueBypassingBindings();
360 auto newHeight = changeHeight ?
361 height.valueBypassingBindings() - getTopInset() - getBottomInset() :
362 p->height.valueBypassingBindings();
363 background->setSize({newWidth, newHeight});
364 }
365
366 resizingBackground = false;
367}
368
370{
371 Q_Q(QQuickControl);
372 if (contentItem) {
373 contentItem->setPosition(QPointF(q->leftPadding(), q->topPadding()));
374 contentItem->setSize(QSizeF(q->availableWidth(), q->availableHeight()));
375 }
376}
377
384
386{
387 Q_Q(QQuickControl);
388 if (contentItem == item)
389 return;
390
391 if (notify)
393
396
397 QQuickItem *oldContentItem = contentItem;
398 if (oldContentItem) {
400 QQuickItemPrivate::get(oldContentItem)->removeItemChangeListener(this, QQuickControlPrivate::Focus);
401 removeImplicitSizeListener(oldContentItem);
402 }
403
405 q->contentItemChange(item, oldContentItem);
406 QQuickControlPrivate::hideOldItem(oldContentItem);
407
408 if (item) {
410 // We need to update the control's focusReason when the contentItem receives or loses focus. Since focusPolicy
411 // (or other properties impacting focus handling, like QQuickItem::activeFocusOnTab) might change later, and
412 // since the content item might also change focus programmatically, we always have to listen for those events.
413 QQuickItemPrivate::get(item)->addItemChangeListener(this, QQuickControlPrivate::Focus);
414 if (!item->parentItem())
419 }
420
423
424 if (notify && !contentItem.isExecuting())
425 emit q->contentItemChanged();
426}
427
432
437
439{
440 Q_Q(QQuickControl);
441 const qreal oldWidth = implicitContentWidth;
443 if (!qFuzzyCompare(implicitContentWidth, oldWidth))
444 emit q->implicitContentWidthChanged();
445}
446
448{
449 Q_Q(QQuickControl);
450 const qreal oldHeight = implicitContentHeight;
452 if (!qFuzzyCompare(implicitContentHeight, oldHeight))
453 emit q->implicitContentHeightChanged();
454}
455
457{
458 Q_Q(QQuickControl);
459 const qreal oldWidth = implicitContentWidth;
460 const qreal oldHeight = implicitContentHeight;
463 if (!qFuzzyCompare(implicitContentWidth, oldWidth))
464 emit q->implicitContentWidthChanged();
465 if (!qFuzzyCompare(implicitContentHeight, oldHeight))
466 emit q->implicitContentHeightChanged();
467}
468
473
474#if QT_CONFIG(accessibility)
475void QQuickControlPrivate::accessibilityActiveChanged(bool active)
476{
477 Q_Q(QQuickControl);
478 return q->accessibilityActiveChanged(active);
479}
480
481QAccessible::Role QQuickControlPrivate::accessibleRole() const
482{
483 Q_Q(const QQuickControl);
484 return q->accessibleRole();
485}
486
487QQuickAccessibleAttached *QQuickControlPrivate::accessibleAttached(const QObject *object)
488{
489 if (!QAccessible::isActive())
490 return nullptr;
491 return QQuickAccessibleAttached::attachedProperties(object);
492}
493#endif
494
502{
504 while (p) {
505 if (QQuickControl *control = qobject_cast<QQuickControl *>(p))
506 return QQuickControlPrivate::get(control)->resolvedFont;
507 else if (QQuickLabel *label = qobject_cast<QQuickLabel *>(p))
508 return label->QQuickText::font();
509 else if (QQuickTextField *textField = qobject_cast<QQuickTextField *>(p))
510 return textField->QQuickTextInput::font();
511 else if (QQuickTextArea *textArea = qobject_cast<QQuickTextArea *>(p))
512 return textArea->QQuickTextEdit::font();
513
514 p = p->parentItem();
515 }
516
517 if (QQuickApplicationWindow *window = qobject_cast<QQuickApplicationWindow *>(item->window()))
518 return window->font();
519
521}
522
536
538{
539 Q_Q(QQuickControl);
540 QFont parentFont = extra.isAllocated() ? extra->requestedFont.resolve(font) : font;
541 parentFont.setResolveMask(extra.isAllocated() ? extra->requestedFont.resolveMask() | font.resolveMask() : font.resolveMask());
542
543 const QFont defaultFont = q->defaultFont();
544 QFont resolvedFont = parentFont.resolve(defaultFont);
545
547}
548
555{
556 Q_Q(QQuickControl);
557 QFont oldFont = resolvedFont;
559
560 if (oldFont != font)
561 q->fontChange(font, oldFont);
562
564
565 if (oldFont != font)
566 emit q->fontChanged();
567}
568
570{
571 const auto childItems = item->childItems();
572 for (QQuickItem *child : childItems) {
573 if (QQuickControl *control = qobject_cast<QQuickControl *>(child))
574 QQuickControlPrivate::get(control)->inheritFont(font);
575 else if (QQuickLabel *label = qobject_cast<QQuickLabel *>(child))
576 QQuickLabelPrivate::get(label)->inheritFont(font);
577 else if (QQuickTextArea *textArea = qobject_cast<QQuickTextArea *>(child))
578 QQuickTextAreaPrivate::get(textArea)->inheritFont(font);
579 else if (QQuickTextField *textField = qobject_cast<QQuickTextField *>(child))
580 QQuickTextFieldPrivate::get(textField)->inheritFont(font);
581 else
583 }
584}
585
587{
588 const QQuickItem *p = item;
589 while (p) {
590 if (const QQuickControl *control = qobject_cast<const QQuickControl *>(p))
591 return control->locale();
592
593 QVariant v = p->property("locale");
594 if (v.isValid() && v.userType() == QMetaType::QLocale)
595 return v.toLocale();
596
597 p = p->parentItem();
598 }
599
600 if (item) {
601 if (QQuickApplicationWindow *window = qobject_cast<QQuickApplicationWindow *>(item->window()))
602 return window->locale();
603 }
604
605 return QLocale();
606}
607
624{
625 static const bool ignoreWarnings = [](){
626 return qEnvironmentVariableIntValue("QT_QUICK_CONTROLS_IGNORE_CUSTOMIZATION_WARNINGS");
627 }();
628 if (ignoreWarnings)
629 return;
630
631 if (!control->property("__notCustomizable").toBool()
632 || (item && item->property("__ignoreNotCustomizable").toBool()))
633 return;
634
635 qmlWarning(item ? item : control).nospace() << "The current style does not support customization of this control "
636 << "(property: " << propertyName << " item: " << item << "). "
637 "Please customize a non-native style (such as Basic, Fusion, Material, etc). For more information, see: "
638 "https://doc.qt.io/qt-6/qtquickcontrols2-customize.html#customization-reference";
639}
640
642{
643 Q_Q(QQuickControl);
644 if (!e && hasLocale)
645 return;
646
647 QLocale old = q->locale();
648 hasLocale = e;
649 if (old != l) {
650 locale = l;
651 q->localeChange(l, old);
653 emit q->localeChanged();
654 }
655}
656
658{
659 const auto childItems = item->childItems();
660 for (QQuickItem *child : childItems) {
661 if (QQuickControl *control = qobject_cast<QQuickControl *>(child))
662 QQuickControlPrivate::get(control)->updateLocale(l, false);
663 else
665 }
666}
667
668#if QT_CONFIG(quicktemplates2_hover)
669void QQuickControlPrivate::updateHoverEnabled(bool enabled, bool xplicit)
670{
671 Q_Q(QQuickControl);
672 if (!xplicit && explicitHoverEnabled)
673 return;
674
675 bool wasEnabled = q->isHoverEnabled();
676 explicitHoverEnabled = xplicit;
677 if (wasEnabled != enabled) {
678 q->setAcceptHoverEvents(enabled);
679 QQuickControlPrivate::updateHoverEnabledRecur(q, enabled);
680 emit q->hoverEnabledChanged();
681 }
682}
683
684void QQuickControlPrivate::updateHoverEnabledRecur(QQuickItem *item, bool enabled)
685{
686 const auto childItems = item->childItems();
687 for (QQuickItem *child : childItems) {
688 if (QQuickControl *control = qobject_cast<QQuickControl *>(child))
689 QQuickControlPrivate::get(control)->updateHoverEnabled(enabled, false);
690 else
691 updateHoverEnabledRecur(child, enabled);
692 }
693}
694
695bool QQuickControlPrivate::calcHoverEnabled(const QQuickItem *item)
696{
697 const QQuickItem *p = item;
698 while (p) {
699 // QQuickPopupItem accepts hover events to avoid leaking them through.
700 // Don't inherit that to the children of the popup, but fallback to the
701 // environment variable or style hint.
702 if (qobject_cast<const QQuickPopupItem *>(p))
703 break;
704
705 if (const QQuickControl *control = qobject_cast<const QQuickControl *>(p))
706 return control->isHoverEnabled();
707
708 QVariant v = p->property("hoverEnabled");
709 if (v.isValid() && v.userType() == QMetaType::Bool)
710 return v.toBool();
711
712 p = p->parentItem();
713 }
714
715 bool ok = false;
716 int env = qEnvironmentVariableIntValue("QT_QUICK_CONTROLS_HOVER_ENABLED", &ok);
717 if (ok)
718 return env != 0;
719
720 // TODO: QQuickApplicationWindow::isHoverEnabled()
721
722 return QGuiApplication::styleHints()->useHoverEffects();
723}
724#endif
725
726static inline QString contentItemName() { return QStringLiteral("contentItem"); }
727
733
735{
736 Q_Q(QQuickControl);
738 return;
739
740 if (!contentItem || complete)
742 if (complete)
744}
745
751
753{
754 Q_Q(QQuickControl);
756 return;
757
758 if (!background || complete)
760 if (complete)
762}
763
764/*
765 \internal
766
767 Hides an item that was replaced by a newer one, rather than
768 deleting it, as the item is typically created in QML and hence
769 we don't own it.
770*/
772{
773 if (!item)
774 return;
775
776 qCDebug(lcItemManagement) << "hiding old item" << item;
777
778 item->setVisible(false);
779 item->setParentItem(nullptr);
780
781#if QT_CONFIG(accessibility)
782 // Remove the item from the accessibility tree.
783 QQuickAccessibleAttached *accessible = accessibleAttached(item);
784 if (accessible)
785 accessible->setIgnored(true);
786#endif
787}
788
789/*
790 \internal
791
792 Named "unhide" because it's used for cases where an item
793 that was previously hidden by \l hideOldItem() wants to be
794 shown by a control again, such as a ScrollBar in ScrollView.
795
796 \a visibility controls the visibility of \a item, as there
797 may have been bindings that controlled visibility, such as
798 with a typical ScrollBar.qml implementation:
799
800 \code
801 visible: control.policy !== T.ScrollBar.AlwaysOff
802 \endcode
803
804 In the future we could try to save the binding for the visible
805 property (using e.g. QQmlAnyBinding::takeFrom), but for now we
806 keep it simple and just allow restoring an equivalent literal value.
807*/
809{
810 Q_ASSERT(item);
811 qCDebug(lcItemManagement) << "unhiding old item" << item;
812
813 item->setVisible(visibility == UnhideVisibility::Show);
814 item->setParentItem(control);
815
816#if QT_CONFIG(accessibility)
817 // Add the item back in to the accessibility tree.
818 QQuickAccessibleAttached *accessible = accessibleAttached(item);
819 if (accessible)
820 accessible->setIgnored(false);
821#endif
822}
823
825{
826 Q_Q(QQuickControl);
827 if (extra.isAllocated() && extra.value().hasBaselineOffset)
828 return;
829
830 if (!contentItem)
831 q->QQuickItem::setBaselineOffset(0);
832 else
833 q->QQuickItem::setBaselineOffset(getTopPadding() + contentItem->baselineOffset());
834}
835
837{
838 addImplicitSizeListener(item, this, changes);
839}
840
842{
843 removeImplicitSizeListener(item, this, changes);
844}
845
847{
848 if (!item || !listener)
849 return;
850 QQuickItemPrivate::get(item)->addItemChangeListener(listener, changes);
851}
852
854{
855 if (!item || !listener)
856 return;
857 QQuickItemPrivate::get(item)->removeItemChangeListener(listener, changes);
858}
859
861{
862 Q_Q(QQuickControl);
863 if (item == background)
864 emit q->implicitBackgroundWidthChanged();
865 else if (item == contentItem)
867}
868
870{
871 Q_Q(QQuickControl);
872 if (item == background)
873 emit q->implicitBackgroundHeightChanged();
874 else if (item == contentItem)
876}
877
879{
880 Q_UNUSED(diff);
881 if (resizingBackground || item != background || !change.sizeChange())
882 return;
883
885 // Only set hasBackgroundWidth/Height if it was a width/height change,
886 // otherwise we're prevented from setting a width/height in the future.
887 if (change.widthChange())
888 extra.value().hasBackgroundWidth = p->widthValid();
889 if (change.heightChange())
890 extra.value().hasBackgroundHeight = p->heightValid();
892}
893
895{
896 Q_Q(QQuickControl);
897 if (item == background) {
898 background = nullptr;
899 emit q->implicitBackgroundWidthChanged();
900 emit q->implicitBackgroundHeightChanged();
901 } else if (item == contentItem) {
902 contentItem = nullptr;
904 }
905}
906
913
915 : QQuickItem(*(new QQuickControlPrivate), parent)
916{
917 Q_D(QQuickControl);
918 d->init();
919}
920
922 : QQuickItem(dd, parent)
923{
924 Q_D(QQuickControl);
925 d->init();
926}
927
929{
930 Q_D(QQuickControl);
931 d->removeImplicitSizeListener(d->background, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry);
932 d->removeImplicitSizeListener(d->contentItem);
933 if (d->contentItem)
934 QQuickItemPrivate::get(d->contentItem)->removeItemChangeListener(d, QQuickItemPrivate::Focus);
935#if QT_CONFIG(accessibility)
936 QAccessible::removeActivationObserver(d);
937#endif
938}
939
941{
942 Q_D(QQuickControl);
944 switch (change) {
947 break;
949#if QT_CONFIG(quicktemplates2_hover)
950 if (!value.boolValue)
951 setHovered(false);
952#endif
953 break;
954 case ItemSceneChange:
956 if ((change == ItemParentHasChanged && value.item) || (change == ItemSceneChange && value.window)) {
957 d->resolveFont();
958 if (!d->hasLocale)
959 d->updateLocale(QQuickControlPrivate::calcLocale(d->parentItem), false); // explicit=false
960#if QT_CONFIG(quicktemplates2_hover)
961 if (!d->explicitHoverEnabled)
962 d->updateHoverEnabled(QQuickControlPrivate::calcHoverEnabled(d->parentItem), false); // explicit=false
963#endif
964 }
965 break;
967 if (isKeyFocusReason(static_cast<Qt::FocusReason>(d->focusReason)))
969 break;
970 default:
971 break;
972 }
973}
974
1020{
1021 Q_D(const QQuickControl);
1022 QFont font = d->resolvedFont;
1023 // The resolveMask should inherit from the requestedFont
1024 font.setResolveMask(d->extra.value().requestedFont.resolveMask());
1025 return font;
1026}
1027
1029{
1030 Q_D(QQuickControl);
1031 if (d->extra.value().requestedFont.resolveMask() == font.resolveMask() && d->extra.value().requestedFont == font)
1032 return;
1033
1034 d->extra.value().requestedFont = font;
1035 d->resolveFont();
1036}
1037
1039{
1040 setFont(QFont());
1041}
1042
1053{
1054 return qMax<qreal>(0.0, width() - leftPadding() - rightPadding());
1055}
1056
1067{
1068 return qMax<qreal>(0.0, height() - topPadding() - bottomPadding());
1069}
1070
1111{
1112 Q_D(const QQuickControl);
1113 return d->padding;
1114}
1115
1117{
1118 Q_D(QQuickControl);
1119 if (qFuzzyCompare(d->padding, padding))
1120 return;
1121
1122 const QMarginsF oldPadding = d->getPadding();
1123 const qreal oldVerticalPadding = d->getVerticalPadding();
1124 const qreal oldHorizontalPadding = d->getHorizontalPadding();
1125
1126 d->padding = padding;
1128
1129 const QMarginsF newPadding = d->getPadding();
1130 const qreal newVerticalPadding = d->getVerticalPadding();
1131 const qreal newHorizontalPadding = d->getHorizontalPadding();
1132
1133 if (!qFuzzyCompare(newPadding.top(), oldPadding.top()))
1135 if (!qFuzzyCompare(newPadding.left(), oldPadding.left()))
1137 if (!qFuzzyCompare(newPadding.right(), oldPadding.right()))
1139 if (!qFuzzyCompare(newPadding.bottom(), oldPadding.bottom()))
1141 if (!qFuzzyCompare(newVerticalPadding, oldVerticalPadding))
1142 emit verticalPaddingChanged();
1143 if (!qFuzzyCompare(newHorizontalPadding, oldHorizontalPadding))
1144 emit horizontalPaddingChanged();
1145 if (!qFuzzyCompare(newPadding.top(), oldPadding.top()) || !qFuzzyCompare(newPadding.bottom(), oldPadding.bottom()))
1147 if (!qFuzzyCompare(newPadding.left(), oldPadding.left()) || !qFuzzyCompare(newPadding.right(), oldPadding.right()))
1149
1150 paddingChange(newPadding, oldPadding);
1151}
1152
1154{
1155 setPadding(0);
1156}
1157
1167{
1168 Q_D(const QQuickControl);
1169 return d->getTopPadding();
1170}
1171
1173{
1174 Q_D(QQuickControl);
1175 d->setTopPadding(padding);
1176}
1177
1179{
1180 Q_D(QQuickControl);
1181 d->setTopPadding(0, true);
1182}
1183
1193{
1194 Q_D(const QQuickControl);
1195 return d->getLeftPadding();
1196}
1197
1199{
1200 Q_D(QQuickControl);
1201 d->setLeftPadding(padding);
1202}
1203
1205{
1206 Q_D(QQuickControl);
1207 d->setLeftPadding(0, true);
1208}
1209
1219{
1220 Q_D(const QQuickControl);
1221 return d->getRightPadding();
1222}
1223
1225{
1226 Q_D(QQuickControl);
1227 d->setRightPadding(padding);
1228}
1229
1231{
1232 Q_D(QQuickControl);
1233 d->setRightPadding(0, true);
1234}
1235
1245{
1246 Q_D(const QQuickControl);
1247 return d->getBottomPadding();
1248}
1249
1251{
1252 Q_D(QQuickControl);
1253 d->setBottomPadding(padding);
1254}
1255
1257{
1258 Q_D(QQuickControl);
1259 d->setBottomPadding(0, true);
1260}
1261
1274{
1275 Q_D(const QQuickControl);
1276 return d->spacing;
1277}
1278
1280{
1281 Q_D(QQuickControl);
1282 if (qFuzzyCompare(d->spacing, spacing))
1283 return;
1284
1285 qreal oldSpacing = d->spacing;
1286 d->spacing = spacing;
1288 spacingChange(spacing, oldSpacing);
1289}
1290
1292{
1293 setSpacing(0);
1294}
1295
1312{
1313 Q_D(const QQuickControl);
1314 return d->locale;
1315}
1316
1318{
1319 Q_D(QQuickControl);
1320 if (d->hasLocale && d->locale == locale)
1321 return;
1322
1323 d->updateLocale(locale, true); // explicit=true
1324}
1325
1327{
1328 Q_D(QQuickControl);
1329 if (!d->hasLocale)
1330 return;
1331
1332 d->hasLocale = false;
1333 d->updateLocale(QQuickControlPrivate::calcLocale(d->parentItem), false); // explicit=false
1334}
1335
1351{
1352 Q_D(const QQuickControl);
1353 return d->isMirrored();
1354}
1355
1379{
1380 Q_D(const QQuickControl);
1381 return d->lastFocusChangeReason();
1382}
1383
1385{
1386 Q_D(QQuickControl);
1387 Qt::FocusReason oldReason = static_cast<Qt::FocusReason>(d->focusReason);
1388 d->setLastFocusChangeReason(reason);
1390 if (isKeyFocusReason(oldReason) != isKeyFocusReason(reason))
1392}
1393
1409{
1410 Q_D(const QQuickControl);
1411 return d->activeFocus && isKeyFocusReason(static_cast<Qt::FocusReason>(d->focusReason));
1412}
1413
1423{
1424#if QT_CONFIG(quicktemplates2_hover)
1425 Q_D(const QQuickControl);
1426 return d->hovered;
1427#else
1428 return false;
1429#endif
1430}
1431
1433{
1434#if QT_CONFIG(quicktemplates2_hover)
1435 Q_D(QQuickControl);
1436 if (hovered == d->hovered)
1437 return;
1438
1439 d->hovered = hovered;
1441 hoverChange();
1442#else
1444#endif
1445}
1446
1463{
1464#if QT_CONFIG(quicktemplates2_hover)
1465 Q_D(const QQuickControl);
1466 return d->hoverEnabled;
1467#else
1468 return false;
1469#endif
1470}
1471
1473{
1474#if QT_CONFIG(quicktemplates2_hover)
1475 Q_D(QQuickControl);
1476 if (d->explicitHoverEnabled && enabled == d->hoverEnabled)
1477 return;
1478
1479 d->updateHoverEnabled(enabled, true); // explicit=true
1480#else
1482#endif
1483}
1484
1486{
1487#if QT_CONFIG(quicktemplates2_hover)
1488 Q_D(QQuickControl);
1489 if (!d->explicitHoverEnabled)
1490 return;
1491
1492 d->explicitHoverEnabled = false;
1493 d->updateHoverEnabled(QQuickControlPrivate::calcHoverEnabled(d->parentItem), false); // explicit=false
1494#endif
1495}
1496
1507{
1508 Q_D(const QQuickControl);
1509 return d->wheelEnabled;
1510}
1511
1513{
1514 Q_D(QQuickControl);
1515 if (d->wheelEnabled == enabled)
1516 return;
1517
1518 d->wheelEnabled = enabled;
1520}
1521
1545{
1546 QQuickControlPrivate *d = const_cast<QQuickControlPrivate *>(d_func());
1547 if (!d->background)
1548 d->executeBackground();
1549 return d->background;
1550}
1551
1553{
1554 Q_D(QQuickControl);
1555 if (d->background == background)
1556 return;
1557
1559
1560 if (!d->background.isExecuting())
1561 d->cancelBackground();
1562
1563 const qreal oldImplicitBackgroundWidth = implicitBackgroundWidth();
1564 const qreal oldImplicitBackgroundHeight = implicitBackgroundHeight();
1565
1566 if (d->extra.isAllocated()) {
1567 d->extra.value().hasBackgroundWidth = false;
1568 d->extra.value().hasBackgroundHeight = false;
1569 }
1570
1571 d->removeImplicitSizeListener(d->background, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry);
1573 d->background = background;
1574
1575 if (background) {
1577 if (qFuzzyIsNull(background->z()))
1578 background->setZ(-1);
1580 if (p->widthValid() || p->heightValid()) {
1581 d->extra.value().hasBackgroundWidth = p->widthValid();
1582 d->extra.value().hasBackgroundHeight = p->heightValid();
1583 }
1584 if (isComponentComplete())
1585 d->resizeBackground();
1587 }
1588
1589 if (!qFuzzyCompare(oldImplicitBackgroundWidth, implicitBackgroundWidth()))
1590 emit implicitBackgroundWidthChanged();
1591 if (!qFuzzyCompare(oldImplicitBackgroundHeight, implicitBackgroundHeight()))
1592 emit implicitBackgroundHeightChanged();
1593 if (!d->background.isExecuting())
1595}
1596
1628{
1629 QQuickControlPrivate *d = const_cast<QQuickControlPrivate *>(d_func());
1630 if (!d->contentItem)
1631 d->setContentItem_helper(d->getContentItem(), false);
1632 return d->contentItem;
1633}
1634
1636{
1637 Q_D(QQuickControl);
1638 d->setContentItem_helper(item, true);
1639}
1640
1642{
1643 Q_D(const QQuickControl);
1644 return d->baselineOffset;
1645}
1646
1648{
1649 Q_D(QQuickControl);
1650 d->extra.value().hasBaselineOffset = true;
1652}
1653
1655{
1656 Q_D(QQuickControl);
1657 if (!d->extra.isAllocated() || !d->extra.value().hasBaselineOffset)
1658 return;
1659
1660 if (d->extra.isAllocated())
1661 d->extra.value().hasBaselineOffset = false;
1662 d->updateBaselineOffset();
1663}
1664
1675{
1676 Q_D(const QQuickControl);
1677 return d->getHorizontalPadding();
1678}
1679
1681{
1682 Q_D(QQuickControl);
1683 d->setHorizontalPadding(padding);
1684}
1685
1687{
1688 Q_D(QQuickControl);
1689 d->setHorizontalPadding(0, true);
1690}
1691
1702{
1703 Q_D(const QQuickControl);
1704 return d->getVerticalPadding();
1705}
1706
1708{
1709 Q_D(QQuickControl);
1710 d->setVerticalPadding(padding);
1711}
1712
1714{
1715 Q_D(QQuickControl);
1716 d->setVerticalPadding(0, true);
1717}
1718
1742{
1743 Q_D(const QQuickControl);
1744 return d->implicitContentWidth;
1745}
1746
1770{
1771 Q_D(const QQuickControl);
1772 return d->implicitContentHeight;
1773}
1774
1797{
1798 Q_D(const QQuickControl);
1799 if (!d->background)
1800 return 0;
1801 return d->background->implicitWidth();
1802}
1803
1826{
1827 Q_D(const QQuickControl);
1828 if (!d->background)
1829 return 0;
1830 return d->background->implicitHeight();
1831}
1832
1842{
1843 Q_D(const QQuickControl);
1844 return d->getTopInset();
1845}
1846
1848{
1849 Q_D(QQuickControl);
1850 d->setTopInset(inset);
1851}
1852
1854{
1855 Q_D(QQuickControl);
1856 d->setTopInset(0, true);
1857}
1858
1868{
1869 Q_D(const QQuickControl);
1870 return d->getLeftInset();
1871}
1872
1874{
1875 Q_D(QQuickControl);
1876 d->setLeftInset(inset);
1877}
1878
1880{
1881 Q_D(QQuickControl);
1882 d->setLeftInset(0, true);
1883}
1884
1894{
1895 Q_D(const QQuickControl);
1896 return d->getRightInset();
1897}
1898
1900{
1901 Q_D(QQuickControl);
1902 d->setRightInset(inset);
1903}
1904
1906{
1907 Q_D(QQuickControl);
1908 d->setRightInset(0, true);
1909}
1910
1920{
1921 Q_D(const QQuickControl);
1922 return d->getBottomInset();
1923}
1924
1926{
1927 Q_D(QQuickControl);
1928 d->setBottomInset(inset);
1929}
1930
1932{
1933 Q_D(QQuickControl);
1934 d->setBottomInset(0, true);
1935}
1936
1938{
1939 Q_D(QQuickControl);
1941 d->resolveFont();
1942}
1943
1945{
1946 Q_D(QQuickControl);
1947 d->executeBackground(true);
1948 d->executeContentItem(true);
1950 d->resizeBackground();
1951 d->resizeContent();
1952 d->updateBaselineOffset();
1953 if (!d->hasLocale)
1954 d->locale = QQuickControlPrivate::calcLocale(d->parentItem);
1955#if QT_CONFIG(quicktemplates2_hover)
1956 if (!d->explicitHoverEnabled)
1957 setAcceptHoverEvents(QQuickControlPrivate::calcHoverEnabled(d->parentItem));
1958#endif
1959#if QT_CONFIG(accessibility)
1960 if (QAccessible::isActive())
1961 accessibilityActiveChanged(true);
1962#endif
1963}
1964
1969
1971{
1972 Q_D(QQuickControl);
1973 Qt::FocusReason oldReason = static_cast<Qt::FocusReason>(d->focusReason);
1975 Qt::FocusReason reason = event->reason();
1976 if (isKeyFocusReason(oldReason) != isKeyFocusReason(reason))
1978}
1979
1981{
1982 Q_D(QQuickControl);
1983 Qt::FocusReason oldReason = static_cast<Qt::FocusReason>(d->focusReason);
1985 Qt::FocusReason reason = event->reason();
1986 if (isKeyFocusReason(oldReason) != isKeyFocusReason(reason))
1988}
1989
1990#if QT_CONFIG(quicktemplates2_hover)
1992{
1993 Q_D(QQuickControl);
1994 setHovered(d->hoverEnabled);
1995 event->ignore();
1996}
1997
1999{
2000 Q_D(QQuickControl);
2001 setHovered(d->hoverEnabled && contains(event->position()));
2002 event->ignore();
2003}
2004
2006{
2007 setHovered(false);
2008 event->ignore();
2009}
2010#endif
2011
2013{
2014 Q_D(QQuickControl);
2015 event->setAccepted(d->handlePress(event->position(), event->timestamp()));
2016}
2017
2019{
2020 Q_D(QQuickControl);
2021 event->setAccepted(d->handleMove(event->position(), event->timestamp()));
2022}
2023
2025{
2026 Q_D(QQuickControl);
2027 event->setAccepted(d->handleRelease(event->position(), event->timestamp()));
2028}
2029
2031{
2032 Q_D(QQuickControl);
2033 d->handleUngrab();
2034}
2035
2036#if QT_CONFIG(quicktemplates2_multitouch)
2038{
2039 Q_D(QQuickControl);
2040 switch (event->type()) {
2041 case QEvent::TouchBegin:
2043 case QEvent::TouchEnd:
2044 for (const QTouchEvent::TouchPoint &point : event->points()) {
2045 if (!d->acceptTouch(point))
2046 continue;
2047
2048 switch (point.state()) {
2050 d->handlePress(point.position(), event->timestamp());
2051 break;
2053 d->handleMove(point.position(), event->timestamp());
2054 break;
2056 d->handleRelease(point.position(), event->timestamp());
2057 break;
2058 default:
2059 break;
2060 }
2061 }
2062 break;
2063
2065 d->handleUngrab();
2066 break;
2067
2068 default:
2070 break;
2071 }
2072}
2073
2075{
2076 Q_D(QQuickControl);
2077 d->handleUngrab();
2078}
2079#endif
2080
2081#if QT_CONFIG(wheelevent)
2082void QQuickControl::wheelEvent(QWheelEvent *event)
2083{
2084 Q_D(QQuickControl);
2085 event->setAccepted(d->wheelEnabled);
2086}
2087#endif
2088
2089void QQuickControl::geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry)
2090{
2091 Q_D(QQuickControl);
2092 QQuickItem::geometryChange(newGeometry, oldGeometry);
2093 d->resizeBackground();
2094 d->resizeContent();
2095 if (!qFuzzyCompare(newGeometry.width(), oldGeometry.width()))
2097 if (!qFuzzyCompare(newGeometry.height(), oldGeometry.height()))
2099}
2100
2104
2105void QQuickControl::fontChange(const QFont &newFont, const QFont &oldFont)
2106{
2107 Q_UNUSED(newFont);
2108 Q_UNUSED(oldFont);
2109}
2110
2111#if QT_CONFIG(quicktemplates2_hover)
2112void QQuickControl::hoverChange()
2113{
2114}
2115#endif
2116
2121
2122void QQuickControl::spacingChange(qreal newSpacing, qreal oldSpacing)
2123{
2124 Q_UNUSED(newSpacing);
2125 Q_UNUSED(oldSpacing);
2126}
2127
2128void QQuickControl::paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding)
2129{
2130 Q_D(QQuickControl);
2131 Q_UNUSED(newPadding);
2132 Q_UNUSED(oldPadding);
2133 d->resizeContent();
2134 d->updateBaselineOffset();
2135}
2136
2138{
2139 Q_UNUSED(newItem);
2140 Q_UNUSED(oldItem);
2141}
2142
2143void QQuickControl::localeChange(const QLocale &newLocale, const QLocale &oldLocale)
2144{
2145 Q_UNUSED(newLocale);
2146 Q_UNUSED(oldLocale);
2147}
2148
2149void QQuickControl::insetChange(const QMarginsF &newInset, const QMarginsF &oldInset)
2150{
2151 Q_D(QQuickControl);
2152 Q_UNUSED(newInset);
2153 Q_UNUSED(oldInset);
2154 d->resizeBackground();
2155}
2156
2157#if QT_CONFIG(accessibility)
2158QAccessible::Role QQuickControl::accessibleRole() const
2159{
2160 return QAccessible::NoRole;
2161}
2162
2163void QQuickControl::accessibilityActiveChanged(bool active)
2164{
2165 Q_D(QQuickControl);
2166 if (!active)
2167 return;
2168
2169 QQuickAccessibleAttached *accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(this, true));
2170 Q_ASSERT(accessibleAttached);
2171 accessibleAttached->setRole(d->effectiveAccessibleRole());
2172}
2173#endif
2174
2176{
2177#if QT_CONFIG(accessibility)
2178 if (QQuickAccessibleAttached *accessibleAttached = QQuickControlPrivate::accessibleAttached(this))
2179 return accessibleAttached->name();
2180#endif
2181 return QString();
2182}
2183
2185{
2186#if QT_CONFIG(accessibility)
2187 if (QQuickAccessibleAttached *accessibleAttached = QQuickControlPrivate::accessibleAttached(this)) {
2188 if (!accessibleAttached->wasNameExplicitlySet())
2189 accessibleAttached->setNameImplicitly(name);
2190 }
2191#else
2192 Q_UNUSED(name);
2193#endif
2194}
2195
2197{
2198#if QT_CONFIG(accessibility)
2199 if (QAccessible::isActive())
2200 return QQuickAccessibleAttached::property(this, propertyName);
2201#endif
2202 Q_UNUSED(propertyName);
2203 return QVariant();
2204}
2205
2206bool QQuickControl::setAccessibleProperty(const char *propertyName, const QVariant &value)
2207{
2208#if QT_CONFIG(accessibility)
2209 if (QAccessible::isActive())
2210 return QQuickAccessibleAttached::setProperty(this, propertyName, value);
2211#endif
2212 Q_UNUSED(propertyName);
2213 Q_UNUSED(value);
2214 return false;
2215}
2216
2218
2219#include "moc_qquickcontrol_p.cpp"
The QEventPoint class provides information about a point in a QPointerEvent.
Definition qeventpoint.h:20
int id
the ID number of this event point.
Definition qeventpoint.h:24
State state
the current state of the event point.
Definition qeventpoint.h:26
QPointF position
the position of this point.
Definition qeventpoint.h:35
@ TouchCancel
Definition qcoreevent.h:264
@ TouchUpdate
Definition qcoreevent.h:242
@ TouchBegin
Definition qcoreevent.h:241
The QFocusEvent class contains event parameters for widget focus events.
Definition qevent.h:470
\reentrant
Definition qfont.h:22
void setResolveMask(uint mask)
Definition qfont.h:313
uint resolveMask() const
Definition qfont.h:312
QList< QGraphicsItem * > childItems() const
QGraphicsWidget * window() const
void setParentItem(QGraphicsItem *parent)
Sets this item's parent item to newParent.
QGraphicsItem * parentItem() const
Returns a pointer to this item's parent item.
void setVisible(bool visible)
If visible is true, the item is made visible.
static QStyleHints * styleHints()
Returns the application's style hints.
\inmodule QtGui
Definition qevent.h:246
\inmodule QtCore
Definition qmargins.h:270
\inmodule QtGui
Definition qevent.h:196
static QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
Definition qobject_p.h:299
\inmodule QtCore
Definition qobject.h:103
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2960
QVariant property(const char *name) const
Returns the value of the object's name property.
Definition qobject.cpp:4323
The QPalette class contains color groups for each widget state.
Definition qpalette.h:19
\inmodule QtCore\reentrant
Definition qpoint.h:217
void mirrorChange() override
void itemImplicitWidthChanged(QQuickItem *item) override
QQuickDeferredPointer< QQuickItem > background
virtual void resizeBackground()
static QLocale calcLocale(const QQuickItem *item)
void setTopPadding(qreal value, bool reset=false)
void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override
static void unhideOldItem(QQuickControl *control, QQuickItem *item, UnhideVisibility visibility=UnhideVisibility::Show)
void setFont_helper(const QFont &font)
void itemFocusChanged(QQuickItem *item, Qt::FocusReason reason) override
virtual bool handlePress(const QPointF &point, ulong timestamp)
QQuickDeferredPointer< QQuickItem > contentItem
virtual QQuickItem * getContentItem()
void setLeftInset(qreal value, bool reset=false)
void removeImplicitSizeListener(QQuickItem *item, ChangeTypes changes=ImplicitSizeChanges)
virtual void executeContentItem(bool complete=false)
void setHorizontalPadding(qreal value, bool reset=false)
qreal getRightInset() const
void setVerticalPadding(qreal value, bool reset=false)
void setBottomPadding(qreal value, bool reset=false)
static const ChangeTypes ImplicitSizeChanges
Abstract base type providing functionality common to all controls.
virtual void cancelContentItem()
static void updateLocaleRecur(QQuickItem *item, const QLocale &l)
void setTopInset(qreal value, bool reset=false)
void inheritFont(const QFont &font)
void addImplicitSizeListener(QQuickItem *item, ChangeTypes changes=ImplicitSizeChanges)
qreal getTopPadding() const
static void hideOldItem(QQuickItem *item)
void setRightPadding(qreal value, bool reset=false)
qreal getBottomInset() const
void setContentItem_helper(QQuickItem *item, bool notify=true)
QLazilyAllocated< ExtraData > extra
qreal getHorizontalPadding() const
virtual void handleUngrab()
void updateFont(const QFont &font)
void setLeftPadding(qreal value, bool reset=false)
QMarginsF getPadding() const
virtual bool handleRelease(const QPointF &point, ulong timestamp)
virtual void resolveFont()
static QFont parentFont(const QQuickItem *item)
virtual qreal getContentWidth() const
static void warnIfCustomizationNotSupported(QObject *control, QQuickItem *item, const QString &propertyName)
QMarginsF getInset() const
QPalette defaultPalette() const override
virtual void cancelBackground()
qreal getVerticalPadding() const
void updateLocale(const QLocale &l, bool e)
virtual void executeBackground(bool complete=false)
void setBottomInset(qreal value, bool reset=false)
void setRightInset(qreal value, bool reset=false)
void itemDestroyed(QQuickItem *item) override
virtual qreal getContentHeight() const
virtual void resizeContent()
virtual bool handleMove(const QPointF &point, ulong timestamp)
static QQuickControlPrivate * get(QQuickControl *control)
void itemImplicitHeightChanged(QQuickItem *item) override
static void updateFontRecur(QQuickItem *item, const QFont &font)
void focusInEvent(QFocusEvent *event) override
This event handler can be reimplemented in a subclass to receive focus-in events for an item.
QQuickControl(QQuickItem *parent=nullptr)
void mouseReleaseEvent(QMouseEvent *event) override
This event handler can be reimplemented in a subclass to receive mouse release events for an item.
void visualFocusChanged()
void setFocusReason(Qt::FocusReason reason)
void setTopPadding(qreal padding)
void setWheelEnabled(bool enabled)
void setFont(const QFont &font)
qreal implicitBackgroundHeight
void setBottomInset(qreal inset)
void focusReasonChanged()
virtual QFont defaultFont() const
void availableWidthChanged()
virtual void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
void mirroredChanged()
void setHoverEnabled(bool enabled)
virtual void spacingChange(qreal newSpacing, qreal oldSpacing)
void topPaddingChanged()
void maybeSetAccessibleName(const QString &name)
virtual void localeChange(const QLocale &newLocale, const QLocale &oldLocale)
void setLeftInset(qreal inset)
void setSpacing(qreal spacing)
virtual void insetChange(const QMarginsF &newInset, const QMarginsF &oldInset)
void wheelEnabledChanged()
QVariant accessibleProperty(const char *propertyName)
void hoveredChanged()
void baselineOffsetChanged()
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override
void setRightInset(qreal inset)
bool isWheelEnabled() const
\qmlproperty bool QtQuick.Controls::Control::wheelEnabled
qreal implicitBackgroundWidth
void setPadding(qreal padding)
bool hasVisualFocus() const
\qmlproperty bool QtQuick.Controls::Control::visualFocus \readonly
void rightPaddingChanged()
void setHorizontalPadding(qreal padding)
QQuickItem * contentItem
void bottomPaddingChanged()
virtual void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding)
void setHovered(bool hovered)
void setVerticalPadding(qreal padding)
qreal implicitContentWidth
void classBegin() override
Invoked after class creation, but before any properties have been set.
void resetHorizontalPadding()
void leftPaddingChanged()
void itemChange(ItemChange change, const ItemChangeData &value) override
Called when change occurs for this item.
void setBackground(QQuickItem *background)
void spacingChanged()
void mousePressEvent(QMouseEvent *event) override
This event handler can be reimplemented in a subclass to receive mouse press events for an item.
void setContentItem(QQuickItem *item)
bool isHovered() const
\qmlproperty bool QtQuick.Controls::Control::hovered \readonly
bool setAccessibleProperty(const char *propertyName, const QVariant &value)
void setRightPadding(qreal padding)
void paddingChanged()
QString accessibleName() const
void focusOutEvent(QFocusEvent *event) override
This event handler can be reimplemented in a subclass to receive focus-out events for an item.
void setBottomPadding(qreal padding)
bool isMirrored() const
\qmlproperty bool QtQuick.Controls::Control::mirrored \readonly
qreal implicitContentHeight
void setBaselineOffset(qreal offset)
virtual void enabledChange()
void setTopInset(qreal inset)
void resetVerticalPadding()
bool isHoverEnabled() const
\qmlproperty bool QtQuick.Controls::Control::hoverEnabled
void mouseMoveEvent(QMouseEvent *event) override
This event handler can be reimplemented in a subclass to receive mouse move events for an item.
virtual void fontChange(const QFont &newFont, const QFont &oldFont)
Qt::FocusReason focusReason
void backgroundChanged()
void availableHeightChanged()
void setLocale(const QLocale &locale)
virtual void mirrorChange()
void mouseUngrabEvent() override
This event handler can be reimplemented in a subclass to be notified when a mouse ungrab event has oc...
void setLeftPadding(qreal padding)
QQuickItem * background
QQuickWindow * window
void setLastFocusChangeReason(Qt::FocusReason reason)
quint32 componentComplete
static QQuickItemPrivate * get(QQuickItem *item)
QList< QQuickItem * > childItems
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
virtual void focusOutEvent(QFocusEvent *)
This event handler can be reimplemented in a subclass to receive focus-out events for an item.
void baselineOffsetChanged(qreal)
virtual void hoverEnterEvent(QHoverEvent *event)
This event handler can be reimplemented in a subclass to receive hover-enter events for an item.
void classBegin() override
\reimp Derived classes should call the base class method before adding their own action to perform at...
void setSize(const QSizeF &size)
virtual void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry)
qreal implicitWidth
Definition qquickitem.h:114
qreal x
\qmlproperty real QtQuick::Item::x \qmlproperty real QtQuick::Item::y \qmlproperty real QtQuick::Item...
Definition qquickitem.h:72
void setParentItem(QQuickItem *parent)
qreal z
\qmlproperty real QtQuick::Item::z
Definition qquickitem.h:74
void componentComplete() override
\reimp Derived classes should call the base class method before adding their own actions to perform a...
void setAcceptHoverEvents(bool enabled)
If enabled is true, this sets the item to accept hover events; otherwise, hover events are not accept...
virtual void hoverMoveEvent(QHoverEvent *event)
This event handler can be reimplemented in a subclass to receive hover-move events for an item.
qreal y
Defines the item's y position relative to its parent.
Definition qquickitem.h:73
qreal baselineOffset() const
\qmlproperty int QtQuick::Item::baselineOffset
virtual Q_INVOKABLE bool contains(const QPointF &point) const
\qmlmethod bool QtQuick::Item::contains(point point)
void setBaselineOffset(qreal)
qreal width
This property holds the width of this item.
Definition qquickitem.h:75
virtual void itemChange(ItemChange, const ItemChangeData &)
Called when change occurs for this item.
bool isComponentComplete() const
Returns true if construction of the QML component is complete; otherwise returns false.
virtual void touchUngrabEvent()
This event handler can be reimplemented in a subclass to be notified when a touch ungrab event has oc...
qreal implicitHeight
Definition qquickitem.h:115
virtual void touchEvent(QTouchEvent *event)
This event handler can be reimplemented in a subclass to receive touch events for an item.
qreal height
This property holds the height of this item.
Definition qquickitem.h:76
void setPosition(const QPointF &)
void setZ(qreal)
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
Definition qquickitem.h:144
@ ItemVisibleHasChanged
Definition qquickitem.h:148
@ ItemActiveFocusHasChanged
Definition qquickitem.h:151
@ ItemEnabledHasChanged
Definition qquickitem.h:155
@ ItemParentHasChanged
Definition qquickitem.h:149
virtual void focusInEvent(QFocusEvent *)
This event handler can be reimplemented in a subclass to receive focus-in events for an item.
friend class QQuickAccessibleAttached
Definition qquickitem.h:479
bool enabled
\qmlproperty bool QtQuick::Item::enabled
Definition qquickitem.h:79
virtual void hoverLeaveEvent(QHoverEvent *event)
This event handler can be reimplemented in a subclass to receive hover-leave events for an item.
static QQuickLabelPrivate * get(QQuickLabel *item)
static QQuickTextAreaPrivate * get(QQuickTextArea *item)
static QQuickTextFieldPrivate * get(QQuickTextField *item)
static QPalette palette(Scope scope)
static QFont font(Scope scope)
\inmodule QtCore\reentrant
Definition qrect.h:484
constexpr qreal height() const noexcept
Returns the height of the rectangle.
Definition qrect.h:732
constexpr qreal width() const noexcept
Returns the width of the rectangle.
Definition qrect.h:729
\inmodule QtCore
Definition qsize.h:208
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QTouchEvent class contains parameters that describe a touch event.
Definition qevent.h:917
\inmodule QtCore
Definition qvariant.h:65
QLocale toLocale() const
Returns the variant as a QLocale if the variant has userType() \l QMetaType::QLocale; otherwise retur...
bool toBool() const
Returns the variant as a bool if the variant has userType() Bool.
qreal spacing
Combined button and popup list for selecting options.
Definition qcompare.h:63
FocusReason
@ BacktabFocusReason
@ TabFocusReason
@ ShortcutFocusReason
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
Definition qfloat16.h:333
bool qFuzzyIsNull(qfloat16 f) noexcept
Definition qfloat16.h:349
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
static Q_DECL_CONST_FUNCTION bool qt_is_nan(double d)
Definition qnumeric_p.h:112
GLsizei const GLfloat * v
[13]
GLint GLsizei GLsizei height
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLint GLsizei width
GLuint GLsizei const GLchar * label
[43]
GLenum GLuint GLintptr offset
GLuint name
struct _cl_event * event
GLfixed GLfixed GLint GLint GLfixed points
GLboolean reset
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
GLfloat GLfloat p
[1]
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
static bool isKeyFocusReason(Qt::FocusReason reason)
static QString contentItemName()
void quickCancelDeferred(QObject *object, const QString &property)
void quickCompleteDeferred(QObject *object, const QString &property, QQuickDeferredPointer< T > &delegate)
void quickBeginDeferred(QObject *object, const QString &property, QQuickDeferredPointer< T > &delegate)
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define QStringLiteral(str)
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept
#define emit
#define Q_UNUSED(x)
static QString backgroundName()
unsigned long ulong
Definition qtypes.h:35
double qreal
Definition qtypes.h:187
myObject disconnect()
[26]
QGraphicsItem * item
QLayoutItem * child
[0]
\inmodule QtQuick
Definition qquickitem.h:159