Qt 6.x
The Qt SDK
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
131{
132}
133
135{
136 Q_Q(QQuickControl);
138}
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
155static void setActiveFocus(QQuickControl *control, Qt::FocusReason reason)
156{
158 if (d->subFocusItem && d->window && d->flags & QQuickItem::ItemIsFocusScope)
159 QQuickWindowPrivate::get(d->window)->clearFocusInScope(control, d->subFocusItem, reason);
160 control->forceActiveFocus(reason);
161}
162
164{
165 Q_Q(QQuickControl);
166 if ((focusPolicy & Qt::ClickFocus) == Qt::ClickFocus && !QGuiApplication::styleHints()->setFocusOnTouchRelease()) {
168 return true;
169 }
170 return true;
171}
172
174{
175#if QT_CONFIG(quicktemplates2_hover)
176 Q_Q(QQuickControl);
177 q->setHovered(hoverEnabled && q->contains(point));
178#else
179 Q_UNUSED(point);
180#endif
181 return true;
182}
183
185{
186 Q_Q(QQuickControl);
187 bool accepted = true;
188 if ((focusPolicy & Qt::ClickFocus) == Qt::ClickFocus && QGuiApplication::styleHints()->setFocusOnTouchRelease()) {
190 accepted = true;
191 }
192 touchId = -1;
193 return accepted;
194}
195
197{
198 touchId = -1;
199}
200
202{
203 Q_Q(QQuickControl);
204 q->mirrorChange();
205}
206
208{
209 Q_Q(QQuickControl);
210 const QMarginsF oldPadding = getPadding();
211 extra.value().topPadding = value;
212 extra.value().hasTopPadding = !reset;
213 if ((!reset && !qFuzzyCompare(oldPadding.top(), value)) || (reset && !qFuzzyCompare(oldPadding.top(), getVerticalPadding()))) {
214 emit q->topPaddingChanged();
215 emit q->availableHeightChanged();
216 q->paddingChange(getPadding(), oldPadding);
217 }
218}
219
221{
222 Q_Q(QQuickControl);
223 const QMarginsF oldPadding = getPadding();
224 extra.value().leftPadding = value;
225 extra.value().hasLeftPadding = !reset;
226 if ((!reset && !qFuzzyCompare(oldPadding.left(), value)) || (reset && !qFuzzyCompare(oldPadding.left(), getHorizontalPadding()))) {
227 emit q->leftPaddingChanged();
228 emit q->availableWidthChanged();
229 q->paddingChange(getPadding(), oldPadding);
230 }
231}
232
234{
235 Q_Q(QQuickControl);
236 const QMarginsF oldPadding = getPadding();
237 extra.value().rightPadding = value;
238 extra.value().hasRightPadding = !reset;
239 if ((!reset && !qFuzzyCompare(oldPadding.right(), value)) || (reset && !qFuzzyCompare(oldPadding.right(), getHorizontalPadding()))) {
240 emit q->rightPaddingChanged();
241 emit q->availableWidthChanged();
242 q->paddingChange(getPadding(), oldPadding);
243 }
244}
245
247{
248 Q_Q(QQuickControl);
249 const QMarginsF oldPadding = getPadding();
250 extra.value().bottomPadding = value;
251 extra.value().hasBottomPadding = !reset;
252 if ((!reset && !qFuzzyCompare(oldPadding.bottom(), value)) || (reset && !qFuzzyCompare(oldPadding.bottom(), getVerticalPadding()))) {
253 emit q->bottomPaddingChanged();
254 emit q->availableHeightChanged();
255 q->paddingChange(getPadding(), oldPadding);
256 }
257}
258
260{
261 Q_Q(QQuickControl);
262 const QMarginsF oldPadding = getPadding();
263 const qreal oldHorizontalPadding = getHorizontalPadding();
266 if ((!reset && !qFuzzyCompare(oldHorizontalPadding, value)) || (reset && !qFuzzyCompare(oldHorizontalPadding, padding))) {
267 const QMarginsF newPadding = getPadding();
268 if (!qFuzzyCompare(newPadding.left(), oldPadding.left()))
269 emit q->leftPaddingChanged();
270 if (!qFuzzyCompare(newPadding.right(), oldPadding.right()))
271 emit q->rightPaddingChanged();
272 emit q->horizontalPaddingChanged();
273 emit q->availableWidthChanged();
274 q->paddingChange(newPadding, oldPadding);
275 }
276}
277
279{
280 Q_Q(QQuickControl);
281 const QMarginsF oldPadding = getPadding();
282 const qreal oldVerticalPadding = getVerticalPadding();
285 if ((!reset && !qFuzzyCompare(oldVerticalPadding, value)) || (reset && !qFuzzyCompare(oldVerticalPadding, padding))) {
286 const QMarginsF newPadding = getPadding();
287 if (!qFuzzyCompare(newPadding.top(), oldPadding.top()))
288 emit q->topPaddingChanged();
289 if (!qFuzzyCompare(newPadding.bottom(), oldPadding.bottom()))
290 emit q->bottomPaddingChanged();
291 emit q->verticalPaddingChanged();
292 emit q->availableHeightChanged();
293 q->paddingChange(newPadding, oldPadding);
294 }
295}
296
298{
299 Q_Q(QQuickControl);
300 const QMarginsF oldInset = getInset();
301 extra.value().topInset = value;
302 extra.value().hasTopInset = !reset;
303 if (!qFuzzyCompare(oldInset.top(), value)) {
304 emit q->topInsetChanged();
305 q->insetChange(getInset(), oldInset);
306 }
307}
308
310{
311 Q_Q(QQuickControl);
312 const QMarginsF oldInset = getInset();
313 extra.value().leftInset = value;
314 extra.value().hasLeftInset = !reset;
315 if (!qFuzzyCompare(oldInset.left(), value)) {
316 emit q->leftInsetChanged();
317 q->insetChange(getInset(), oldInset);
318 }
319}
320
322{
323 Q_Q(QQuickControl);
324 const QMarginsF oldInset = getInset();
325 extra.value().rightInset = value;
326 extra.value().hasRightInset = !reset;
327 if (!qFuzzyCompare(oldInset.right(), value)) {
328 emit q->rightInsetChanged();
329 q->insetChange(getInset(), oldInset);
330 }
331}
332
334{
335 Q_Q(QQuickControl);
336 const QMarginsF oldInset = getInset();
337 extra.value().bottomInset = value;
338 extra.value().hasBottomInset = !reset;
339 if (!qFuzzyCompare(oldInset.bottom(), value)) {
340 emit q->bottomInsetChanged();
341 q->insetChange(getInset(), oldInset);
342 }
343}
344
346{
347 if (!background)
348 return;
349
350 resizingBackground = true;
351
353 bool changeWidth = false;
354 bool changeHeight = false;
355 if (((!p->widthValid() || !extra.isAllocated() || !extra->hasBackgroundWidth) && qFuzzyIsNull(background->x()))
356 || (extra.isAllocated() && (extra->hasLeftInset || extra->hasRightInset))) {
358 changeWidth = !p->width.hasBinding();
359 }
360 if (((!p->heightValid() || !extra.isAllocated() || !extra->hasBackgroundHeight) && qFuzzyIsNull(background->y()))
361 || (extra.isAllocated() && (extra->hasTopInset || extra->hasBottomInset))) {
363 changeHeight = !p->height.hasBinding();
364 }
365 if (changeHeight || changeWidth) {
366 auto newWidth = changeWidth ?
367 width.valueBypassingBindings() - getLeftInset() - getRightInset() :
368 p->width.valueBypassingBindings();
369 auto newHeight = changeHeight ?
370 height.valueBypassingBindings() - getTopInset() - getBottomInset() :
371 p->height.valueBypassingBindings();
372 background->setSize({newWidth, newHeight});
373 }
374
375 resizingBackground = false;
376}
377
379{
380 Q_Q(QQuickControl);
381 if (contentItem) {
382 contentItem->setPosition(QPointF(q->leftPadding(), q->topPadding()));
383 contentItem->setSize(QSizeF(q->availableWidth(), q->availableHeight()));
384 }
385}
386
388{
389 if (!contentItem)
391 return contentItem;
392}
393
395{
396 Q_Q(QQuickControl);
397 if (contentItem == item)
398 return;
399
400 if (notify)
402
405
406 QQuickItem *oldContentItem = contentItem;
407 if (oldContentItem) {
409 if (oldContentItem)
411 removeImplicitSizeListener(oldContentItem);
412 }
413
415 q->contentItemChange(item, oldContentItem);
416 QQuickControlPrivate::hideOldItem(oldContentItem);
417
418 if (item) {
420 // We need to update the control's focusReason when the contentItem receives or loses focus. Since focusPolicy
421 // (or other properties impacting focus handling, like QQuickItem::activeFocusOnTab) might change later, and
422 // since the content item might also change focus programmatically, we always have to listen for those events.
424 if (!item->parentItem())
429 }
430
433
434 if (notify && !contentItem.isExecuting())
435 emit q->contentItemChanged();
436}
437
439{
440 return contentItem ? contentItem->implicitWidth() : 0;
441}
442
444{
445 return contentItem ? contentItem->implicitHeight() : 0;
446}
447
449{
450 Q_Q(QQuickControl);
451 const qreal oldWidth = implicitContentWidth;
453 if (!qFuzzyCompare(implicitContentWidth, oldWidth))
454 emit q->implicitContentWidthChanged();
455}
456
458{
459 Q_Q(QQuickControl);
460 const qreal oldHeight = implicitContentHeight;
462 if (!qFuzzyCompare(implicitContentHeight, oldHeight))
463 emit q->implicitContentHeightChanged();
464}
465
467{
468 Q_Q(QQuickControl);
469 const qreal oldWidth = implicitContentWidth;
470 const qreal oldHeight = implicitContentHeight;
473 if (!qFuzzyCompare(implicitContentWidth, oldWidth))
474 emit q->implicitContentWidthChanged();
475 if (!qFuzzyCompare(implicitContentHeight, oldHeight))
476 emit q->implicitContentHeightChanged();
477}
478
480{
482}
483
484#if QT_CONFIG(accessibility)
485void QQuickControlPrivate::accessibilityActiveChanged(bool active)
486{
487 Q_Q(QQuickControl);
488 return q->accessibilityActiveChanged(active);
489}
490
491QAccessible::Role QQuickControlPrivate::accessibleRole() const
492{
493 Q_Q(const QQuickControl);
494 return q->accessibleRole();
495}
496
497QQuickAccessibleAttached *QQuickControlPrivate::accessibleAttached(const QObject *object)
498{
499 if (!QAccessible::isActive())
500 return nullptr;
501 return QQuickAccessibleAttached::attachedProperties(object);
502}
503#endif
504
512{
514 while (p) {
515 if (QQuickControl *control = qobject_cast<QQuickControl *>(p))
517 else if (QQuickLabel *label = qobject_cast<QQuickLabel *>(p))
518 return label->QQuickText::font();
519 else if (QQuickTextField *textField = qobject_cast<QQuickTextField *>(p))
520 return textField->QQuickTextInput::font();
521 else if (QQuickTextArea *textArea = qobject_cast<QQuickTextArea *>(p))
522 return textArea->QQuickTextEdit::font();
523
524 p = p->parentItem();
525 }
526
527 if (QQuickApplicationWindow *window = qobject_cast<QQuickApplicationWindow *>(item->window()))
528 return window->font();
529
531}
532
542{
543 Q_Q(QQuickControl);
545}
546
548{
549 Q_Q(QQuickControl);
550 QFont parentFont = extra.isAllocated() ? extra->requestedFont.resolve(font) : font;
551 parentFont.setResolveMask(extra.isAllocated() ? extra->requestedFont.resolveMask() | font.resolveMask() : font.resolveMask());
552
553 const QFont defaultFont = q->defaultFont();
554 QFont resolvedFont = parentFont.resolve(defaultFont);
555
557}
558
565{
566 Q_Q(QQuickControl);
567 QFont oldFont = resolvedFont;
569
570 if (oldFont != font)
571 q->fontChange(font, oldFont);
572
574
575 if (oldFont != font)
576 emit q->fontChanged();
577}
578
580{
581 const auto childItems = item->childItems();
582 for (QQuickItem *child : childItems) {
583 if (QQuickControl *control = qobject_cast<QQuickControl *>(child))
585 else if (QQuickLabel *label = qobject_cast<QQuickLabel *>(child))
587 else if (QQuickTextArea *textArea = qobject_cast<QQuickTextArea *>(child))
589 else if (QQuickTextField *textField = qobject_cast<QQuickTextField *>(child))
591 else
593 }
594}
595
597{
598 const QQuickItem *p = item;
599 while (p) {
600 if (const QQuickControl *control = qobject_cast<const QQuickControl *>(p))
601 return control->locale();
602
603 QVariant v = p->property("locale");
604 if (v.isValid() && v.userType() == QMetaType::QLocale)
605 return v.toLocale();
606
607 p = p->parentItem();
608 }
609
610 if (item) {
611 if (QQuickApplicationWindow *window = qobject_cast<QQuickApplicationWindow *>(item->window()))
612 return window->locale();
613 }
614
615 return QLocale();
616}
617
634{
635 static const bool ignoreWarnings = [](){
636 return qEnvironmentVariableIntValue("QT_QUICK_CONTROLS_IGNORE_CUSTOMIZATION_WARNINGS");
637 }();
638 if (ignoreWarnings)
639 return;
640
641 if (!control->property("__notCustomizable").toBool()
642 || (item && item->property("__ignoreNotCustomizable").toBool()))
643 return;
644
645 qmlWarning(item ? item : control).nospace() << "The current style does not support customization of this control "
646 << "(property: " << propertyName << " item: " << item << "). "
647 "Please customize a non-native style (such as Basic, Fusion, Material, etc). For more information, see: "
648 "https://doc.qt.io/qt-6/qtquickcontrols2-customize.html#customization-reference";
649}
650
652{
653 Q_Q(QQuickControl);
654 if (!e && hasLocale)
655 return;
656
657 QLocale old = q->locale();
658 hasLocale = e;
659 if (old != l) {
660 locale = l;
661 q->localeChange(l, old);
663 emit q->localeChanged();
664 }
665}
666
668{
669 const auto childItems = item->childItems();
670 for (QQuickItem *child : childItems) {
671 if (QQuickControl *control = qobject_cast<QQuickControl *>(child))
672 QQuickControlPrivate::get(control)->updateLocale(l, false);
673 else
675 }
676}
677
678#if QT_CONFIG(quicktemplates2_hover)
679void QQuickControlPrivate::updateHoverEnabled(bool enabled, bool xplicit)
680{
681 Q_Q(QQuickControl);
682 if (!xplicit && explicitHoverEnabled)
683 return;
684
685 bool wasEnabled = q->isHoverEnabled();
686 explicitHoverEnabled = xplicit;
687 if (wasEnabled != enabled) {
688 q->setAcceptHoverEvents(enabled);
689 QQuickControlPrivate::updateHoverEnabledRecur(q, enabled);
690 emit q->hoverEnabledChanged();
691 }
692}
693
694void QQuickControlPrivate::updateHoverEnabledRecur(QQuickItem *item, bool enabled)
695{
696 const auto childItems = item->childItems();
697 for (QQuickItem *child : childItems) {
698 if (QQuickControl *control = qobject_cast<QQuickControl *>(child))
699 QQuickControlPrivate::get(control)->updateHoverEnabled(enabled, false);
700 else
701 updateHoverEnabledRecur(child, enabled);
702 }
703}
704
705bool QQuickControlPrivate::calcHoverEnabled(const QQuickItem *item)
706{
707 const QQuickItem *p = item;
708 while (p) {
709 // QQuickPopupItem accepts hover events to avoid leaking them through.
710 // Don't inherit that to the children of the popup, but fallback to the
711 // environment variable or style hint.
712 if (qobject_cast<const QQuickPopupItem *>(p))
713 break;
714
715 if (const QQuickControl *control = qobject_cast<const QQuickControl *>(p))
716 return control->isHoverEnabled();
717
718 QVariant v = p->property("hoverEnabled");
719 if (v.isValid() && v.userType() == QMetaType::Bool)
720 return v.toBool();
721
722 p = p->parentItem();
723 }
724
725 bool ok = false;
726 int env = qEnvironmentVariableIntValue("QT_QUICK_CONTROLS_HOVER_ENABLED", &ok);
727 if (ok)
728 return env != 0;
729
730 // TODO: QQuickApplicationWindow::isHoverEnabled()
731
733}
734#endif
735
736static inline QString contentItemName() { return QStringLiteral("contentItem"); }
737
739{
740 Q_Q(QQuickControl);
742}
743
745{
746 Q_Q(QQuickControl);
748 return;
749
750 if (!contentItem || complete)
752 if (complete)
754}
755
757{
758 Q_Q(QQuickControl);
760}
761
763{
764 Q_Q(QQuickControl);
766 return;
767
768 if (!background || complete)
770 if (complete)
772}
773
774/*
775 \internal
776
777 Hides an item that was replaced by a newer one, rather than
778 deleting it, as the item is typically created in QML and hence
779 we don't own it.
780*/
782{
783 if (!item)
784 return;
785
786 qCDebug(lcItemManagement) << "hiding old item" << item;
787
788 item->setVisible(false);
789 item->setParentItem(nullptr);
790
791#if QT_CONFIG(accessibility)
792 // Remove the item from the accessibility tree.
793 QQuickAccessibleAttached *accessible = accessibleAttached(item);
794 if (accessible)
795 accessible->setIgnored(true);
796#endif
797}
798
799/*
800 \internal
801
802 Named "unhide" because it's used for cases where an item
803 that was previously hidden by \l hideOldItem() wants to be
804 shown by a control again, such as a ScrollBar in ScrollView.
805
806 \a visibility controls the visibility of \a item, as there
807 may have been bindings that controlled visibility, such as
808 with a typical ScrollBar.qml implementation:
809
810 \code
811 visible: control.policy !== T.ScrollBar.AlwaysOff
812 \endcode
813
814 In the future we could try to save the binding for the visible
815 property (using e.g. QQmlAnyBinding::takeFrom), but for now we
816 keep it simple and just allow restoring an equivalent literal value.
817*/
819{
820 Q_ASSERT(item);
821 qCDebug(lcItemManagement) << "unhiding old item" << item;
822
823 item->setVisible(visibility == UnhideVisibility::Show);
824 item->setParentItem(control);
825
826#if QT_CONFIG(accessibility)
827 // Add the item back in to the accessibility tree.
828 QQuickAccessibleAttached *accessible = accessibleAttached(item);
829 if (accessible)
830 accessible->setIgnored(false);
831#endif
832}
833
835{
836 Q_Q(QQuickControl);
837 if (extra.isAllocated() && extra.value().hasBaselineOffset)
838 return;
839
840 if (!contentItem)
841 q->QQuickItem::setBaselineOffset(0);
842 else
843 q->QQuickItem::setBaselineOffset(getTopPadding() + contentItem->baselineOffset());
844}
845
847{
848 addImplicitSizeListener(item, this, changes);
849}
850
852{
853 removeImplicitSizeListener(item, this, changes);
854}
855
857{
858 if (!item || !listener)
859 return;
861}
862
864{
865 if (!item || !listener)
866 return;
868}
869
871{
872 Q_Q(QQuickControl);
873 if (item == background)
874 emit q->implicitBackgroundWidthChanged();
875 else if (item == contentItem)
877}
878
880{
881 Q_Q(QQuickControl);
882 if (item == background)
883 emit q->implicitBackgroundHeightChanged();
884 else if (item == contentItem)
886}
887
889{
890 Q_UNUSED(diff);
891 if (resizingBackground || item != background || !change.sizeChange())
892 return;
893
895 // Only set hasBackgroundWidth/Height if it was a width/height change,
896 // otherwise we're prevented from setting a width/height in the future.
897 if (change.widthChange())
898 extra.value().hasBackgroundWidth = p->widthValid();
899 if (change.heightChange())
900 extra.value().hasBackgroundHeight = p->heightValid();
902}
903
905{
906 Q_Q(QQuickControl);
907 if (item == background) {
908 background = nullptr;
909 emit q->implicitBackgroundWidthChanged();
910 emit q->implicitBackgroundHeightChanged();
911 } else if (item == contentItem) {
912 contentItem = nullptr;
914 }
915}
916
918{
919 Q_Q(QQuickControl);
920 if (item == contentItem || item == q)
921 q->setFocusReason(reason);
922}
923
926{
927 Q_D(QQuickControl);
928 d->init();
929}
930
932 : QQuickItem(dd, parent)
933{
934 Q_D(QQuickControl);
935 d->init();
936}
937
939{
940 Q_D(QQuickControl);
941 d->removeImplicitSizeListener(d->background, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry);
942 d->removeImplicitSizeListener(d->contentItem);
943 if (d->contentItem)
945#if QT_CONFIG(accessibility)
946 QAccessible::removeActivationObserver(d);
947#endif
948}
949
951{
952 Q_D(QQuickControl);
954 switch (change) {
957 break;
959#if QT_CONFIG(quicktemplates2_hover)
960 if (!value.boolValue)
961 setHovered(false);
962#endif
963 break;
964 case ItemSceneChange:
966 if ((change == ItemParentHasChanged && value.item) || (change == ItemSceneChange && value.window)) {
967 d->resolveFont();
968 if (!d->hasLocale)
969 d->updateLocale(QQuickControlPrivate::calcLocale(d->parentItem), false); // explicit=false
970#if QT_CONFIG(quicktemplates2_hover)
971 if (!d->explicitHoverEnabled)
972 d->updateHoverEnabled(QQuickControlPrivate::calcHoverEnabled(d->parentItem), false); // explicit=false
973#endif
974 }
975 break;
977 if (isKeyFocusReason(d->focusReason))
979 break;
980 default:
981 break;
982 }
983}
984
1030{
1031 Q_D(const QQuickControl);
1032 QFont font = d->resolvedFont;
1033 // The resolveMask should inherit from the requestedFont
1034 font.setResolveMask(d->extra.value().requestedFont.resolveMask());
1035 return font;
1036}
1037
1039{
1040 Q_D(QQuickControl);
1041 if (d->extra.value().requestedFont.resolveMask() == font.resolveMask() && d->extra.value().requestedFont == font)
1042 return;
1043
1044 d->extra.value().requestedFont = font;
1045 d->resolveFont();
1046}
1047
1049{
1050 setFont(QFont());
1051}
1052
1063{
1064 return qMax<qreal>(0.0, width() - leftPadding() - rightPadding());
1065}
1066
1077{
1078 return qMax<qreal>(0.0, height() - topPadding() - bottomPadding());
1079}
1080
1121{
1122 Q_D(const QQuickControl);
1123 return d->padding;
1124}
1125
1127{
1128 Q_D(QQuickControl);
1129 if (qFuzzyCompare(d->padding, padding))
1130 return;
1131
1132 const QMarginsF oldPadding = d->getPadding();
1133 const qreal oldVerticalPadding = d->getVerticalPadding();
1134 const qreal oldHorizontalPadding = d->getHorizontalPadding();
1135
1136 d->padding = padding;
1138
1139 const QMarginsF newPadding = d->getPadding();
1140 const qreal newVerticalPadding = d->getVerticalPadding();
1141 const qreal newHorizontalPadding = d->getHorizontalPadding();
1142
1143 if (!qFuzzyCompare(newPadding.top(), oldPadding.top()))
1145 if (!qFuzzyCompare(newPadding.left(), oldPadding.left()))
1147 if (!qFuzzyCompare(newPadding.right(), oldPadding.right()))
1149 if (!qFuzzyCompare(newPadding.bottom(), oldPadding.bottom()))
1151 if (!qFuzzyCompare(newVerticalPadding, oldVerticalPadding))
1152 emit verticalPaddingChanged();
1153 if (!qFuzzyCompare(newHorizontalPadding, oldHorizontalPadding))
1154 emit horizontalPaddingChanged();
1155 if (!qFuzzyCompare(newPadding.top(), oldPadding.top()) || !qFuzzyCompare(newPadding.bottom(), oldPadding.bottom()))
1157 if (!qFuzzyCompare(newPadding.left(), oldPadding.left()) || !qFuzzyCompare(newPadding.right(), oldPadding.right()))
1159
1160 paddingChange(newPadding, oldPadding);
1161}
1162
1164{
1165 setPadding(0);
1166}
1167
1177{
1178 Q_D(const QQuickControl);
1179 return d->getTopPadding();
1180}
1181
1183{
1184 Q_D(QQuickControl);
1185 d->setTopPadding(padding);
1186}
1187
1189{
1190 Q_D(QQuickControl);
1191 d->setTopPadding(0, true);
1192}
1193
1203{
1204 Q_D(const QQuickControl);
1205 return d->getLeftPadding();
1206}
1207
1209{
1210 Q_D(QQuickControl);
1211 d->setLeftPadding(padding);
1212}
1213
1215{
1216 Q_D(QQuickControl);
1217 d->setLeftPadding(0, true);
1218}
1219
1229{
1230 Q_D(const QQuickControl);
1231 return d->getRightPadding();
1232}
1233
1235{
1236 Q_D(QQuickControl);
1237 d->setRightPadding(padding);
1238}
1239
1241{
1242 Q_D(QQuickControl);
1243 d->setRightPadding(0, true);
1244}
1245
1255{
1256 Q_D(const QQuickControl);
1257 return d->getBottomPadding();
1258}
1259
1261{
1262 Q_D(QQuickControl);
1263 d->setBottomPadding(padding);
1264}
1265
1267{
1268 Q_D(QQuickControl);
1269 d->setBottomPadding(0, true);
1270}
1271
1284{
1285 Q_D(const QQuickControl);
1286 return d->spacing;
1287}
1288
1290{
1291 Q_D(QQuickControl);
1292 if (qFuzzyCompare(d->spacing, spacing))
1293 return;
1294
1295 qreal oldSpacing = d->spacing;
1296 d->spacing = spacing;
1298 spacingChange(spacing, oldSpacing);
1299}
1300
1302{
1303 setSpacing(0);
1304}
1305
1322{
1323 Q_D(const QQuickControl);
1324 return d->locale;
1325}
1326
1328{
1329 Q_D(QQuickControl);
1330 if (d->hasLocale && d->locale == locale)
1331 return;
1332
1333 d->updateLocale(locale, true); // explicit=true
1334}
1335
1337{
1338 Q_D(QQuickControl);
1339 if (!d->hasLocale)
1340 return;
1341
1342 d->hasLocale = false;
1343 d->updateLocale(QQuickControlPrivate::calcLocale(d->parentItem), false); // explicit=false
1344}
1345
1361{
1362 Q_D(const QQuickControl);
1363 return d->isMirrored();
1364}
1365
1378{
1379 Q_D(const QQuickControl);
1380 uint policy = d->focusPolicy;
1381 if (activeFocusOnTab())
1383 return static_cast<Qt::FocusPolicy>(policy);
1384}
1385
1387{
1388 Q_D(QQuickControl);
1389 if (d->focusPolicy == policy)
1390 return;
1391
1392 d->focusPolicy = policy;
1395}
1396
1406{
1407 Q_D(const QQuickControl);
1408 return d->focusReason;
1409}
1410
1412{
1413 Q_D(QQuickControl);
1414 if (d->focusReason == reason)
1415 return;
1416
1417 Qt::FocusReason oldReason = d->focusReason;
1418 d->focusReason = reason;
1420 if (isKeyFocusReason(oldReason) != isKeyFocusReason(reason))
1422}
1423
1439{
1440 Q_D(const QQuickControl);
1441 return d->activeFocus && isKeyFocusReason(d->focusReason);
1442}
1443
1453{
1454#if QT_CONFIG(quicktemplates2_hover)
1455 Q_D(const QQuickControl);
1456 return d->hovered;
1457#else
1458 return false;
1459#endif
1460}
1461
1463{
1464#if QT_CONFIG(quicktemplates2_hover)
1465 Q_D(QQuickControl);
1466 if (hovered == d->hovered)
1467 return;
1468
1469 d->hovered = hovered;
1471 hoverChange();
1472#else
1474#endif
1475}
1476
1493{
1494#if QT_CONFIG(quicktemplates2_hover)
1495 Q_D(const QQuickControl);
1496 return d->hoverEnabled;
1497#else
1498 return false;
1499#endif
1500}
1501
1503{
1504#if QT_CONFIG(quicktemplates2_hover)
1505 Q_D(QQuickControl);
1506 if (d->explicitHoverEnabled && enabled == d->hoverEnabled)
1507 return;
1508
1509 d->updateHoverEnabled(enabled, true); // explicit=true
1510#else
1512#endif
1513}
1514
1516{
1517#if QT_CONFIG(quicktemplates2_hover)
1518 Q_D(QQuickControl);
1519 if (!d->explicitHoverEnabled)
1520 return;
1521
1522 d->explicitHoverEnabled = false;
1523 d->updateHoverEnabled(QQuickControlPrivate::calcHoverEnabled(d->parentItem), false); // explicit=false
1524#endif
1525}
1526
1537{
1538 Q_D(const QQuickControl);
1539 return d->wheelEnabled;
1540}
1541
1543{
1544 Q_D(QQuickControl);
1545 if (d->wheelEnabled == enabled)
1546 return;
1547
1548 d->wheelEnabled = enabled;
1550}
1551
1575{
1576 QQuickControlPrivate *d = const_cast<QQuickControlPrivate *>(d_func());
1577 if (!d->background)
1578 d->executeBackground();
1579 return d->background;
1580}
1581
1583{
1584 Q_D(QQuickControl);
1585 if (d->background == background)
1586 return;
1587
1589
1590 if (!d->background.isExecuting())
1591 d->cancelBackground();
1592
1593 const qreal oldImplicitBackgroundWidth = implicitBackgroundWidth();
1594 const qreal oldImplicitBackgroundHeight = implicitBackgroundHeight();
1595
1596 if (d->extra.isAllocated()) {
1597 d->extra.value().hasBackgroundWidth = false;
1598 d->extra.value().hasBackgroundHeight = false;
1599 }
1600
1601 d->removeImplicitSizeListener(d->background, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry);
1603 d->background = background;
1604
1605 if (background) {
1607 if (qFuzzyIsNull(background->z()))
1608 background->setZ(-1);
1610 if (p->widthValid() || p->heightValid()) {
1611 d->extra.value().hasBackgroundWidth = p->widthValid();
1612 d->extra.value().hasBackgroundHeight = p->heightValid();
1613 }
1614 if (isComponentComplete())
1615 d->resizeBackground();
1617 }
1618
1619 if (!qFuzzyCompare(oldImplicitBackgroundWidth, implicitBackgroundWidth()))
1620 emit implicitBackgroundWidthChanged();
1621 if (!qFuzzyCompare(oldImplicitBackgroundHeight, implicitBackgroundHeight()))
1622 emit implicitBackgroundHeightChanged();
1623 if (!d->background.isExecuting())
1625}
1626
1658{
1659 QQuickControlPrivate *d = const_cast<QQuickControlPrivate *>(d_func());
1660 if (!d->contentItem)
1661 d->setContentItem_helper(d->getContentItem(), false);
1662 return d->contentItem;
1663}
1664
1666{
1667 Q_D(QQuickControl);
1668 d->setContentItem_helper(item, true);
1669}
1670
1672{
1673 Q_D(const QQuickControl);
1674 return d->baselineOffset;
1675}
1676
1678{
1679 Q_D(QQuickControl);
1680 d->extra.value().hasBaselineOffset = true;
1682}
1683
1685{
1686 Q_D(QQuickControl);
1687 if (!d->extra.isAllocated() || !d->extra.value().hasBaselineOffset)
1688 return;
1689
1690 if (d->extra.isAllocated())
1691 d->extra.value().hasBaselineOffset = false;
1692 d->updateBaselineOffset();
1693}
1694
1705{
1706 Q_D(const QQuickControl);
1707 return d->getHorizontalPadding();
1708}
1709
1711{
1712 Q_D(QQuickControl);
1713 d->setHorizontalPadding(padding);
1714}
1715
1717{
1718 Q_D(QQuickControl);
1719 d->setHorizontalPadding(0, true);
1720}
1721
1732{
1733 Q_D(const QQuickControl);
1734 return d->getVerticalPadding();
1735}
1736
1738{
1739 Q_D(QQuickControl);
1740 d->setVerticalPadding(padding);
1741}
1742
1744{
1745 Q_D(QQuickControl);
1746 d->setVerticalPadding(0, true);
1747}
1748
1772{
1773 Q_D(const QQuickControl);
1774 return d->implicitContentWidth;
1775}
1776
1800{
1801 Q_D(const QQuickControl);
1802 return d->implicitContentHeight;
1803}
1804
1827{
1828 Q_D(const QQuickControl);
1829 if (!d->background)
1830 return 0;
1831 return d->background->implicitWidth();
1832}
1833
1856{
1857 Q_D(const QQuickControl);
1858 if (!d->background)
1859 return 0;
1860 return d->background->implicitHeight();
1861}
1862
1872{
1873 Q_D(const QQuickControl);
1874 return d->getTopInset();
1875}
1876
1878{
1879 Q_D(QQuickControl);
1880 d->setTopInset(inset);
1881}
1882
1884{
1885 Q_D(QQuickControl);
1886 d->setTopInset(0, true);
1887}
1888
1898{
1899 Q_D(const QQuickControl);
1900 return d->getLeftInset();
1901}
1902
1904{
1905 Q_D(QQuickControl);
1906 d->setLeftInset(inset);
1907}
1908
1910{
1911 Q_D(QQuickControl);
1912 d->setLeftInset(0, true);
1913}
1914
1924{
1925 Q_D(const QQuickControl);
1926 return d->getRightInset();
1927}
1928
1930{
1931 Q_D(QQuickControl);
1932 d->setRightInset(inset);
1933}
1934
1936{
1937 Q_D(QQuickControl);
1938 d->setRightInset(0, true);
1939}
1940
1950{
1951 Q_D(const QQuickControl);
1952 return d->getBottomInset();
1953}
1954
1956{
1957 Q_D(QQuickControl);
1958 d->setBottomInset(inset);
1959}
1960
1962{
1963 Q_D(QQuickControl);
1964 d->setBottomInset(0, true);
1965}
1966
1968{
1969 Q_D(QQuickControl);
1971 d->resolveFont();
1972}
1973
1975{
1976 Q_D(QQuickControl);
1977 d->executeBackground(true);
1978 d->executeContentItem(true);
1980 d->resizeBackground();
1981 d->resizeContent();
1982 d->updateBaselineOffset();
1983 if (!d->hasLocale)
1984 d->locale = QQuickControlPrivate::calcLocale(d->parentItem);
1985#if QT_CONFIG(quicktemplates2_hover)
1986 if (!d->explicitHoverEnabled)
1987 setAcceptHoverEvents(QQuickControlPrivate::calcHoverEnabled(d->parentItem));
1988#endif
1989#if QT_CONFIG(accessibility)
1990 if (QAccessible::isActive())
1991 accessibilityActiveChanged(true);
1992#endif
1993}
1994
1996{
1998}
1999
2001{
2003 setFocusReason(event->reason());
2004}
2005
2007{
2009 setFocusReason(event->reason());
2010}
2011
2012#if QT_CONFIG(quicktemplates2_hover)
2014{
2015 Q_D(QQuickControl);
2016 setHovered(d->hoverEnabled);
2017 event->ignore();
2018}
2019
2021{
2022 Q_D(QQuickControl);
2023 setHovered(d->hoverEnabled && contains(event->position()));
2024 event->ignore();
2025}
2026
2028{
2029 setHovered(false);
2030 event->ignore();
2031}
2032#endif
2033
2035{
2036 Q_D(QQuickControl);
2037 event->setAccepted(d->handlePress(event->position(), event->timestamp()));
2038}
2039
2041{
2042 Q_D(QQuickControl);
2043 event->setAccepted(d->handleMove(event->position(), event->timestamp()));
2044}
2045
2047{
2048 Q_D(QQuickControl);
2049 event->setAccepted(d->handleRelease(event->position(), event->timestamp()));
2050}
2051
2053{
2054 Q_D(QQuickControl);
2055 d->handleUngrab();
2056}
2057
2058#if QT_CONFIG(quicktemplates2_multitouch)
2060{
2061 Q_D(QQuickControl);
2062 switch (event->type()) {
2063 case QEvent::TouchBegin:
2065 case QEvent::TouchEnd:
2066 for (const QTouchEvent::TouchPoint &point : event->points()) {
2067 if (!d->acceptTouch(point))
2068 continue;
2069
2070 switch (point.state()) {
2072 d->handlePress(point.position(), event->timestamp());
2073 break;
2075 d->handleMove(point.position(), event->timestamp());
2076 break;
2078 d->handleRelease(point.position(), event->timestamp());
2079 break;
2080 default:
2081 break;
2082 }
2083 }
2084 break;
2085
2087 d->handleUngrab();
2088 break;
2089
2090 default:
2092 break;
2093 }
2094}
2095
2097{
2098 Q_D(QQuickControl);
2099 d->handleUngrab();
2100}
2101#endif
2102
2103#if QT_CONFIG(wheelevent)
2104void QQuickControl::wheelEvent(QWheelEvent *event)
2105{
2106 Q_D(QQuickControl);
2107 if ((d->focusPolicy & Qt::WheelFocus) == Qt::WheelFocus)
2109
2110 event->setAccepted(d->wheelEnabled);
2111}
2112#endif
2113
2114void QQuickControl::geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry)
2115{
2116 Q_D(QQuickControl);
2117 QQuickItem::geometryChange(newGeometry, oldGeometry);
2118 d->resizeBackground();
2119 d->resizeContent();
2120 if (!qFuzzyCompare(newGeometry.width(), oldGeometry.width()))
2122 if (!qFuzzyCompare(newGeometry.height(), oldGeometry.height()))
2124}
2125
2127{
2128}
2129
2130void QQuickControl::fontChange(const QFont &newFont, const QFont &oldFont)
2131{
2132 Q_UNUSED(newFont);
2133 Q_UNUSED(oldFont);
2134}
2135
2136#if QT_CONFIG(quicktemplates2_hover)
2137void QQuickControl::hoverChange()
2138{
2139}
2140#endif
2141
2143{
2145}
2146
2147void QQuickControl::spacingChange(qreal newSpacing, qreal oldSpacing)
2148{
2149 Q_UNUSED(newSpacing);
2150 Q_UNUSED(oldSpacing);
2151}
2152
2153void QQuickControl::paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding)
2154{
2155 Q_D(QQuickControl);
2156 Q_UNUSED(newPadding);
2157 Q_UNUSED(oldPadding);
2158 d->resizeContent();
2159 d->updateBaselineOffset();
2160}
2161
2163{
2164 Q_UNUSED(newItem);
2165 Q_UNUSED(oldItem);
2166}
2167
2168void QQuickControl::localeChange(const QLocale &newLocale, const QLocale &oldLocale)
2169{
2170 Q_UNUSED(newLocale);
2171 Q_UNUSED(oldLocale);
2172}
2173
2174void QQuickControl::insetChange(const QMarginsF &newInset, const QMarginsF &oldInset)
2175{
2176 Q_D(QQuickControl);
2177 Q_UNUSED(newInset);
2178 Q_UNUSED(oldInset);
2179 d->resizeBackground();
2180}
2181
2182#if QT_CONFIG(accessibility)
2183QAccessible::Role QQuickControl::accessibleRole() const
2184{
2185 return QAccessible::NoRole;
2186}
2187
2188void QQuickControl::accessibilityActiveChanged(bool active)
2189{
2190 Q_D(QQuickControl);
2191 if (!active)
2192 return;
2193
2194 QQuickAccessibleAttached *accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(this, true));
2195 Q_ASSERT(accessibleAttached);
2196 accessibleAttached->setRole(d->effectiveAccessibleRole());
2197}
2198#endif
2199
2201{
2202#if QT_CONFIG(accessibility)
2203 if (QQuickAccessibleAttached *accessibleAttached = QQuickControlPrivate::accessibleAttached(this))
2204 return accessibleAttached->name();
2205#endif
2206 return QString();
2207}
2208
2210{
2211#if QT_CONFIG(accessibility)
2212 if (QQuickAccessibleAttached *accessibleAttached = QQuickControlPrivate::accessibleAttached(this)) {
2213 if (!accessibleAttached->wasNameExplicitlySet())
2214 accessibleAttached->setNameImplicitly(name);
2215 }
2216#else
2217 Q_UNUSED(name);
2218#endif
2219}
2220
2222{
2223#if QT_CONFIG(accessibility)
2224 if (QAccessible::isActive())
2225 return QQuickAccessibleAttached::property(this, propertyName);
2226#endif
2227 Q_UNUSED(propertyName);
2228 return QVariant();
2229}
2230
2231bool QQuickControl::setAccessibleProperty(const char *propertyName, const QVariant &value)
2232{
2233#if QT_CONFIG(accessibility)
2234 if (QAccessible::isActive())
2235 return QQuickAccessibleAttached::setProperty(this, propertyName, value);
2236#endif
2237 Q_UNUSED(propertyName);
2238 Q_UNUSED(value);
2239 return false;
2240}
2241
2243
2244#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:25
State state
the current state of the event point.
Definition qeventpoint.h:27
QPointF position
the position of this point.
Definition qeventpoint.h:36
@ 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:469
\reentrant
Definition qfont.h:20
QFont resolve(const QFont &) const
Returns a new QFont that has attributes copied from other that have not been previously set on this f...
Definition qfont.cpp:1854
void setResolveMask(uint mask)
Definition qfont.h:252
uint resolveMask() const
Definition qfont.h:251
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:245
\inmodule QtCore
Definition qmargins.h:274
constexpr qreal right() const noexcept
Returns the right margin.
Definition qmargins.h:370
constexpr qreal left() const noexcept
Returns the left margin.
Definition qmargins.h:364
constexpr qreal top() const noexcept
Returns the top margin.
Definition qmargins.h:367
constexpr qreal bottom() const noexcept
Returns the bottom margin.
Definition qmargins.h:373
\inmodule QtGui
Definition qevent.h:195
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:298
\inmodule QtCore
Definition qobject.h:90
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2823
QVariant property(const char *name) const
Returns the value of the object's name property.
Definition qobject.cpp:4187
The QPalette class contains color groups for each widget state.
Definition qpalette.h:19
\inmodule QtCore\reentrant
Definition qpoint.h:214
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)
Qt::FocusPolicy focusPolicy
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()
Qt::FocusPolicy focusPolicy
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)
void focusPolicyChanged()
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()
void setFocusPolicy(Qt::FocusPolicy policy)
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
void removeItemChangeListener(QQuickItemChangeListener *, ChangeTypes types)
void addItemChangeListener(QQuickItemChangeListener *listener, ChangeTypes types)
QQuickWindow * window
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:64
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:113
qreal x
\qmlproperty real QtQuick::Item::x \qmlproperty real QtQuick::Item::y \qmlproperty real QtQuick::Item...
Definition qquickitem.h:73
void setParentItem(QQuickItem *parent)
qreal z
\qmlproperty real QtQuick::Item::z
Definition qquickitem.h:75
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:74
bool activeFocusOnTab() const
\qmlproperty bool QtQuick::Item::activeFocusOnTab
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:76
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:114
Q_INVOKABLE void forceActiveFocus()
\qmlmethod point QtQuick::Item::mapToItem(Item item, real x, real y) \qmlmethod point QtQuick::Item::...
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:77
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:143
@ ItemVisibleHasChanged
Definition qquickitem.h:147
@ ItemActiveFocusHasChanged
Definition qquickitem.h:150
@ ItemEnabledHasChanged
Definition qquickitem.h:154
@ ItemParentHasChanged
Definition qquickitem.h:148
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:474
void setX(qreal)
bool enabled
\qmlproperty bool QtQuick::Item::enabled
Definition qquickitem.h:80
virtual void hoverLeaveEvent(QHoverEvent *event)
This event handler can be reimplemented in a subclass to receive hover-leave events for an item.
void setY(qreal)
void setActiveFocusOnTab(bool)
void inheritFont(const QFont &font)
static QQuickLabelPrivate * get(QQuickLabel *item)
void inheritFont(const QFont &font)
static QQuickTextAreaPrivate * get(QQuickTextArea *item)
static QQuickTextFieldPrivate * get(QQuickTextField *item)
void inheritFont(const QFont &font)
static QPalette palette(Scope scope)
static QFont font(Scope scope)
static QQuickWindowPrivate * get(QQuickWindow *c)
void clearFocusInScope(QQuickItem *scope, QQuickItem *item, Qt::FocusReason reason)
\inmodule QtCore\reentrant
Definition qrect.h:483
constexpr qreal height() const noexcept
Returns the height of the rectangle.
Definition qrect.h:718
constexpr qreal width() const noexcept
Returns the width of the rectangle.
Definition qrect.h:715
\inmodule QtCore
Definition qsize.h:207
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
bool useHoverEffects
whether UI elements use hover effects.
Definition qstylehints.h:47
The QTouchEvent class contains parameters that describe a touch event.
Definition qevent.h:916
\inmodule QtCore
Definition qvariant.h:64
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
double e
Combined button and popup list for selecting options.
FocusPolicy
Definition qnamespace.h:105
@ WheelFocus
Definition qnamespace.h:110
@ ClickFocus
Definition qnamespace.h:108
@ TabFocus
Definition qnamespace.h:107
FocusReason
@ BacktabFocusReason
@ MouseFocusReason
@ TabFocusReason
@ ShortcutFocusReason
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
Definition qfloat16.h:287
bool qFuzzyIsNull(qfloat16 f) noexcept
Definition qfloat16.h:303
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
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 void setActiveFocus(QQuickControl *control, 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:30
unsigned int uint
Definition qtypes.h:29
double qreal
Definition qtypes.h:92
myObject disconnect()
[26]
QGraphicsItem * item
QLayoutItem * child
[0]
QSizePolicy policy
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent
\inmodule QtQuick
Definition qquickitem.h:158