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
qquicktumbler.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 "qquicktumbler_p.h"
5
6#include <QtCore/qloggingcategory.h>
7#include <QtGui/qpa/qplatformtheme.h>
8#include <QtQml/qqmlinfo.h>
9#include <QtQuick/private/qquickflickable_p.h>
10#include <QtQuickTemplates2/private/qquickcontrol_p_p.h>
11#include <QtQuickTemplates2/private/qquicktumbler_p_p.h>
12
14
15Q_LOGGING_CATEGORY(lcTumbler, "qt.quick.controls.tumbler")
16
17
21
60namespace {
61 static inline qreal delegateHeight(const QQuickTumbler *tumbler)
62 {
63 return tumbler->availableHeight() / tumbler->visibleItemCount();
64 }
65}
66
67/*
68 Finds the contentItem of the view that is a child of the control's \a contentItem.
69 The type is stored in \a type.
70*/
72{
73 if (!contentItem) {
75 return nullptr;
76 }
77
78 if (contentItem->inherits("QQuickPathView")) {
82 viewOffset = 0;
83
84 return contentItem;
85 } else if (contentItem->inherits("QQuickListView")) {
87 viewContentItem = qobject_cast<QQuickFlickable*>(contentItem)->contentItem();
89 viewContentY = 0;
90
91 return contentItem;
92 } else {
93 const auto childItems = contentItem->childItems();
94 for (QQuickItem *childItem : childItems) {
95 QQuickItem *item = determineViewType(childItem);
96 if (item)
97 return item;
98 }
99 }
100
103 return nullptr;
104}
105
116
118{
119 if (!viewContentItem)
120 return QList<QQuickItem *>();
121
122 return viewContentItem->childItems();
123}
124
126{
127 return tumbler->d_func();
128}
129
131{
132 if (ignoreSignals)
133 return;
134
135 // Can't use our own private padding members here, as the padding property might be set,
136 // which doesn't affect them, only their getters.
137 Q_Q(const QQuickTumbler);
138 const qreal itemHeight = delegateHeight(q);
139 const auto items = viewContentItemChildItems();
140 for (QQuickItem *childItem : items)
141 childItem->setHeight(itemHeight);
142}
143
145{
146 if (ignoreSignals)
147 return;
148
149 Q_Q(const QQuickTumbler);
150 const qreal availableWidth = q->availableWidth();
151 const auto items = viewContentItemChildItems();
152 for (QQuickItem *childItem : items)
153 childItem->setWidth(availableWidth);
154}
155
157{
158 Q_Q(QQuickTumbler);
160 // If the user set currentIndex in the onModelChanged handler,
161 // we have to respect that currentIndex by ignoring changes in the view
162 // until the model has finished being set.
163 qCDebug(lcTumbler).nospace() << "view currentIndex changed to "
164 << (view ? view->property("currentIndex").toString() : QStringLiteral("unknown index (no view)"))
165 << ", but we're ignoring it because one or more of the following conditions are true:"
166 << "\n- !view: " << !view
167 << "\n- ignoreCurrentIndexChanges: " << ignoreCurrentIndexChanges
168 << "\n- currentIndexSetDuringModelChange: " << currentIndexSetDuringModelChange;
169 return;
170 }
171
172 const int oldCurrentIndex = currentIndex;
173 currentIndex = view->property("currentIndex").toInt();
174
175 qCDebug(lcTumbler).nospace() << "view currentIndex changed to "
176 << (view ? view->property("currentIndex").toString() : QStringLiteral("unknown index (no view)"))
177 << ", our old currentIndex was " << oldCurrentIndex;
178
179 if (oldCurrentIndex != currentIndex)
180 emit q->currentIndexChanged();
181}
182
184{
185 Q_Q(QQuickTumbler);
186 qCDebug(lcTumbler) << "view count changed - ignoring signals?" << ignoreSignals;
187 if (ignoreSignals)
188 return;
189
190 setCount(view->property("count").toInt());
191
192 if (count > 0) {
193 if (pendingCurrentIndex != -1) {
194 // If there was an attempt to set currentIndex at creation, try to finish that attempt now.
195 // componentComplete() is too early, because the count might only be known sometime after completion.
197 // If we could successfully set the currentIndex, consider it done.
198 // Otherwise, we'll try again later in updatePolish().
201 else
202 q->polish();
203 } else if (currentIndex == -1) {
204 // If new items were added and our currentIndex was -1, we must
205 // enforce our rule of a non-negative currentIndex when count > 0.
207 }
208 } else {
209 setCurrentIndex(-1);
210 }
211}
212
218
224
226{
227 const auto items = viewContentItemChildItems();
228 for (QQuickItem *childItem : items) {
229 QQuickTumblerAttached *attached = qobject_cast<QQuickTumblerAttached *>(qmlAttachedPropertiesObject<QQuickTumbler>(childItem, false));
230 if (attached)
231 QQuickTumblerAttachedPrivate::get(attached)->calculateDisplacement();
232 }
233}
234
240
246
253
258
260 : QQuickControl(*(new QQuickTumblerPrivate), parent)
261{
262 Q_D(QQuickTumbler);
264
266
267 connect(this, SIGNAL(leftPaddingChanged()), this, SLOT(_q_updateItemWidths()));
268 connect(this, SIGNAL(rightPaddingChanged()), this, SLOT(_q_updateItemWidths()));
269 connect(this, SIGNAL(topPaddingChanged()), this, SLOT(_q_updateItemHeights()));
270 connect(this, SIGNAL(bottomPaddingChanged()), this, SLOT(_q_updateItemHeights()));
271}
272
274{
275 Q_D(QQuickTumbler);
276 // Ensure that the item change listener is removed.
277 d->disconnectFromView();
278}
279
286{
287 Q_D(const QQuickTumbler);
288 return d->model;
289}
290
292{
293 Q_D(QQuickTumbler);
294 if (model == d->model)
295 return;
296
297 d->beginSetModel();
298
299 d->model = model;
301
302 d->endSetModel();
303
304 d->currentIndexSetDuringModelChange = false;
305
306 // Don't try to correct the currentIndex if count() isn't known yet.
307 // We can check in setupViewData() instead.
308 if (isComponentComplete() && d->view && count() == 0)
309 d->setCurrentIndex(-1);
310}
311
319{
320 Q_D(const QQuickTumbler);
321 return d->count;
322}
323
335{
336 Q_D(const QQuickTumbler);
337 return d->currentIndex;
338}
339
340void QQuickTumbler::setCurrentIndex(int currentIndex)
341{
342 Q_D(QQuickTumbler);
343 if (d->modelBeingSet)
344 d->currentIndexSetDuringModelChange = true;
346}
347
357{
358 Q_D(const QQuickTumbler);
359 return d->view ? d->view->property("currentItem").value<QQuickItem*>() : nullptr;
360}
361
368{
369 Q_D(const QQuickTumbler);
370 return d->delegate;
371}
372
374{
375 Q_D(QQuickTumbler);
376 if (delegate == d->delegate)
377 return;
378
379 d->delegate = delegate;
381}
382
390{
391 Q_D(const QQuickTumbler);
392 return d->visibleItemCount;
393}
394
395void QQuickTumbler::setVisibleItemCount(int visibleItemCount)
396{
397 Q_D(QQuickTumbler);
398 if (visibleItemCount == d->visibleItemCount)
399 return;
400
401 d->visibleItemCount = visibleItemCount;
402 d->_q_updateItemHeights();
404}
405
410
425{
426 Q_D(const QQuickTumbler);
427 return d->wrap;
428}
429
431{
432 Q_D(QQuickTumbler);
433 d->setWrap(wrap, true);
434}
435
437{
438 Q_D(QQuickTumbler);
439 d->explicitWrap = false;
440 d->setWrapBasedOnCount();
441}
442
451{
452 Q_D(const QQuickTumbler);
453 return d->view && d->view->property("moving").toBool();
454}
455
480void QQuickTumbler::positionViewAtIndex(int index, QQuickTumbler::PositionMode mode)
481{
482 Q_D(QQuickTumbler);
483 if (!d->view) {
484 d->warnAboutIncorrectContentItem();
485 return;
486 }
487
488 QMetaObject::invokeMethod(d->view, "positionViewAtIndex", Q_ARG(int, index), Q_ARG(int, mode));
489}
490
491void QQuickTumbler::geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry)
492{
493 Q_D(QQuickTumbler);
494
495 QQuickControl::geometryChange(newGeometry, oldGeometry);
496
497 d->_q_updateItemHeights();
498
499 if (newGeometry.width() != oldGeometry.width())
500 d->_q_updateItemWidths();
501}
502
504{
505 Q_D(QQuickTumbler);
506 qCDebug(lcTumbler) << "componentComplete()";
508
509 if (!d->view) {
510 // Force the view to be created.
511 qCDebug(lcTumbler) << "emitting wrapChanged() to force view to be created";
512 emit wrapChanged();
513 // Determine the type of view for attached properties, etc.
514 d->setupViewData(d->contentItem);
515 }
516
517 // If there was no contentItem or it was of an unsupported type,
518 // we don't have anything else to do.
519 if (!d->view)
520 return;
521
522 // Update item heights after we've populated the model,
523 // otherwise ignoreSignals will cause these functions to return early.
524 d->_q_updateItemHeights();
525 d->_q_updateItemWidths();
526 d->_q_onViewCountChanged();
527
528 qCDebug(lcTumbler) << "componentComplete() is done";
529}
530
532{
533 Q_D(QQuickTumbler);
534
535 QQuickControl::contentItemChange(newItem, oldItem);
536
537 if (oldItem)
538 d->disconnectFromView();
539
540 if (newItem) {
541 // We wait until wrap is set to that we know which type of view to create.
542 // If we try to set up the view too early, we'll issue warnings about it not existing.
543 if (isComponentComplete()) {
544 // Make sure we use the new content item and not the current one, as that won't
545 // be changed until after contentItemChange() has finished.
546 d->setupViewData(newItem);
547
548 d->_q_updateItemHeights();
549 d->_q_updateItemWidths();
550 }
551 }
552}
553
555{
556 Q_Q(QQuickTumbler);
557 if (!view) {
558 // If a custom content item is declared, it can happen that
559 // the original contentItem exists without the view etc. having been
560 // determined yet, and then this is called when the custom content item
561 // is eventually set.
562 return;
563 }
564
566 QObject::disconnect(view, SIGNAL(currentItemChanged()), q, SIGNAL(currentItemChanged()));
568 QObject::disconnect(view, SIGNAL(movingChanged()), q, SIGNAL(movingChanged()));
569
572 else
574
575 QQuickItemPrivate *oldViewContentItemPrivate = QQuickItemPrivate::get(viewContentItem);
576 oldViewContentItemPrivate->removeItemChangeListener(this, QQuickItemPrivate::Children | QQuickItemPrivate::Geometry);
577
579}
580
582{
583 // Don't do anything if we've already set up.
584 if (view)
585 return;
586
587 determineViewType(newControlContentItem);
588
590 return;
591
594 return;
595 }
596
597 Q_Q(QQuickTumbler);
598 QObject::connect(view, SIGNAL(currentIndexChanged()), q, SLOT(_q_onViewCurrentIndexChanged()));
599 QObject::connect(view, SIGNAL(currentItemChanged()), q, SIGNAL(currentItemChanged()));
601 QObject::connect(view, SIGNAL(movingChanged()), q, SIGNAL(movingChanged()));
602
606 } else {
607 QObject::connect(view, SIGNAL(contentYChanged()), q, SLOT(_q_onViewContentYChanged()));
609 }
610
612 viewContentItemPrivate->addItemChangeListener(this, QQuickItemPrivate::Children | QQuickItemPrivate::Geometry);
613
614 // Sync the view's currentIndex with ours.
616
618}
619
621{
622 Q_Q(QQuickTumbler);
623 qmlWarning(q) << "Tumbler: contentItem must contain either a PathView or a ListView";
624}
625
627{
628 const int actualViewIndex = view->property("currentIndex").toInt();
629 Q_Q(QQuickTumbler);
630
631 const bool isPendingCurrentIndex = pendingCurrentIndex != -1;
632 const int indexToSet = isPendingCurrentIndex ? pendingCurrentIndex : currentIndex;
633
634 // Nothing to do.
635 if (actualViewIndex == indexToSet) {
637 return;
638 }
639
640 // actualViewIndex might be 0 or -1 for PathView and ListView respectively,
641 // but we always use -1 for that.
642 if (q->count() == 0 && actualViewIndex <= 0)
643 return;
644
646 view->setProperty("currentIndex", QVariant(indexToSet));
648
649 if (view->property("currentIndex").toInt() == indexToSet)
651 else if (isPendingCurrentIndex)
652 q->polish();
653}
654
656{
657 qCDebug(lcTumbler) << "setting pendingCurrentIndex to" << index;
659}
660
663{
664 return changeReason == UserChange ? QStringLiteral("UserChange") : QStringLiteral("InternalChange");
665}
666
669{
670 Q_Q(QQuickTumbler);
671 qCDebug(lcTumbler).nospace() << "setting currentIndex to " << newCurrentIndex
672 << ", old currentIndex was " << currentIndex
673 << ", changeReason is " << propertyChangeReasonToString(changeReason);
674 if (newCurrentIndex == currentIndex || newCurrentIndex < -1)
675 return;
676
677 if (!q->isComponentComplete()) {
678 // Views can't set currentIndex until they're ready.
679 qCDebug(lcTumbler) << "we're not complete; setting pendingCurrentIndex instead";
680 setPendingCurrentIndex(newCurrentIndex);
681 return;
682 }
683
684 if (modelBeingSet && changeReason == UserChange) {
685 // If modelBeingSet is true and the user set the currentIndex,
686 // the model is in the process of being set and the user has set
687 // the currentIndex in onModelChanged. We have to queue the currentIndex
688 // change until we're ready.
689 qCDebug(lcTumbler) << "a model is being set; setting pendingCurrentIndex instead";
690 setPendingCurrentIndex(newCurrentIndex);
691 return;
692 }
693
694 // -1 doesn't make sense for a non-empty Tumbler, because unlike
695 // e.g. ListView, there's always one item selected.
696 // Wait until the component has finished before enforcing this rule, though,
697 // because the count might not be known yet.
698 if ((count > 0 && newCurrentIndex == -1) || (newCurrentIndex >= count)) {
699 return;
700 }
701
702 // The view might not have been created yet, as is the case
703 // if you create a Tumbler component and pass e.g. { currentIndex: 2 }
704 // to createObject().
705 if (view) {
706 // Only actually set our currentIndex if the view was able to set theirs.
707 bool couldSet = false;
708 if (count == 0 && newCurrentIndex == -1) {
709 // PathView insists on using 0 as the currentIndex when there are no items.
710 couldSet = true;
711 } else {
713 ignoreSignals = true;
714 view->setProperty("currentIndex", newCurrentIndex);
715 ignoreSignals = false;
717
718 couldSet = view->property("currentIndex").toInt() == newCurrentIndex;
719 }
720
721 if (couldSet) {
722 // The view's currentIndex might not have actually changed, but ours has,
723 // and that's what user code sees.
724 currentIndex = newCurrentIndex;
725 emit q->currentIndexChanged();
726 }
727
728 qCDebug(lcTumbler) << "view's currentIndex is now" << view->property("currentIndex").toInt()
729 << "and ours is" << currentIndex;
730 }
731}
732
734{
735 qCDebug(lcTumbler).nospace() << "setting count to " << newCount
736 << ", old count was " << count;
737 if (newCount == count)
738 return;
739
740 count = newCount;
741
742 Q_Q(QQuickTumbler);
744
745 emit q->countChanged();
746}
747
749{
750 if (count == 0 || explicitWrap || modelBeingSet)
751 return;
752
753 setWrap(count >= visibleItemCount, false);
754}
755
756void QQuickTumblerPrivate::setWrap(bool shouldWrap, bool isExplicit)
757{
758 qCDebug(lcTumbler) << "setting wrap to" << shouldWrap << "- explicit?" << isExplicit;
759 if (isExplicit)
760 explicitWrap = true;
761
762 Q_Q(QQuickTumbler);
763 if (q->isComponentComplete() && shouldWrap == wrap)
764 return;
765
766 // Since we use the currentIndex of the contentItem directly, we must
767 // ensure that we keep track of the currentIndex so it doesn't get lost
768 // between view changes.
769 const int oldCurrentIndex = currentIndex;
770
772
773 wrap = shouldWrap;
774
775 // New views will set their currentIndex upon creation, which we'd otherwise
776 // take as the correct one, so we must ignore them.
778
779 // This will cause the view to be created if our contentItem is a TumblerView.
780 emit q->wrapChanged();
781
783
784 // If isComponentComplete() is true, we require a contentItem. If it's not
785 // true, it might not have been created yet, so we wait until
786 // componentComplete() is called.
787 //
788 // When the contentItem (usually QQuickTumblerView) has been created, we
789 // can start determining its type, etc. If the delegates use attached
790 // properties, this will have already been called, in which case it will
791 // return early. If the delegate doesn't use attached properties, we need
792 // to call it here.
793 if (q->isComponentComplete() || contentItem)
795
796 setCurrentIndex(oldCurrentIndex);
797}
798
803
809
811{
813
814 Q_D(QQuickTumbler);
815 if (event->isAutoRepeat() || !d->view)
816 return;
817
818 if (event->key() == Qt::Key_Up) {
819 QMetaObject::invokeMethod(d->view, "decrementCurrentIndex");
820 } else if (event->key() == Qt::Key_Down) {
821 QMetaObject::invokeMethod(d->view, "incrementCurrentIndex");
822 }
823}
824
826{
827 Q_D(QQuickTumbler);
828 if (d->pendingCurrentIndex != -1) {
829 // Update our count, as ignoreSignals might have been true
830 // when _q_onViewCountChanged() was last called.
831 d->setCount(d->view->property("count").toInt());
832
833 // If the count is still 0, it's not going to happen.
834 if (d->count == 0) {
835 d->setPendingCurrentIndex(-1);
836 return;
837 }
838
839 // If there is a pending currentIndex at this stage, it means that
840 // the view wouldn't set our currentIndex in _q_onViewCountChanged
841 // because it wasn't ready. Try one last time here.
842 d->setCurrentIndex(d->pendingCurrentIndex);
843
844 if (d->currentIndex != d->pendingCurrentIndex && d->currentIndex == -1) {
845 // If we *still* couldn't set it, it's probably invalid.
846 // See if we can at least enforce our rule of "non-negative currentIndex when count > 0" instead.
847 d->setCurrentIndex(0);
848 }
849
850 d->setPendingCurrentIndex(-1);
851 }
852}
853
858
860{
862 if (!delegateItem->parentItem()) {
863 qmlWarning(q) << "Tumbler: attached properties must be accessed through a delegate item that has a parent";
864 return;
865 }
866
867 QVariant indexContextProperty = qmlContext(delegateItem)->contextProperty(QStringLiteral("index"));
868 if (!indexContextProperty.isValid()) {
869 qmlWarning(q) << "Tumbler: attempting to access attached property on item without an \"index\" property";
870 return;
871 }
872
873 index = indexContextProperty.toInt();
874
875 QQuickItem *parentItem = delegateItem;
876 while ((parentItem = parentItem->parentItem())) {
877 if ((tumbler = qobject_cast<QQuickTumbler*>(parentItem)))
878 break;
879 }
880}
881
883{
884 const qreal previousDisplacement = displacement;
885 displacement = 0;
886
887 if (!tumbler) {
888 // Can happen if the attached properties are accessed on the wrong type of item or the tumbler was destroyed.
889 // We don't want to emit the change signal though, as this could cause warnings about Tumbler.tumbler being null.
890 return;
891 }
892
893 // Can happen if there is no ListView or PathView within the contentItem.
895 if (!tumblerPrivate->viewContentItem) {
896 emitIfDisplacementChanged(previousDisplacement, displacement);
897 return;
898 }
899
900 // The attached property gets created before our count is updated, so just cheat here
901 // to avoid having to listen to count changes.
902 const int count = tumblerPrivate->view->property("count").toInt();
903 // This can happen in tests, so it may happen in normal usage too.
904 if (count == 0) {
905 emitIfDisplacementChanged(previousDisplacement, displacement);
906 return;
907 }
908
909 if (tumblerPrivate->viewContentItemType == QQuickTumblerPrivate::PathViewContentItem) {
910 const qreal offset = tumblerPrivate->viewOffset;
911
912 displacement = count > 1 ? count - index - offset : 0;
913 // Don't add 1 if count <= visibleItemCount
914 const int visibleItems = tumbler->visibleItemCount();
915 const int halfVisibleItems = visibleItems / 2 + (visibleItems < count ? 1 : 0);
916 if (displacement > halfVisibleItems)
918 else if (displacement < -halfVisibleItems)
920 } else {
921 const qreal contentY = tumblerPrivate->viewContentY;
922 const qreal delegateH = delegateHeight(tumbler);
923 const qreal preferredHighlightBegin = tumblerPrivate->view->property("preferredHighlightBegin").toReal();
924 const qreal itemY = qobject_cast<QQuickItem*>(parent)->y();
925 qreal currentItemY = 0;
926 auto currentItem = tumblerPrivate->view->property("currentItem").value<QQuickItem*>();
927 if (currentItem)
928 currentItemY = currentItem->y();
929 // Start from the y position of the current item.
930 const qreal topOfCurrentItemInViewport = currentItemY - contentY;
931 // Then, calculate the distance between it and the preferredHighlightBegin.
932 const qreal relativePositionToPreferredHighlightBegin = topOfCurrentItemInViewport - preferredHighlightBegin;
933 // Next, calculate the distance between us and the current item.
934 const qreal distanceFromCurrentItem = currentItemY - itemY;
935 const qreal displacementInPixels = distanceFromCurrentItem - relativePositionToPreferredHighlightBegin;
936 // Convert it from pixels to a floating point index.
937 displacement = displacementInPixels / delegateH;
938 }
939
940 emitIfDisplacementChanged(previousDisplacement, displacement);
941}
942
944{
946 if (newDisplacement != oldDisplacement)
947 emit q->displacementChanged();
948}
949
951 : QObject(*(new QQuickTumblerAttachedPrivate), parent)
952{
955 if (delegateItem)
956 d->init(delegateItem);
957 else if (parent)
958 qmlWarning(parent) << "Tumbler: attached properties of Tumbler must be accessed through a delegate item";
959
960 if (d->tumbler) {
961 // When the Tumbler is completed, wrapChanged() is emitted to let QQuickTumblerView
962 // know that it can create the view. The view itself might instantiate delegates
963 // that use attached properties. At this point, setupViewData() hasn't been called yet
964 // (it's called on the next line in componentComplete()), so we call it here so that
965 // we have access to the view.
966 QQuickTumblerPrivate *tumblerPrivate = QQuickTumblerPrivate::get(d->tumbler);
967 tumblerPrivate->setupViewData(tumblerPrivate->contentItem);
968
969 if (delegateItem && delegateItem->parentItem() == tumblerPrivate->viewContentItem) {
970 // This item belongs to the "new" view, meaning that the tumbler's contentItem
971 // was probably assigned declaratively. If they're not equal, calling
972 // calculateDisplacement() would use the old contentItem data, which is bad.
973 d->calculateDisplacement();
974 }
975 }
976}
977
986{
987 Q_D(const QQuickTumblerAttached);
988 return d->tumbler;
989}
990
1010{
1011 Q_D(const QQuickTumblerAttached);
1012 return d->displacement;
1013}
1014
1016
1017#include "moc_qquicktumbler_p.cpp"
\reentrant
Definition qfont.h:22
The QKeyEvent class describes a key event.
Definition qevent.h:424
static constexpr Policy Preferred
QObject * parent
Definition qobject.h:73
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
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
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
Definition qobject.cpp:3236
QVariant property(const char *name) const
Returns the value of the object's name property.
Definition qobject.cpp:4323
bool setProperty(const char *name, const QVariant &value)
Sets the value of the object's name property to value.
bool inherits(const char *classname) const
Returns true if this object is an instance of a class that inherits className or a QObject subclass t...
Definition qobject.h:348
The QPalette class contains color groups for each widget state.
Definition qpalette.h:19
The QQmlComponent class encapsulates a QML component definition.
QVariant contextProperty(const QString &) const
Returns the value of the name property for this context as a QVariant.
void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override
QQuickDeferredPointer< QQuickItem > contentItem
virtual void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
void topPaddingChanged()
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override
void rightPaddingChanged()
void bottomPaddingChanged()
void leftPaddingChanged()
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
QList< QQuickItem * > childItems() const
Returns the children of this item.
virtual void keyPressEvent(QKeyEvent *event)
This event handler can be reimplemented in a subclass to receive key press events for an item.
qreal y
Defines the item's y position relative to its parent.
Definition qquickitem.h:73
QQuickItem * parentItem() const
bool isComponentComplete() const
Returns true if construction of the QML component is complete; otherwise returns false.
void setActiveFocusOnTab(bool)
static QPalette palette(Scope scope)
static QFont font(Scope scope)
static QQuickTumblerAttachedPrivate * get(QQuickTumblerAttached *attached)
void emitIfDisplacementChanged(qreal oldDisplacement, qreal newDisplacement)
void init(QQuickItem *delegateItem)
QPointer< QQuickTumbler > tumbler
QQuickTumbler * tumbler
QQuickTumblerAttached(QObject *parent=nullptr)
ContentItemType viewContentItemType
void itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &) override
void setCurrentIndex(int newCurrentIndex, PropertyChangeReason changeReason=InternalChange)
QQuickItem * determineViewType(QQuickItem *contentItem)
void itemChildAdded(QQuickItem *, QQuickItem *) override
void setCount(int newCount)
static QQuickTumblerPrivate * get(QQuickTumbler *tumbler)
void itemChildRemoved(QQuickItem *, QQuickItem *) override
QList< QQuickItem * > viewContentItemChildItems() const
void setPendingCurrentIndex(int index)
void setupViewData(QQuickItem *newControlContentItem)
void setWrap(bool shouldWrap, bool isExplicit)
QPalette defaultPalette() const override
static QString propertyChangeReasonToString(PropertyChangeReason changeReason)
QQuickItem * currentItem
void setWrap(bool wrap)
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override
void updatePolish() override
This function should perform any layout as required for this item.
void delegateChanged()
QQmlComponent * delegate
void modelChanged()
void keyPressEvent(QKeyEvent *event) override
This event handler can be reimplemented in a subclass to receive key press events for an item.
QFont defaultFont() const override
void setCurrentIndex(int currentIndex)
QQuickTumbler(QQuickItem *parent=nullptr)
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
void visibleItemCountChanged()
void setDelegate(QQmlComponent *delegate)
void setModel(const QVariant &model)
void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override
void setVisibleItemCount(int visibleItemCount)
static QQuickTumblerAttached * qmlAttachedProperties(QObject *object)
bool isMoving() const
\qmlproperty bool QtQuick.Controls::Tumbler::moving
\inmodule QtCore\reentrant
Definition qrect.h:484
constexpr qreal width() const noexcept
Returns the width of the rectangle.
Definition qrect.h:729
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qvariant.h:65
qreal toReal(bool *ok=nullptr) const
Returns the variant as a qreal if the variant has userType() \l QMetaType::Double,...
int toInt(bool *ok=nullptr) const
Returns the variant as an int if the variant has userType() \l QMetaType::Int, \l QMetaType::Bool,...
QString toString() const
Returns the variant as a QString if the variant has a userType() including, but not limited to:
Combined button and popup list for selecting options.
static qreal delegateHeight(const QQuickTumbler *tumbler)
@ Key_Up
Definition qnamespace.h:678
@ Key_Down
Definition qnamespace.h:680
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
#define SLOT(a)
Definition qobjectdefs.h:52
#define Q_ARG(Type, data)
Definition qobjectdefs.h:63
#define SIGNAL(a)
Definition qobjectdefs.h:53
GLenum mode
GLuint index
[2]
GLenum GLenum GLsizei count
GLenum GLuint GLintptr offset
struct _cl_event * event
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
QQmlContext * qmlContext(const QObject *obj)
Definition qqml.cpp:75
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
QQuickItem * qobject_cast< QQuickItem * >(QObject *o)
Definition qquickitem.h:492
static QT_BEGIN_NAMESPACE QAsn1Element wrap(quint8 type, const QAsn1Element &child)
#define QStringLiteral(str)
#define emit
double qreal
Definition qtypes.h:187
QSqlQueryModel * model
[16]
QGraphicsItem * item
QList< QTreeWidgetItem * > items
static bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType, QGenericReturnArgument ret, QGenericArgument val0=QGenericArgument(nullptr), QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument(), QGenericArgument val4=QGenericArgument(), QGenericArgument val5=QGenericArgument(), QGenericArgument val6=QGenericArgument(), QGenericArgument val7=QGenericArgument(), QGenericArgument val8=QGenericArgument(), QGenericArgument val9=QGenericArgument())
\threadsafe This is an overloaded member function, provided for convenience. It differs from the abov...