8#include <QtQml/qjsengine.h>
14#include <QtQml/qqmlengine.h>
15#include <QtQml/qqmlcomponent.h>
16#include <QtQml/qqmlinfo.h>
17#include <QtGui/qpen.h>
18#include <QtGui/qguiapplication.h>
19#include <QtGui/qstylehints.h>
20#include <QtGui/private/qeventpoint_p.h>
21#include <QtGui/private/qguiapplication_p.h>
22#include <QtGui/private/qpointingdevice_p.h>
23#include <QtGui/qinputmethod.h>
24#include <QtCore/qcoreevent.h>
25#include <QtCore/private/qnumeric_p.h>
26#include <QtGui/qpa/qplatformtheme.h>
27#include <QtCore/qloggingcategory.h>
28#include <QtCore/private/qduplicatetracker_p.h>
30#include <private/qqmlglobal_p.h>
31#include <private/qqmlengine_p.h>
32#include <QtQuick/private/qquickstategroup_p.h>
33#include <private/qqmlopenmetaobject_p.h>
34#include <QtQuick/private/qquickstate_p.h>
35#include <private/qquickitem_p.h>
36#include <QtQuick/private/qquickaccessibleattached_p.h>
37#include <QtQuick/private/qquickhoverhandler_p.h>
38#include <QtQuick/private/qquickpointerhandler_p.h>
39#include <QtQuick/private/qquickpointerhandler_p_p.h>
41#include <private/qv4engine_p.h>
42#include <private/qv4object_p.h>
43#include <private/qv4qobjectwrapper_p.h>
44#include <private/qdebug_p.h>
45#include <private/qqmlvaluetypewrapper_p.h>
48# include <QtGui/qcursor.h>
51#include <QtCore/qpointer.h>
78 <<
item->hasActiveFocus()
79 <<
item->isFocusScope()
85 item->isFocusScope() || !scope ?
item : scope,
96 item->forceActiveFocus(reason);
139 for (
int ii = 0; ii <
d->items.size(); ++ii) {
141 p->transforms.removeOne(
this);
149 for (
int ii = 0; ii <
d->items.size(); ++ii) {
162 QList<QQuickItem *> children = m_item->
childItems();
163 for (
int i = 0;
i < children.size(); ++
i) {
169bool QQuickContents::calcHeight(
QQuickItem *changed)
171 qreal oldy = m_contents.
y();
185 qreal top = std::numeric_limits<qreal>::max();
187 QList<QQuickItem *> children = m_item->
childItems();
188 for (
int i = 0;
i < children.size(); ++
i) {
196 if (!children.isEmpty())
201 return (m_contents.
height() != oldheight || m_contents.
y() != oldy);
204bool QQuickContents::calcWidth(
QQuickItem *changed)
206 qreal oldx = m_contents.
x();
220 qreal left = std::numeric_limits<qreal>::max();
221 qreal right = -std::numeric_limits<qreal>::max();
222 QList<QQuickItem *> children = m_item->
childItems();
223 for (
int i = 0;
i < children.size(); ++
i) {
231 if (!children.isEmpty())
236 return (m_contents.
width() != oldwidth || m_contents.
x() != oldx);
243 QList<QQuickItem *> children = m_item->
childItems();
244 for (
int i = 0;
i < children.size(); ++
i) {
252void QQuickContents::updateRect()
260 bool wChanged =
false;
261 bool hChanged =
false;
264 wChanged = calcWidth();
266 hChanged = calcHeight();
267 if (wChanged || hChanged)
297 m_next =
p->extra.value().keyHandler;
298 p->extra->keyHandler =
this;
327 if (m_next)
return m_next->inputMethodQuery(
query);
452 if (
d->leftSet &&
d->left ==
i)
454 d->leftSet =
d->left !=
i;
457 qobject_cast<QQuickKeyNavigationAttached*>(qmlAttachedPropertiesObject<QQuickKeyNavigationAttached>(
i));
474 if (
d->rightSet &&
d->right ==
i)
476 d->rightSet =
d->right !=
i;
479 qobject_cast<QQuickKeyNavigationAttached*>(qmlAttachedPropertiesObject<QQuickKeyNavigationAttached>(
i));
496 if (
d->upSet &&
d->up ==
i)
498 d->upSet =
d->up !=
i;
501 qobject_cast<QQuickKeyNavigationAttached*>(qmlAttachedPropertiesObject<QQuickKeyNavigationAttached>(
i));
518 if (
d->downSet &&
d->down ==
i)
520 d->downSet =
d->down !=
i;
523 qobject_cast<QQuickKeyNavigationAttached*>(qmlAttachedPropertiesObject<QQuickKeyNavigationAttached>(
i));
540 if (
d->tabSet &&
d->tab ==
i)
542 d->tabSet =
d->tab !=
i;
545 qobject_cast<QQuickKeyNavigationAttached*>(qmlAttachedPropertiesObject<QQuickKeyNavigationAttached>(
i));
562 if (
d->backtabSet &&
d->backtab ==
i)
564 d->backtabSet =
d->backtab !=
i;
567 qobject_cast<QQuickKeyNavigationAttached*>(qmlAttachedPropertiesObject<QQuickKeyNavigationAttached>(
i));
613 switch (
event->key()) {
676 switch (
event->key()) {
680 if (mirror ?
d->right :
d->left)
686 if (mirror ?
d->left :
d->right)
716void QQuickKeyNavigationAttached::setFocusNavigation(
QQuickItem *currentItem,
const char *
dir,
720 bool isNextItem =
false;
721 QVector<QQuickItem *> visitedItems;
728 qmlAttachedPropertiesObject<QQuickKeyNavigationAttached>(currentItem,
false);
732 visitedItems.append(currentItem);
733 currentItem = tempItem;
739 while (currentItem != initialItem && isNextItem && !visitedItems.contains(currentItem));
783 keySignal =
"digit0Pressed";
794bool QQuickKeysAttached::isConnected(
const char *signalName)
const
797 int signal_index =
d->signalIndex(signalName);
798 return d->isSignalConnected(signal_index);
1237 qWarning() <<
"Could not attach Keys property to: " <<
parent <<
" is not an Item";
1263 for (
int ii = 0; ii <
d->targets.size(); ++ii) {
1265 if (targetItem && (targetItem->
flags() & QQuickItem::ItemAcceptsInputMethod)) {
1266 d->item->
setFlag(QQuickItem::ItemAcceptsInputMethod);
1284 if (
d->item &&
d->item->window()) {
1286 for (
int ii = 0; ii <
d->targets.size(); ++ii) {
1288 if (
i &&
i->isVisible()) {
1291 if (
event->isAccepted()) {
1303 if (!keySignal.isEmpty()) {
1304 keySignal +=
"(QQuickKeyEvent*)";
1305 if (isConnected(keySignal)) {
1307 ke.setAccepted(
true);
1308 int idx = QQuickKeysAttached::staticMetaObject.indexOfSignal(keySignal);
1312 if (!ke.isAccepted())
1314 event->setAccepted(ke.isAccepted());
1328 if (
d->item &&
d->item->window()) {
1329 d->inRelease =
true;
1330 for (
int ii = 0; ii <
d->targets.size(); ++ii) {
1332 if (
i &&
i->isVisible()) {
1335 if (
event->isAccepted()) {
1336 d->inRelease =
false;
1341 d->inRelease =
false;
1347 event->setAccepted(ke.isAccepted());
1358 for (
int ii = 0; ii <
d->targets.size(); ++ii) {
1360 if (targetItem && targetItem->
isVisible() && (targetItem->
flags() & QQuickItem::ItemAcceptsInputMethod)) {
1362 if (
event->isAccepted()) {
1363 d->imeItem = targetItem;
1371 QQuickItemKeyFilter::inputMethodEvent(
event,
post);
1378 for (
int ii = 0; ii <
d->targets.size(); ++ii) {
1380 if (
i &&
i->isVisible() && (
i->flags() & QQuickItem::ItemAcceptsInputMethod) &&
i ==
d->imeItem) {
1383 if (
v.userType() == QMetaType::QRectF)
1384 v =
d->item->mapRectFromItem(
i,
v.toRectF());
1389 return QQuickItemKeyFilter::inputMethodQuery(
query);
1492 itemPrivate->
extra.value().layoutDirectionAttached =
this;
1494 qmlWarning(
parent) <<
tr(
"LayoutDirection attached property only works with Items and Windows");
1579 anchor_d->fillChanged();
1580 anchor_d->centerInChanged();
1581 anchor_d->updateHorizontalAnchors();
1584 if (
extra.isAllocated() &&
extra->layoutDirectionAttached) {
1585 emit extra->layoutDirectionAttached->enabledChanged();
1642 itemPrivate->
extra.value().enterKeyAttached =
this;
1659 if (keyType !=
type) {
1686 QQuickItem *oldSubFocusItem = scopePrivate->subFocusItem;
1688 if (oldSubFocusItem) {
1690 while (sfi && sfi != scope) {
1692 sfi = sfi->parentItem();
1697 scopePrivate->subFocusItem =
q;
1699 while (sfi && sfi != scope) {
1701 sfi = sfi->parentItem();
1704 scopePrivate->subFocusItem =
nullptr;
1715 switch (eventType) {
1719 if (setFocusOnRelease)
1724 if (!setFocusOnRelease)
2375 d->inDestructor =
true;
2377 if (
d->windowRefCount > 1)
2378 d->windowRefCount = 1;
2385 child->setParentItem(
nullptr);
2386 d->childItems.clear();
2403 d->changeListeners.clear();
2410 for (
int ii = 0; ii <
d->transforms.size(); ++ii) {
2416 if (
d->extra.isAllocated()) {
2417 delete d->extra->contents;
d->extra->contents =
nullptr;
2418#if QT_CONFIG(quick_shadereffect)
2419 delete d->extra->layer;
d->extra->layer =
nullptr;
2423 delete d->_anchors;
d->_anchors =
nullptr;
2424 delete d->_stateGroup;
d->_stateGroup =
nullptr;
2426 d->isQuickItem =
false;
2440#if QT_CONFIG(accessibility)
2442 if (role == QAccessible::EditableText || role == QAccessible::Table || role == QAccessible::List) {
2444 }
else if (role == QAccessible::ComboBox || role == QAccessible::SpinBox) {
2445 if (QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(
item))
2446 return iface->state().editable;
2452 return editable.
toBool();
2455 if (readonly.
isValid() && !readonly.
toBool() &&
item->property(
"text").isValid())
2498 next->forceActiveFocus(reason);
2506 qWarning() <<
"QQuickItemPrivate::nextTabChildItem called with null item.";
2511 if (start < 0 || start >=
count) {
2512 qWarning() <<
"QQuickItemPrivate::nextTabChildItem: Start index value out of range for item" <<
item;
2517 if (!
child->d_func()->isTabFence)
2527 qWarning() <<
"QQuickItemPrivate::prevTabChildItem called with null item.";
2534 if (start < 0 || start >=
count) {
2535 qWarning() <<
"QQuickItemPrivate::prevTabChildItem: Start index value out of range for item" <<
item;
2538 while (
start >= 0) {
2540 if (!
child->d_func()->isTabFence)
2550 qCDebug(lcFocus) <<
"QQuickItemPrivate::nextPrevItemInTabFocusChain: item:" <<
item <<
", forward:" << forward;
2579 while (startItem && !startItem->isVisible()) {
2587 qCDebug(lcFocus) <<
"QQuickItemPrivate::nextPrevItemInTabFocusChain: startItem:" << startItem;
2588 qCDebug(lcFocus) <<
"QQuickItemPrivate::nextPrevItemInTabFocusChain: firstFromItem:" << firstFromItem;
2589 QDuplicateTracker<QQuickItem *> cycleDetector;
2591 qCDebug(lcFocus) <<
"QQuickItemPrivate::nextPrevItemInTabFocusChain: current:" << current;
2592 qCDebug(lcFocus) <<
"QQuickItemPrivate::nextPrevItemInTabFocusChain: from:" << from;
2602 hasChildren =
false;
2611 if (hasChildren && from == current->
parentItem()) {
2613 current = firstChild;
2615 current = lastChild;
2619 }
else if (hasChildren && forward && from != lastChild) {
2623 }
else if (hasChildren && !forward && from != firstChild) {
2635 if (last != firstSibling
2636 || (
parent->isFocusScope() &&
parent->activeFocusOnTab() &&
parent->hasActiveFocus()))
2640 }
else if (hasChildren) {
2641 if (!
wrap && (forward || firstFromItem != from)) {
2642 qCDebug(lcFocus) <<
"QQuickItemPrivate::nextPrevItemInTabFocusChain:"
2643 <<
"Focus chain about to wrap.";
2651 current = firstChild;
2653 current = lastChild;
2666 if (((current == startItem || current == originalStartItem) && from == firstFromItem) ||
2667 (!skip && cycleDetector.hasSeen(current))) {
2669 if (
item == contentItem) {
2670 qCDebug(lcFocus) <<
"QQuickItemPrivate::nextPrevItemInTabFocusChain: looped, return contentItem";
2673 qCDebug(lcFocus) <<
"QQuickItemPrivate::nextPrevItemInTabFocusChain: looped, return " << startItem;
2677 if (!firstFromItem) {
2678 if (startItem->d_func()->isTabFence) {
2679 if (current == startItem)
2680 firstFromItem = from;
2682 startItem = current;
2683 firstFromItem = from;
2719 return d->parentItem;
2730 while (itemAncestor !=
nullptr) {
2732 qWarning() <<
"QQuickItem::setParentItem: Parent" <<
parentItem <<
"is already part of the subtree of" <<
this;
2739 d->removeFromDirtyList();
2744 if (oldParentItem) {
2750 scopeFocusedItem =
this;
2752 scopeFocusedItem =
d->subFocusItem;
2754 if (scopeFocusedItem) {
2755 scopeItem = oldParentItem;
2756 while (!scopeItem->isFocusScope() && scopeItem->parentItem())
2757 scopeItem = scopeItem->parentItem();
2759 d->deliveryAgentPrivate()->
2762 if (scopeFocusedItem !=
this)
2772 emit oldParentItem->visibleChildrenChanged();
2773 }
else if (
d->window) {
2778 bool alreadyAddedChild =
false;
2779 if (
d->window == parentWindow) {
2783 auto oldParentItem =
d->parentItem;
2785 if (
d->parentItem) {
2787 alreadyAddedChild =
true;
2795 if (!oldParentItem &&
d->window) {
2800 d->refWindow(parentWindow);
2805 if (
d->parentItem && !alreadyAddedChild)
2807 else if (
d->window && !alreadyAddedChild)
2810 d->setEffectiveVisibleRecur(
d->calcEffectiveVisible());
2811 d->setEffectiveEnableRecur(
nullptr,
d->calcEffectiveEnable());
2813 if (
d->parentItem) {
2814 if (!scopeFocusedItem) {
2816 scopeFocusedItem =
this;
2818 scopeFocusedItem =
d->subFocusItem;
2821 if (scopeFocusedItem) {
2824 while (!scopeItem->isFocusScope() && scopeItem->parentItem())
2825 scopeItem = scopeItem->parentItem();
2828 || (!scopeItem->isFocusScope() && scopeItem->hasFocus())) {
2829 if (scopeFocusedItem !=
this)
2832 emit scopeFocusedItem->focusChanged(
false);
2835 d->deliveryAgentPrivate()->
2846 d->resolveLayoutMirror();
2850 if (!
d->inDestructor)
2853 emit d->parentItem->visibleChildrenChanged();
2876 if (!sibling || sibling ==
this || !
d->parentItem ||
d->parentItem !=
QQuickItemPrivate::get(sibling)->parentItem) {
2877 qWarning().nospace() <<
"QQuickItem::stackBefore: Cannot stack "
2878 <<
this <<
" before " << sibling <<
", which must be a sibling";
2884 int myIndex = parentPrivate->childItems.lastIndexOf(
this);
2885 int siblingIndex = parentPrivate->childItems.lastIndexOf(
const_cast<QQuickItem *
>(sibling));
2887 Q_ASSERT(myIndex != -1 && siblingIndex != -1);
2889 if (myIndex == siblingIndex - 1)
2892 parentPrivate->childItems.move(myIndex, myIndex < siblingIndex ? siblingIndex - 1 : siblingIndex);
2894 parentPrivate->markSortedChildrenDirty(
this);
2897 for (
int ii =
qMin(siblingIndex, myIndex); ii < parentPrivate->childItems.size(); ++ii)
2921 if (!sibling || sibling ==
this || !
d->parentItem ||
d->parentItem !=
QQuickItemPrivate::get(sibling)->parentItem) {
2922 qWarning().nospace() <<
"QQuickItem::stackAfter: Cannot stack "
2923 <<
this <<
" after " << sibling <<
", which must be a sibling";
2929 int myIndex = parentPrivate->childItems.lastIndexOf(
this);
2930 int siblingIndex = parentPrivate->childItems.lastIndexOf(
const_cast<QQuickItem *
>(sibling));
2932 Q_ASSERT(myIndex != -1 && siblingIndex != -1);
2934 if (myIndex == siblingIndex + 1)
2937 parentPrivate->childItems.move(myIndex, myIndex > siblingIndex ? siblingIndex + 1 : siblingIndex);
2939 parentPrivate->markSortedChildrenDirty(
this);
2942 for (
int ii =
qMin(myIndex, siblingIndex + 1); ii < parentPrivate->childItems.size(); ++ii)
2965 return lhs->
z() < rhs->
z();
3003#if QT_CONFIG(cursor)
3013 childPrivate->recursiveRefFromEffectItem(
extra.value().recursiveEffectRefCount);
3019 emit q->childrenChanged();
3036#if QT_CONFIG(cursor)
3045 childPrivate->recursiveRefFromEffectItem(-
extra.value().recursiveEffectRefCount);
3054 emit q->childrenChanged();
3073 qWarning(
"QQuickItem: Cannot use same item on different windows at the same time.");
3093 if (
extra.isAllocated() &&
extra->screenAttached)
3094 extra->screenAttached->windowChanged(
c);
3109 q->releaseResources();
3113 c->itemsToPolish.removeOne(
q);
3114#if QT_CONFIG(cursor)
3115 if (
c->cursorItem ==
q) {
3116 c->cursorItem =
nullptr;
3123 c->parentlessItems.remove(
q);
3129 if (
extra.isAllocated()) {
3130 extra->opacityNode =
nullptr;
3131 extra->clipNode =
nullptr;
3132 extra->rootNode =
nullptr;
3144 if (
extra.isAllocated() &&
extra->screenAttached)
3145 extra->screenAttached->windowChanged(
nullptr);
3183 qreal x = this->x.valueBypassingBindings();
3184 qreal y = this->y.valueBypassingBindings();
3192 *
t =
m.toTransform();
3197 t->translate(tp.
x(), tp.
y());
3200 t->translate(-tp.
x(), -tp.
y());
3212 QPoint quickWidgetOffset;
3214 QPointF pos = (renderWindow ? renderWindow :
window)->mapToGlobal(quickWidgetOffset);
3226 QPoint quickWidgetOffset;
3228 QPointF pos = (renderWindow ? renderWindow :
window)->mapToGlobal(quickWidgetOffset);
3244 return d->componentComplete;
3251 , widthValidFlag(
false)
3252 , heightValidFlag(
false)
3253 , componentComplete(true)
3256 , hoverEnabled(
false)
3258 , antialiasing(
false)
3260 , activeFocus(
false)
3261 , notifiedFocus(
false)
3262 , notifiedActiveFocus(
false)
3263 , filtersChildMouseEvents(
false)
3264 , explicitVisible(true)
3265 , effectiveVisible(true)
3266 , explicitEnable(true)
3267 , effectiveEnable(true)
3268 , polishScheduled(
false)
3269 , inheritedLayoutMirror(
false)
3270 , effectiveLayoutMirror(
false)
3271 , isMirrorImplicit(true)
3272 , inheritMirrorFromParent(
false)
3273 , inheritMirrorFromItem(
false)
3274 , isAccessible(
false)
3277 , subtreeCursorEnabled(
false)
3278 , subtreeHoverEnabled(
false)
3279 , activeFocusOnTab(
false)
3280 , implicitAntialiasing(
false)
3281 , antialiasingValid(
false)
3283 , replayingPressEvent(
false)
3284 , touchEnabled(
false)
3285 , hasCursorHandler(
false)
3286 , maybeHasSubsceneDeliveryAgent(true)
3287 , subtreeTransformChangedEnabled(true)
3288 , inDestructor(
false)
3289 , focusReason(
Qt::OtherFocusReason)
3290 , focusPolicy(
Qt::NoFocus)
3291 , dirtyAttributes(0)
3297 , sortedChildItems(&childItems)
3354 if (pointerHandler->parent() != that) {
3355 qCDebug(lcHandlerParent) <<
"reparenting handler" << pointerHandler <<
":" << pointerHandler->parent() <<
"->" << that;
3356 pointerHandler->setParent(that);
3404 QQmlListProperty<QObject> resourcesProperty = privateItem->resources();
3405 QQmlListProperty<QQuickItem> childrenProperty = privateItem->children();
3414 QQmlListProperty<QObject> resourcesProperty = privateItem->resources();
3415 QQmlListProperty<QQuickItem> childrenProperty = privateItem->children();
3418 if (
i < resourcesCount)
3430 QQmlListProperty<QObject> resourcesProperty = privateItem->resources();
3431 QQmlListProperty<QQuickItem> childrenProperty = privateItem->children();
3442 QQmlListProperty<QQuickItem> childrenProperty = privateItem->children();
3448 QQmlListProperty<QObject> resourcesProperty = privateItem->resources();
3456 return quickItemPrivate->extra.isAllocated() ? quickItemPrivate->extra->resourcesList.value(
index) : 0;
3463 if (!quickItemPrivate->extra.value().resourcesList.contains(
object)) {
3464 quickItemPrivate->extra.value().resourcesList.append(
object);
3473 return quickItemPrivate->extra.isAllocated() ? quickItemPrivate->extra->resourcesList.size() : 0;
3480 if (quickItemPrivate->extra.isAllocated()) {
3481 for (
QObject *
object : std::as_const(quickItemPrivate->extra->resourcesList)) {
3485 quickItemPrivate->extra->resourcesList.clear();
3493 if (quickItemPrivate->extra.isAllocated()) {
3494 QList<QObject *> *
resources = &quickItemPrivate->extra->resourcesList;
3510 return p->childItems.at(
index);
3519 if (
o->parentItem() == that)
3520 o->setParentItem(
nullptr);
3522 o->setParentItem(that);
3528 return p->childItems.size();
3535 while (!
p->childItems.isEmpty())
3536 p->childItems.at(0)->setParentItem(
nullptr);
3543 if (!
p->childItems.isEmpty())
3544 p->childItems.last()->setParentItem(
nullptr);
3553 if (
p->childItems.at(
c)->isVisible()) visibleCount++;
3556 return visibleCount;
3562 const qsizetype childCount =
p->childItems.size();
3568 if (
p->childItems.at(
i)->isVisible()) visibleCount++;
3569 if (visibleCount ==
index)
return p->childItems.at(
i);
3579 return p->transforms.size();
3590 if (!
d->items.isEmpty() && !
p->transforms.isEmpty() &&
p->transforms.contains(
this)) {
3591 p->transforms.removeOne(
this);
3592 p->transforms.append(
this);
3594 p->transforms.append(
this);
3595 d->items.append(
item);
3609 if (!
d->items.isEmpty() && !
p->transforms.isEmpty() &&
p->transforms.contains(
this)) {
3610 p->transforms.removeOne(
this);
3611 p->transforms.prepend(
this);
3613 p->transforms.prepend(
this);
3614 d->items.append(
item);
3634 if (idx < 0 || idx >=
p->transforms.size())
3637 return p->transforms.at(idx);
3645 for (
qsizetype ii = 0; ii <
p->transforms.size(); ++ii) {
3651 p->transforms.clear();
3658 if (
extra.isAllocated() &&
extra->resourcesList.contains(
object))
3659 extra->resourcesList.removeAll(
object);
3777 QQmlListProperty<QObject>
result;
3821 if (!
d->extra.isAllocated() || !
d->extra->contents) {
3823 if (
d->componentComplete)
3824 d->extra->contents->complete();
3826 return d->extra->contents->rectF();
3835 return d->childItems;
3922#if QT_CONFIG(accessibility)
3923 if (QAccessible::isActive()) {
3924 if (
QObject *acc = QQuickAccessibleAttached::findAccessible(
this)) {
3925 QAccessibleEvent ev(acc, QAccessible::LocationChanged);
3926 QAccessible::updateAccessibility(&ev);
3993QQuickItem::UpdatePaintNodeData::UpdatePaintNodeData()
4038#define PRINT_LISTENERS() \
4040 qDebug().nospace() << q_func() << " (" << this \
4041 << ") now has the following listeners:"; \
4042 for (const auto &listener : std::as_const(changeListeners)) { \
4043 const auto objectPrivate = dynamic_cast<QObjectPrivate*>(listener.listener); \
4044 qDebug().nospace() << "- " << listener << " (QObject: " << (objectPrivate ? objectPrivate->q_func() : nullptr) << ")"; \
4053 if (lcChangeListeners().isDebugEnabled())
4066 if (lcChangeListeners().isDebugEnabled())
4075 if (lcChangeListeners().isDebugEnabled())
4089 if (lcChangeListeners().isDebugEnabled())
4097 if (
types.noChange()) {
4105 if (lcChangeListeners().isDebugEnabled())
4160#if QT_CONFIG(accessibility)
4161 if (QAccessible::isActive()) {
4162 if (
QObject *acc = QQuickAccessibleAttached::findAccessible(
this)) {
4163 QAccessibleEvent ev(acc, QAccessible::Focus);
4164 QAccessible::updateAccessibility(&ev);
4168 d->setLastFocusChangeReason(
event->reason());
4181 d->setLastFocusChangeReason(
event->reason());
4261#if QT_CONFIG(wheelevent)
4269void QQuickItem::wheelEvent(QWheelEvent *
event)
4329#if QT_CONFIG(quick_draganddrop)
4342void QQuickItem::dragEnterEvent(QDragEnterEvent *
event)
4359void QQuickItem::dragMoveEvent(QDragMoveEvent *
event)
4376void QQuickItem::dragLeaveEvent(QDragLeaveEvent *
event)
4393void QQuickItem::dropEvent(QDropEvent *
event)
4452 v = (bool)(
flags() & ItemAcceptsInputMethod);
4465 if (
d->extra.isAllocated() &&
d->extra->keyHandler)
4466 v =
d->extra->keyHandler->inputMethodQuery(
query);
4469 if (
d->extra.isAllocated() &&
d->extra->enterKeyAttached)
4470 v =
d->extra->enterKeyAttached->type();
4564 return d->baselineOffset;
4570 if (
offset ==
d->baselineOffset)
4602 qWarning() <<
metaObject()->className() <<
": Update called for a item without content";
4620 if (!
d->polishScheduled) {
4621 d->polishScheduled =
true;
4624 bool maybeupdate =
p->itemsToPolish.isEmpty();
4625 p->itemsToPolish.append(
this);
4626 if (maybeupdate)
d->window->maybeUpdate();
4646void QQuickItem::ensurePolished()
4651#if QT_DEPRECATED_SINCE(6, 5)
4665 if (!
item->isNull()) {
4671 if (!(*itemObj) && !
item->isNull()) {
4672 qmlWarning(itemForWarning) << functionNameForWarning <<
" given argument \"" <<
item->toQStringNoThrow()
4673 <<
"\" which is neither null nor an Item";
4683 qmlWarning(itemForWarning) << functionNameForWarning <<
"given argument \"" << sv->toQStringNoThrow()
4684 <<
"\" which is neither a point nor a rect";
4694 }
else if (
v.canConvert<
QRectF>()) {
4702 qmlWarning(itemForWarning) << functionNameForWarning <<
"given argument \"" << sv->toQStringNoThrow()
4703 <<
"\" which is neither a point nor a rect";
4711 if (!vx->isNumber() || !vy->isNumber()) {
4716 *
x = vx->asDouble();
4717 *
y = vy->asDouble();
4722 if (!vw->isNumber() || !vh->isNumber()) {
4726 *
w = vw->asDouble();
4727 *
h = vh->asDouble();
4754#if QT_DEPRECATED_SINCE(6, 5)
4766 if (!unwrapMapFromToFromItemArgs(
args,
this,
QStringLiteral(
"mapFromItem()"), &itemObj, &
x, &
y, &
w, &
h, &isRect))
4773 args->setReturnValue(rv.asReturnedValue());
4812#if QT_DEPRECATED_SINCE(6, 5)
4824 if (!unwrapMapFromToFromItemArgs(
args,
this,
QStringLiteral(
"mapToItem()"), &itemObj, &
x, &
y, &
w, &
h, &isRect))
4831 args->setReturnValue(rv.asReturnedValue());
4847 qmlWarning(itemForWarning) << functionNameForWarning <<
"given argument \"" << sv->toQStringNoThrow()
4848 <<
"\" which is not a point";
4859 qmlWarning(itemForWarning) << functionNameForWarning <<
"given argument \"" << sv->toQStringNoThrow()
4860 <<
"\" which is not a point";
4868 if (!vx->isNumber() || !vy->isNumber()) {
4873 *
x = vx->asDouble();
4874 *
y = vy->asDouble();
4904 args->setReturnValue(rv.asReturnedValue());
4918#if QT_DEPRECATED_SINCE(6, 5)
4934 args->setReturnValue(rv.asReturnedValue());
5026QQuickItem *QQuickItem::nextItemInFocusChain(
bool forward)
5052 if (
child->isVisible() &&
child->contains(point))
5099void QQuickItem::dumpItemTree()
const
5110 qDebug().nospace().noquote() << indentStr <<
5111#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
5116 if (
extra.isAllocated()) {
5117 for (
const auto handler :
extra->pointerHandlers)
5118 qDebug().nospace().noquote() << indentStr << u
" \u26ee " << handler;
5122 itemPriv->dumpItemTree(indent + 1);
5130 QQmlListProperty<QObject>
result;
5161 QQmlListProperty<QQuickItem>
result;
5162 result.object = q_func();
5183 return QQmlListProperty<QQuickItem>(q_func(),
5348 d->componentComplete =
false;
5350 d->_stateGroup->classBegin();
5352 d->_anchors->classBegin();
5353#if QT_CONFIG(quick_shadereffect)
5354 if (
d->extra.isAllocated() &&
d->extra->layer)
5355 d->extra->layer->classBegin();
5367 d->componentComplete =
true;
5369 d->_stateGroup->componentComplete();
5371 d->_anchors->componentComplete();
5375 if (
d->extra.isAllocated()) {
5376#if QT_CONFIG(quick_shadereffect)
5377 if (
d->extra->layer)
5378 d->extra->layer->componentComplete();
5381 if (
d->extra->keyHandler)
5382 d->extra->keyHandler->componentComplete();
5384 if (
d->extra->contents)
5385 d->extra->contents->complete();
5388 if (
d->window &&
d->dirtyAttributes) {
5389 d->addToDirtyList();
5393#if QT_CONFIG(accessibility)
5394 if (
d->isAccessible &&
d->effectiveVisible) {
5395 QAccessibleEvent ev(
this, QAccessible::ObjectShow);
5396 QAccessible::updateAccessibility(&ev);
5458 bool childWantsIt =
false;
5467#if QT_CONFIG(quick_shadereffect)
5468 if (
q == transformedItem) {
5470 extra->layer->updateMatrix();
5474 const bool ret = childWantsIt || thisWantsIt;
5476 qCDebug(lcVP) <<
"turned off subtree transformChanged notification after checking all children of" <<
q;
5508 qreal startRotation,
5509 qreal activeRotation)
5512 QVector3D xformOrigin(
q->transformOriginPoint());
5514 startMatrix.
translate(
float(startPos.
x()),
float(startPos.
y()));
5515 startMatrix.translate(xformOrigin);
5516 startMatrix.scale(
float(startScale));
5517 startMatrix.rotate(
float(startRotation), 0, 0, -1);
5518 startMatrix.translate(-xformOrigin);
5520 const QVector3D centroidParentVector(centroidParentPos);
5523 mat.rotate(
float(activeRotation), 0, 0, 1);
5524 mat.scale(
float(activeScale));
5525 mat.translate(-centroidParentVector);
5526 mat.translate(
QVector3D(activeTranslation));
5528 mat = mat * startMatrix;
5530 QPointF xformOriginPoint =
q->transformOriginPoint();
5532 pos -= xformOriginPoint;
5565 if (qmlobject_cast<QQuickRootItem *>(
p->q_ptr)) {
5573 if (
p->extra.isAllocated()) {
5574 if (
auto da =
p->extra->subsceneDeliveryAgent)
5581 qCDebug(lcPtr) <<
"detached root of" <<
q <<
"is not a QQuickRootItem and also does not have its own DeliveryAgent";
5609 if (
extra.isAllocated() &&
extra->subsceneDeliveryAgent)
5610 return extra->subsceneDeliveryAgent;
5612 qCDebug(lcPtr) <<
"created new" <<
extra->subsceneDeliveryAgent;
5616 return extra->subsceneDeliveryAgent;
5621 if (!
extra.isAllocated() || !
extra->keyHandler)
5630 extra->keyHandler->keyReleased(e,
post);
5638 const auto eventType =
event->type();
5641 switch (eventType) {
5651#if QT_CONFIG(wheelevent)
5653 q->wheelEvent(
static_cast<QWheelEvent*
>(
event));
5681 q->keyPressEvent(e);
5683 q->keyReleaseEvent(e);
5693 (
q ==
q->window()->contentItem() ||
q->activeFocusOnTab())) {
5713 if (
extra.isAllocated() &&
extra->keyHandler) {
5714 extra->keyHandler->inputMethodEvent(e,
false);
5722 q->inputMethodEvent(e);
5727 if (
extra.isAllocated() &&
extra->keyHandler) {
5730 extra->keyHandler->inputMethodEvent(e,
true);
5737 if (
extra.isAllocated() &&
extra->keyHandler)
5738 extra->keyHandler->shortcutOverrideEvent(
event);
5748 if (handler->wantsEventPoint(
event, point))
5766 bool delivered =
false;
5767 if (
extra.isAllocated()) {
5769 bool avoidThisHandler =
false;
5771 qmlobject_cast<const QQuickHoverHandler *>(handler)) {
5772 avoidThisHandler =
true;
5773 }
else if (avoidGrabbers) {
5774 for (
auto &
p :
event->points()) {
5775 if (
event->exclusiveGrabber(
p) == handler ||
event->passiveGrabbers(
p).contains(handler)) {
5776 avoidThisHandler =
true;
5781 if (!avoidThisHandler &&
5783 handler->handlePointerEvent(
event);
5815void QQuickItem::updateInputMethod(Qt::InputMethodQueries queries)
5829 return QRectF(0, 0,
d->width,
d->height);
5864 qCDebug(lcVP) <<
this <<
"intersecting" <<
viewport << mappedViewportRect <<
ret <<
"->" << mappedViewportRect.intersected(
ret);
5865 return mappedViewportRect.intersected(
ret);
5934 if (origin ==
d->origin())
5937 d->extra.value().origin = origin;
5953 if (
d->extra.isAllocated() && !
d->extra->userTransformOriginPoint.isNull())
5954 return d->extra->userTransformOriginPoint;
5955 return d->computeTransformOrigin();
5964 if (
d->extra.value().userTransformOriginPoint == point)
5967 d->extra->userTransformOriginPoint = point;
6137 d->extra.value().z =
v;
6140 if (
d->parentItem) {
6147#if QT_CONFIG(quick_shadereffect)
6148 if (
d->extra.isAllocated() &&
d->extra->layer)
6149 d->extra->layer->updateZ();
6208 return d->rotation();
6214 if (
d->rotation() ==
r)
6217 d->extra.value().rotation =
r;
6314 if (
d->scale() ==
s)
6317 d->extra.value().scale =
s;
6437 return d->opacity();
6443 qreal o = qBound<qreal>(0, newOpacity, 1);
6444 if (
d->opacity() ==
o)
6447 d->extra.value().opacity =
o;
6523 return d->effectiveVisible;
6590 return d->effectiveEnable;
6596 if (e ==
d->explicitEnable)
6599 d->explicitEnable = e;
6605 d->setEffectiveEnableRecur(scope,
d->calcEffectiveEnable());
6634 agent->removeGrabber(
q,
true,
true,
true);
6636 bool childVisibilityChanged =
false;
6641#if QT_CONFIG(accessibility)
6643 QAccessibleEvent ev(
q,
effectiveVisible ? QAccessible::ObjectShow : QAccessible::ObjectHide);
6644 QAccessible::updateAccessibility(&ev);
6648 emit q->visibleChanged();
6649 if (childVisibilityChanged)
6650 emit q->visibleChildrenChanged();
6682 da->removeGrabber(
q,
true,
true,
true);
6702#if QT_CONFIG(accessibility)
6705 changedState.disabled =
true;
6706 changedState.focusable =
true;
6707 QAccessibleStateChangeEvent ev(
q, changedState);
6708 QAccessible::updateAccessibility(&ev);
6711 emit q->enabledChanged();
6716 return extra.isAllocated() &&
extra.value().transparentForPositioner;
6721 extra.value().transparentForPositioner = transparent;
6727#define DIRTY_TO_STRING(value) if (dirtyAttributes & value) { \
6728 if (!rv.isEmpty()) \
6729 rv.append(QLatin1Char('|')); \
6730 rv.append(QLatin1String(#value)); \
6784 p->dirtyItemList =
q;
6804 ++
extra.value().effectRefCount;
6805 if (
extra->effectRefCount == 1) {
6811 if (++
extra->hideRefCount == 1)
6822 extra.value().recursiveEffectRefCount += refs;
6836 --
extra->effectRefCount;
6837 if (
extra->effectRefCount == 0) {
6843 if (--
extra->hideRefCount == 0)
6855 if ((cull && ++
extra.value().hideRefCount == 1) || (!cull && --
extra.value().hideRefCount == 0))
6864 q->itemChange(change,
data);
6872 qCDebug(lcVP) <<
"turned on transformChanged notification for subtree of" <<
q;
6881 q->itemChange(change,
data);
6886 q->itemChange(change,
data);
6889 q->itemChange(change,
data);
6894 q->itemChange(change,
data);
6899 q->itemChange(change,
data);
6904 q->itemChange(change,
data);
6909 q->itemChange(change,
data);
6912 q->itemChange(change,
data);
6919 q->itemChange(change,
data);
6992 return d->activeFocusOnTab;
7002 qWarning(
"QQuickItem: Cannot set activeFocusOnTab to false once item is the active focus item.");
7034 return d->antialiasingValid ?
d->antialiasing :
d->implicitAntialiasing;
7041 if (!
d->antialiasingValid) {
7042 d->antialiasingValid =
true;
7043 d->antialiasing =
d->implicitAntialiasing;
7046 if (aa ==
d->antialiasing)
7049 d->antialiasing = aa;
7060 if (!
d->antialiasingValid)
7063 d->antialiasingValid =
false;
7065 if (
d->implicitAntialiasing !=
d->antialiasing)
7072 bool prev =
q->antialiasing();
7075 emit q->antialiasingChanged(
q->antialiasing());
7086 return (QQuickItem::Flags)
d->flags;
7108 d->enableSubtreeChangeNotificationsForParentHierachy();
7118 if (!parPriv->subtreeTransformChangedEnabled)
7119 qCDebug(lcVP) <<
"turned on transformChanged notification for subtree of" << par;
7120 parPriv->subtreeTransformChangedEnabled =
true;
7136 qWarning(
"QQuickItem: Cannot set FocusScope once item has children and is in a window.");
7137 flags &= ~ItemIsFocusScope;
7139 qWarning(
"QQuickItem: Cannot unset FocusScope flag.");
7208 d->x.removeBindingUnlessInWrapper();
7212 const qreal oldx =
d->x.valueBypassingBindings();
7216 d->x.setValueBypassingBindings(
v);
7220 const qreal y =
d->y.valueBypassingBindings();
7221 const qreal w =
d->width.valueBypassingBindings();
7222 const qreal h =
d->height.valueBypassingBindings();
7229 d->y.removeBindingUnlessInWrapper();
7233 const qreal oldy =
d->y.valueBypassingBindings();
7237 d->y.setValueBypassingBindings(
v);
7243 const qreal x =
d->x.valueBypassingBindings();
7244 const qreal w =
d->width.valueBypassingBindings();
7245 const qreal h =
d->height.valueBypassingBindings();
7256 const qreal oldx =
d->x.valueBypassingBindings();
7257 const qreal oldy =
d->y.valueBypassingBindings();
7275 d->x.setValueBypassingBindings(
pos.x());
7276 d->y.setValueBypassingBindings(
pos.y());
7280 const qreal w =
d->width.valueBypassingBindings();
7281 const qreal h =
d->height.valueBypassingBindings();
7290 return QBindable<qreal>(&d_func()->
x);
7295 return QBindable<qreal>(&d_func()->
y);
7312 d->width.removeBindingUnlessInWrapper();
7316 d->widthValidFlag =
true;
7317 const qreal oldWidth =
d->width.valueBypassingBindings();
7321 d->width.setValueBypassingBindings(
w);
7325 const qreal x =
d->x.valueBypassingBindings();
7326 const qreal y =
d->y.valueBypassingBindings();
7327 const qreal h =
d->height.valueBypassingBindings();
7334 d->width.takeBinding();
7335 d->widthValidFlag =
false;
7343 emit q->implicitWidthChanged();
7356 return d->getImplicitWidth();
7361 return QBindable<qreal>(&d_func()->
width);
7449 bool changed =
w !=
d->implicitWidth;
7450 d->implicitWidth =
w;
7452 if (
d->width.valueBypassingBindings() ==
w ||
widthValid()) {
7454 d->implicitWidthChanged();
7455 if (
d->width.valueBypassingBindings() ==
w ||
widthValid())
7460 const qreal oldWidth =
d->width.valueBypassingBindings();
7461 Q_ASSERT(!
d->width.hasBinding() || QQmlPropertyBinding::isUndefined(
d->width.binding()));
7463 d->width.setValueBypassingBindings(
w);
7467 const qreal x =
d->x.valueBypassingBindings();
7468 const qreal y =
d->y.valueBypassingBindings();
7470 const qreal height =
d->height.valueBypassingBindings();
7474 d->implicitWidthChanged();
7500 return d->widthValid();
7520 d->height.removeBindingUnlessInWrapper();
7524 d->heightValidFlag =
true;
7525 const qreal oldHeight =
d->height.valueBypassingBindings();
7529 d->height.setValueBypassingBindings(
h);
7533 const qreal x =
d->x.valueBypassingBindings();
7534 const qreal y =
d->y.valueBypassingBindings();
7535 const qreal w =
d->width.valueBypassingBindings();
7545 d->height.takeBinding();
7546 d->heightValidFlag =
false;
7554 emit q->implicitHeightChanged();
7565 return d->getImplicitHeight();
7570 return QBindable<qreal>(&d_func()->
height);
7576 bool changed =
h !=
d->implicitHeight;
7577 d->implicitHeight =
h;
7578 if (
d->height.valueBypassingBindings() ==
h ||
heightValid()) {
7580 d->implicitHeightChanged();
7581 if (
d->height.valueBypassingBindings() ==
h ||
heightValid())
7586 const qreal oldHeight =
d->height.valueBypassingBindings();
7587 Q_ASSERT(!
d->height.hasBinding() || QQmlPropertyBinding::isUndefined(
d->height.binding()));
7589 d->height.setValueBypassingBindings(
h);
7593 const qreal x =
d->x.valueBypassingBindings();
7594 const qreal y =
d->y.valueBypassingBindings();
7595 const qreal width =
d->width.valueBypassingBindings();
7596 const qreal height =
d->height.valueBypassingBindings();
7601 d->implicitHeightChanged();
7610 bool wChanged =
w !=
d->implicitWidth;
7611 bool hChanged =
h !=
d->implicitHeight;
7613 d->implicitWidth =
w;
7614 d->implicitHeight =
h;
7622 d->implicitWidthChanged();
7628 d->implicitHeightChanged();
7639 d->width.setValueBypassingBindings(
w);
7643 d->height.setValueBypassingBindings(
h);
7648 const qreal x =
d->x.valueBypassingBindings();
7649 const qreal y =
d->y.valueBypassingBindings();
7651 QRectF(
x,
y, oldWidth, oldHeight));
7653 if (!wDone && wChanged)
7654 d->implicitWidthChanged();
7655 if (!hDone && hChanged)
7656 d->implicitHeightChanged();
7665 return d->heightValid();
7679 return QSizeF(
d->width,
d->height);
7696 d->heightValidFlag =
true;
7697 d->widthValidFlag =
true;
7699 const qreal oldHeight =
d->height.valueBypassingBindings();
7700 const qreal oldWidth =
d->width.valueBypassingBindings();
7702 if (oldWidth ==
size.width() && oldHeight ==
size.height())
7705 d->height.setValueBypassingBindings(
size.height());
7706 d->width.setValueBypassingBindings(
size.width());
7710 const qreal x =
d->x.valueBypassingBindings();
7711 const qreal y =
d->y.valueBypassingBindings();
7787 return d->activeFocus;
7900 bool notifyListeners =
false;
7901 if (
d->window ||
d->parentItem) {
7903 auto da =
d->deliveryAgentPrivate();
7906 da->setFocusInScope(scope,
this, reason);
7908 da->clearFocusInScope(scope,
this, reason);
7912 QVarLengthArray<QQuickItem *, 20> changed;
7914 if (oldSubFocusItem) {
7917 changed << oldSubFocusItem;
7922 d->updateSubFocusItem(scope,
focus);
7926 notifyListeners =
true;
7932 QVarLengthArray<QQuickItem *, 20> changed;
7937 changed << oldSubFocusItem;
7942 notifyListeners =
true;
7947 if (notifyListeners)
7971 return d->subFocusItem;
8033 while ((ancestor = ancestor->parentItem())) {
8034 if (ancestor ==
this)
8054 return d->acceptedMouseButtons();
8071 buttons &=
~Qt::LeftButton;
8072 if (buttons ||
d->extra.isAllocated()) {
8073 d->extra.value().acceptedMouseButtonsWithoutHandlers = buttons;
8074 d->extra.value().acceptedMouseButtons =
d->extra->pointerHandlers.isEmpty() ? buttons :
Qt::AllButtons;
8092 return d->filtersChildMouseEvents;
8107 d->filtersChildMouseEvents =
filter;
8140 return d->hoverEnabled;
8173 return d->touchEnabled;
8192#if QT_CONFIG(cursor)
8202 if (otherChildPrivate->subtreeCursorEnabled || otherChildPrivate->hasCursor)
8211 parentPrivate->setHasCursorInChild(hc);
8232 if (otherChildPrivate->subtreeHoverEnabled || otherChildPrivate->hoverEnabled)
8234 if (otherChildPrivate->hasEnabledHoverHandlers())
8244 parentPrivate->setHasHoverInChild(hasHover);
8248#if QT_CONFIG(cursor)
8264QCursor QQuickItem::cursor()
const
8267 return d->extra.isAllocated()
8286 d->extra.value().cursor =
cursor;
8296 if (!
d->hasCursor) {
8297 d->hasCursor =
true;
8303 updateCursorPos =
pos;
8306 d->setHasCursorInChild(
d->hasCursor ||
d->hasCursorHandler);
8307 if (!updateCursorPos.isNull())
8317void QQuickItem::unsetCursor()
8320 qCDebug(lcHoverTrace) <<
"clearing cursor";
8323 d->hasCursor =
false;
8324 d->setHasCursorInChild(
d->hasCursorHandler);
8325 if (
d->extra.isAllocated())
8330 if (windowPrivate->cursorItem ==
this) {
8332 windowPrivate->updateCursor(
pos);
8349 bool hoverCursorSet =
false;
8351 bool activeCursorSet =
false;
8353 if (
const QQuickHoverHandler *hoverHandler = qobject_cast<const QQuickHoverHandler *>(handler)) {
8354 hoverCursorSet = hoverHandler->isCursorShapeExplicitlySet();
8355 hoverCursor = hoverHandler->cursorShape();
8356 }
else if (handler->
active()) {
8357 activeCursorSet = handler->isCursorShapeExplicitlySet();
8358 activeCursor = handler->cursorShape();
8360 if (activeCursorSet)
8361 return activeCursor;
8395 if (!
h->isCursorShapeExplicitlySet())
8402 if (!activeHandler && hoverHandler && hoverHandler->
isHovered()) {
8403 qCDebug(lcHoverTrace) << hoverHandler << hoverHandler->
acceptedDevices() <<
"wants to set cursor" << hoverHandler->cursorShape();
8406 if (mouseHandler && mouseHandler->cursorShape() != hoverHandler->cursorShape()) {
8407 qCDebug(lcHoverTrace) <<
"mouse cursor conflict:" << mouseHandler <<
"wants" << mouseHandler->cursorShape()
8408 <<
"but" << hoverHandler <<
"wants" << hoverHandler->cursorShape();
8410 mouseHandler = hoverHandler;
8413 if (nonMouseHandler && nonMouseHandler->cursorShape() != hoverHandler->cursorShape()) {
8414 qCDebug(lcHoverTrace) <<
"non-mouse cursor conflict:" << nonMouseHandler <<
"wants" << nonMouseHandler->cursorShape()
8415 <<
"but" << hoverHandler <<
"wants" << hoverHandler->cursorShape();
8417 nonMouseHandler = hoverHandler;
8420 if (!hoverHandler &&
h->active())
8423 if (activeHandler) {
8424 qCDebug(lcHoverTrace) <<
"active handler choosing cursor" << activeHandler << activeHandler->cursorShape();
8425 return activeHandler;
8431 if (nonMouseHandler) {
8433 const bool beforeTimeout =
8439 <<
"choosing cursor according to" << winner << winner->cursorShape();
8442 qCDebug(lcHoverTrace) <<
"non-mouse handler choosing cursor" << nonMouseHandler << nonMouseHandler->cursorShape();
8443 return nonMouseHandler;
8446 qCDebug(lcHoverTrace) <<
"mouse handler choosing cursor" << mouseHandler << mouseHandler->cursorShape();
8447 return mouseHandler;
8471 auto da =
d->deliveryAgentPrivate();
8473 auto eventInDelivery = da->eventInDelivery();
8474 if (!eventInDelivery) {
8475 qWarning() <<
"cannot grab mouse: no event is currently being delivered";
8478 auto epd = da->mousePointData();
8479 eventInDelivery->setExclusiveGrabber(epd->eventPoint,
this);
8498 auto da =
d->deliveryAgentPrivate();
8500 auto eventInDelivery = da->eventInDelivery();
8501 if (!eventInDelivery) {
8503 da->removeGrabber(
this);
8506 const auto &eventPoint = da->mousePointData()->eventPoint;
8507 if (eventInDelivery->exclusiveGrabber(eventPoint) ==
this)
8508 eventInDelivery->setExclusiveGrabber(eventPoint,
nullptr);
8519 return d->keepMouse;
8541 d->keepMouse = keep;
8556 auto event =
d->deliveryAgentPrivate()->eventInDelivery();
8558 qWarning() <<
"cannot grab: no event is currently being delivered";
8561 for (
auto pt :
event->points()) {
8562 if (
ids.contains(pt.id()))
8563 event->setExclusiveGrabber(pt,
this);
8576 d->deliveryAgentPrivate()->removeGrabber(
this,
false,
true);
8588 return d->keepTouch;
8611 d->keepTouch = keep;
8636 if (
d->extra.isAllocated() &&
d->extra->mask) {
8637 if (
auto quickMask = qobject_cast<QQuickItem *>(
d->extra->mask))
8638 return quickMask->contains(point - quickMask->position());
8641 QMetaMethod maskContains =
d->extra->mask->metaObject()->method(
d->extra->maskContainsIndex);
8642 maskContains.invoke(
d->extra->mask,
8651 return x >= 0 &&
y >= 0 &&
x <
d->width &&
y <
d->height;
8720 if (!
d->extra.isAllocated())
8722 return d->extra->mask.data();
8728 const bool extraDataExists =
d->extra.isAllocated();
8733 if (!extraDataExists && !
mask)
8736 if (extraDataExists &&
d->extra->mask ==
mask)
8743 maskPrivate->registerAsContainmentMask(
this,
false);
8746 if (!extraDataExists)
8750 if (methodIndex < 0) {
8751 qmlWarning(
this) <<
QStringLiteral(
"QQuickItem: Object set as mask does not have an invokable contains method, ignoring it.");
8754 d->extra->maskContainsIndex = methodIndex;
8756 d->extra->mask =
mask;
8760 maskPrivate->registerAsContainmentMask(
this,
true);
8762 emit containmentMaskChanged();
8782 if (itemWindow !=
nullptr && itemWindow !=
window())
8783 p = itemWindow->mapFromGlobal(
window()->mapToGlobal(
p));
8802 return d->itemToWindowTransform().map(point);
8825 return d->windowToGlobalTransform().map(
mapToScene(point));
8846 return t.mapRect(
rect);
8861 return d->itemToWindowTransform().mapRect(
rect);
8900 return d->windowToItemTransform().map(point);
8929 QPointF scenePoint =
d->globalToWindowTransform().map(point);
8953 t *=
d->windowToItemTransform();
8954 return t.mapRect(
rect);
8969 return d->windowToItemTransform().mapRect(
rect);
9029 switch (ev->type()) {
9034 for (
uint i = 0;
i < 32; ++
i) {
9055#if QT_CONFIG(wheelevent)
9058 d->deliverPointerEvent(ev);
9077 d->deliverKeyEvent(
static_cast<QKeyEvent*
>(ev));
9080 d->deliverShortcutOverrideEvent(
static_cast<QKeyEvent*
>(ev));
9091#if QT_CONFIG(quick_draganddrop)
9093 dragEnterEvent(
static_cast<QDragEnterEvent*
>(ev));
9096 dragLeaveEvent(
static_cast<QDragLeaveEvent*
>(ev));
9099 dragMoveEvent(
static_cast<QDragMoveEvent*
>(ev));
9102 dropEvent(
static_cast<QDropEvent*
>(ev));
9105#if QT_CONFIG(gestures)
9117 if (
d->providesPalette())
9118 d->setCurrentColorGroup();
9133#ifndef QT_NO_DEBUG_STREAM
9143 debug <<
"QQuickItem(nullptr)";
9149 debug <<
item->metaObject()->className() <<
'(' <<
static_cast<void *
>(
item);
9153 if (
item->isComponentComplete()) {
9155 const auto objectId =
context->nameForObject(
item);
9156 if (!objectId.isEmpty())
9157 debug <<
", id=" << objectId;
9160 if (!
item->objectName().isEmpty())
9161 debug <<
", name=" <<
item->objectName();
9168 debug <<
" \U0001f5bc";
9187#if QT_CONFIG(quick_shadereffect)
9189 return d->extra.isAllocated() &&
d->extra->layer &&
d->extra->layer->effectSource() ?
9190 d->extra->layer->effectSource()->isTextureProvider() :
false;
9207#if QT_CONFIG(quick_shadereffect)
9209 return d->extra.isAllocated() &&
d->extra->layer &&
d->extra->layer->effectSource() ?
9210 d->extra->layer->effectSource()->textureProvider() :
nullptr;
9258#if QT_CONFIG(quick_shadereffect)
9263QQuickItemLayer *QQuickItemPrivate::layer()
const
9266 extra.value().layer =
new QQuickItemLayer(
const_cast<QQuickItem *
>(q_func()));
9268 extra->layer->classBegin();
9270 return extra->layer;
9294 QList<QEventPoint> touchPoints;
9295 QEventPoint::States eventStates;
9297 bool anyPressOrReleaseInside =
false;
9298 bool anyGrabber =
false;
9299 for (
auto &
p :
event->points()) {
9304 auto pointGrabber =
event->exclusiveGrabber(
p);
9305 bool isGrabber = (pointGrabber ==
q);
9306 if (!isGrabber && pointGrabber && isFiltering) {
9307 auto handlerGrabber = qmlobject_cast<QQuickPointerHandler *>(pointGrabber);
9308 if (handlerGrabber && handlerGrabber->parentItem() ==
q)
9315 const auto localPos =
q->mapFromScene(
p.scenePosition());
9316 bool isInside =
q->contains(localPos);
9317 bool hasAnotherGrabber = pointGrabber && pointGrabber !=
q;
9319 if (isFiltering && !pointGrabber) {
9320 const auto pg =
event->passiveGrabbers(
p);
9321 if (!pg.isEmpty()) {
9325 auto handler = qmlobject_cast<QQuickPointerHandler *>(pg.constFirst());
9332 bool grabberIsChild =
false;
9334 while (isFiltering &&
parent) {
9336 grabberIsChild =
true;
9342 bool filterRelevant = isFiltering && grabberIsChild;
9343 if (!(isGrabber || (isInside && (!hasAnotherGrabber || isFiltering)) || filterRelevant))
9346 anyPressOrReleaseInside =
true;
9348 eventStates |=
p.state();
9351 QMutableEventPoint::setPosition(pCopy, localPos);
9352 touchPoints.append(std::move(pCopy));
9357 if (touchPoints.isEmpty() || (!anyPressOrReleaseInside && !anyGrabber && !isFiltering)) {
9364 switch (eventStates) {
9378 ret.setTimestamp(
event->timestamp());
9385 return extra.isAllocated() && !
extra->pointerHandlers.isEmpty();
9393 if (
auto *hh = qmlobject_cast<QQuickHoverHandler *>(
h); hh && hh->enabled())
9405 auto &handlers =
extra.value().pointerHandlers;
9406 if (!handlers.contains(
h))
9407 handlers.prepend(
h);
9408 auto &
res =
extra.value().resourcesList;
9409 if (!
res.contains(
h)) {
9421 auto &handlers =
extra.value().pointerHandlers;
9422 handlers.removeOne(
h);
9423 auto &
res =
extra.value().resourcesList;
9426 if (handlers.isEmpty())
9427 extra.value().acceptedMouseButtons =
extra.value().acceptedMouseButtonsWithoutHandlers;
9430#if QT_CONFIG(quick_shadereffect)
9437 , m_componentComplete(true)
9449QQuickItemLayer::~QQuickItemLayer()
9451 delete m_effectSource;
9469void QQuickItemLayer::setEnabled(
bool e)
9474 if (m_componentComplete) {
9481 emit enabledChanged(e);
9484void QQuickItemLayer::classBegin()
9488 m_componentComplete =
false;
9491void QQuickItemLayer::componentComplete()
9494 m_componentComplete =
true;
9499void QQuickItemLayer::activate()
9508 m_effectSource->stackAfter(m_item);
9511 m_effectSource->setSourceItem(m_item);
9512 m_effectSource->setHideSource(
true);
9513 m_effectSource->setSmooth(m_smooth);
9514 m_effectSource->setLive(m_live);
9515 m_effectSource->setTextureSize(m_size);
9516 m_effectSource->setSourceRect(m_sourceRect);
9517 m_effectSource->setMipmap(m_mipmap);
9518 m_effectSource->setWrapMode(m_wrapMode);
9519 m_effectSource->setFormat(m_format);
9520 m_effectSource->setTextureMirroring(m_textureMirroring);
9521 m_effectSource->setSamples(m_samples);
9523 if (m_effectComponent)
9526 m_effectSource->setVisible(m_item->isVisible() && !m_effect);
9537void QQuickItemLayer::deactivate()
9541 if (m_effectComponent)
9544 delete m_effectSource;
9545 m_effectSource =
nullptr;
9551void QQuickItemLayer::activateEffect()
9557 QObject *created = m_effectComponent->beginCreate(m_effectComponent->creationContext());
9560 qWarning(
"Item: layer.effect is not a QML Item.");
9561 m_effectComponent->completeCreate();
9568 m_effect->stackAfter(m_effectSource);
9570 m_effect->setVisible(m_item->isVisible());
9571 m_effect->setProperty(m_name, QVariant::fromValue<QObject *>(m_effectSource));
9573 m_effectComponent->completeCreate();
9576void QQuickItemLayer::deactivateEffect()
9602 bool updateNeeded =
false;
9603 if (m_effectSource && m_effectComponent) {
9605 updateNeeded =
true;
9610 if (m_effectSource && m_effectComponent) {
9612 updateNeeded =
true;
9620 m_effectSource->setVisible(m_item->isVisible() && !m_effect);
9638void QQuickItemLayer::setMipmap(
bool mipmap)
9640 if (mipmap == m_mipmap)
9645 m_effectSource->setMipmap(m_mipmap);
9647 emit mipmapChanged(mipmap);
9675 m_effectSource->setFormat(m_format);
9677 emit formatChanged(m_format);
9692void QQuickItemLayer::setSourceRect(
const QRectF &sourceRect)
9694 if (sourceRect == m_sourceRect)
9696 m_sourceRect = sourceRect;
9699 m_effectSource->setSourceRect(m_sourceRect);
9701 emit sourceRectChanged(sourceRect);
9716void QQuickItemLayer::setSmooth(
bool s)
9723 m_effectSource->setSmooth(m_smooth);
9725 emit smoothChanged(
s);
9740void QQuickItemLayer::setLive(
bool live)
9747 m_effectSource->setLive(m_live);
9749 emit liveChanged(live);
9765void QQuickItemLayer::setSize(
const QSize &
size)
9772 m_effectSource->setTextureSize(
size);
9797 if (
mode == m_wrapMode)
9802 m_effectSource->setWrapMode(m_wrapMode);
9824 if (mirroring == m_textureMirroring)
9826 m_textureMirroring = mirroring;
9829 m_effectSource->setTextureMirroring(m_textureMirroring);
9831 emit textureMirroringChanged(mirroring);
9859void QQuickItemLayer::setSamples(
int count)
9861 if (m_samples ==
count)
9867 m_effectSource->setSamples(m_samples);
9887 m_effect->setProperty(m_name,
QVariant());
9888 m_effect->setProperty(
name, QVariant::fromValue<QObject *>(m_effectSource));
9909 Q_ASSERT(parent != m_effectSource);
9910 Q_ASSERT(parent ==
nullptr || parent != m_effect);
9912 m_effectSource->setParentItem(parent);
9914 m_effectSource->stackAfter(m_item);
9917 m_effect->setParentItem(parent);
9919 m_effect->stackAfter(m_effectSource);
9923void QQuickItemLayer::itemSiblingOrderChanged(
QQuickItem *)
9925 m_effectSource->stackAfter(m_item);
9927 m_effect->stackAfter(m_effectSource);
9930void QQuickItemLayer::itemVisibilityChanged(
QQuickItem *)
9938void QQuickItemLayer::updateZ()
9940 if (!m_componentComplete || !m_enabled)
9945 l->
setZ(m_item->z());
9948void QQuickItemLayer::updateOpacity()
9956void QQuickItemLayer::updateGeometry()
9963 QRectF bounds = m_item->QQuickItem::boundingRect();
9968void QQuickItemLayer::updateMatrix()
9972 if (!m_componentComplete || !m_enabled)
9988:
z(0),
scale(1), rotation(0), opacity(1),
9995 effectRefCount(0), hideRefCount(0),
9996 recursiveEffectRefCount(0),
9999 transparentForPositioner(
false)
10004#if QT_CONFIG(accessibility)
10005QAccessible::Role QQuickItemPrivate::effectiveAccessibleRole()
const
10008 auto *attached = qmlAttachedPropertiesObject<QQuickAccessibleAttached>(
q,
false);
10009 auto role = QAccessible::NoRole;
10010 if (
auto *accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(attached))
10011 role = accessibleAttached->role();
10012 if (role == QAccessible::NoRole)
10013 role = accessibleRole();
10017QAccessible::Role QQuickItemPrivate::accessibleRole()
const
10019 return QAccessible::NoRole;
10046 QObjectWrapper::markObjects(that, markStack);
10057 debug.nospace() <<
"ChangeListener listener=" << listener.
listener <<
" types=" << listener.
types;
10067{
return mapRectFromItem(
item,
rect); }
10079{
return mapRectToItem(
item,
rect); }
10091{
return mapFromGlobal(
QPointF(
x,
y)); }
10098#include <moc_qquickitem.cpp>
10100#include "moc_qquickitem_p.cpp"
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
The QCursor class provides a mouse cursor with an arbitrary shape.
Qt::CursorShape shape() const
Returns the cursor shape identifier.
The QEventPoint class provides information about a point in a QPointerEvent.
virtual void setAccepted(bool accepted)
Type
This enum type defines the valid event types in Qt.
@ ApplicationPaletteChange
Type type() const
Returns the event type.
void accept()
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
The QFocusEvent class contains event parameters for widget focus events.
QList< QGraphicsItem * > childItems() const
QGraphicsWidget * window() const
bool hasFocus() const
Returns true if this item is active, and it or its \l{focusProxy()}{focus proxy} has keyboard input f...
void setParentItem(QGraphicsItem *parent)
Sets this item's parent item to newParent.
QPointF mapToScene(const QPointF &point) const
Maps the point point, which is in this item's coordinate system, to the scene's coordinate system,...
QGraphicsItem * parentItem() const
Returns a pointer to this item's parent item.
GraphicsItemFlags flags() const
Returns this item's flags.
QPointF mapFromScene(const QPointF &point) const
Maps the point point, which is in this item's scene's coordinate system, to this item's coordinate sy...
static struct QGuiApplicationPrivate::QLastCursorPosition lastCursorPosition
static QStyleHints * styleHints()
Returns the application's style hints.
static QInputMethod * inputMethod()
returns the input method.
The QKeyEvent class describes a key event.
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifier flags that existed immediately after the event occurred.
int key() const
Returns the code of the key that was pressed or released.
void setHorizontalPolicy(Policy d)
void setVerticalPolicy(Policy d)
qsizetype size() const noexcept
bool isEmpty() const noexcept
bool removeOne(const AT &t)
qsizetype length() const noexcept
const_reference at(qsizetype i) const noexcept
const T & constFirst() const noexcept
void append(parameter_type t)
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
void translate(const QVector3D &vector)
Multiplies this matrix by another that translates coordinates by the components of vector.
static Q_GUI_EXPORT void detach(QEventPoint &p)
static QObjectPrivate * get(QObject *o)
const QObjectList & children() const
Returns a list of child objects.
QObject * parent() const
Returns a pointer to the parent object.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
virtual bool event(QEvent *event)
This virtual function receives events to an object and should return true if the event e was recogniz...
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
QVariant property(const char *name) const
Returns the value of the object's name property.
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...
void destroyed(QObject *=nullptr)
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointe...
\inmodule QtCore\reentrant
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
\inmodule QtCore\reentrant
A base class for pointer events.
The QQmlComponent class encapsulates a QML component definition.
The QQmlContext class defines a context within a QML engine.
RemoveLastFunction removeLast
void clearItem(QQuickItem *)
static QQuickAnchorsPrivate * get(QQuickAnchors *o)
void updateVerticalAnchors()
~QQuickContents() override
QQuickContents(QQuickItem *item)
void calcGeometry(QQuickItem *changed=nullptr)
void itemChildRemoved(QQuickItem *, QQuickItem *) override
void itemChildAdded(QQuickItem *, QQuickItem *) override
void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &) override
void itemDestroyed(QQuickItem *item) override
@ DontChangeFocusProperty
static bool isMouseOrWheelEvent(const QPointerEvent *ev)
static void notifyFocusChangesRecur(QQuickItem **item, int remaining, Qt::FocusReason reason)
static QQuickDeliveryAgent * currentOrItemDeliveryAgent(const QQuickItem *item)
QQuickEnterKeyAttached(QObject *parent=nullptr)
\qmltype EnterKey \instantiates QQuickEnterKeyAttached \inqmlmodule QtQuick
void setType(Qt::EnterKeyType type)
static QQuickEnterKeyAttached * qmlAttachedProperties(QObject *)
void setXChange(bool enabled)
bool horizontalChange() const
bool matches(QQuickGeometryChange other) const
bool heightChange() const
void setWidthChange(bool enabled)
void setHeightChange(bool enabled)
void setYChange(bool enabled)
bool verticalChange() const
virtual void itemParentChanged(QQuickItem *, QQuickItem *)
virtual void itemSiblingOrderChanged(QQuickItem *)
virtual void itemChildAdded(QQuickItem *, QQuickItem *)
virtual ~QQuickItemChangeListener()
virtual void itemRotationChanged(QQuickItem *)
virtual void itemEnabledChanged(QQuickItem *)
virtual void itemOpacityChanged(QQuickItem *)
virtual void itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &)
virtual void itemImplicitWidthChanged(QQuickItem *)
virtual void itemChildRemoved(QQuickItem *, QQuickItem *)
virtual QQuickAnchorsPrivate * anchorPrivate()
virtual void itemDestroyed(QQuickItem *)
virtual void itemVisibilityChanged(QQuickItem *)
virtual void itemImplicitHeightChanged(QQuickItem *)
virtual void itemFocusChanged(QQuickItem *, Qt::FocusReason)
virtual void keyReleased(QKeyEvent *event, bool post)
virtual void componentComplete()
QQuickItemKeyFilter(QQuickItem *=nullptr)
virtual void shortcutOverrideEvent(QKeyEvent *event)
virtual void keyPressed(QKeyEvent *event, bool post)
virtual ~QQuickItemKeyFilter()
bool calcEffectiveVisible() const
QQuickItem ** prevDirtyItem
void updateOrRemoveGeometryChangeListener(QQuickItemChangeListener *listener, QQuickGeometryChange types)
void updateOrAddGeometryChangeListener(QQuickItemChangeListener *listener, QQuickGeometryChange types)
QQuickAnchorLine verticalCenter() const
QTransform windowToItemTransform() const
Returns a transform that maps points from window space into item space.
static void data_clear(QQmlListProperty< QObject > *)
QQmlListProperty< QQuickTransition > transitions()
QLazilyAllocated< ExtraData, ExtraDataTags > extra
static void children_removeLast(QQmlListProperty< QQuickItem > *)
void notifyChangeListeners(QQuickItemPrivate::ChangeTypes changeTypes, Fn &&function, Args &&...args)
QList< QQuickItem * > paintOrderChildItems() const
static QQuickItem * visibleChildren_at(QQmlListProperty< QQuickItem > *prop, qsizetype index)
quint32 subtreeCursorEnabled
void init(QQuickItem *parent)
QQuickDeliveryAgent * deliveryAgent()
virtual bool handlePointerEvent(QPointerEvent *, bool avoidGrabbers=false)
quint32 maybeHasSubsceneDeliveryAgent
virtual bool transformChanged(QQuickItem *transformedItem)
static QQuickItem * prevTabChildItem(const QQuickItem *item, int start)
quint32 effectiveLayoutMirror
void deliverPointerEvent(QEvent *)
~QQuickItemPrivate() override
QQuickAnchors * anchors() const
\qmlpropertygroup QtQuick::Item::anchors \qmlproperty AnchorLine QtQuick::Item::anchors....
bool setFocusIfNeeded(QEvent::Type)
QSGTransformNode * itemNodeInstance
bool hasPointerHandlers() const
static qsizetype children_count(QQmlListProperty< QQuickItem > *)
void setLayoutMirror(bool mirror)
quint32 subtreeHoverEnabled
QPointer< QQuickItem > subFocusItem
QString dirtyToString() const
void removeItemChangeListener(QQuickItemChangeListener *, ChangeTypes types)
quint64 _q_createJSWrapper(QQmlV4ExecutionEnginePtr engine)
void removeChild(QQuickItem *)
static void children_clear(QQmlListProperty< QQuickItem > *)
static qsizetype transform_count(QQmlListProperty< QQuickTransform > *list)
QQmlListProperty< QObject > resources()
static qsizetype data_count(QQmlListProperty< QObject > *)
\qmlproperty list<QtObject> QtQuick::Item::data \qmldefault
@ ChildrenStackingChanged
Qt::FocusReason lastFocusChangeReason() const
void derefFromEffectItem(bool unhide)
static QQuickItem * children_at(QQmlListProperty< QQuickItem > *, qsizetype)
static qsizetype resources_count(QQmlListProperty< QObject > *)
QTransform itemToWindowTransform() const
Returns a transform that maps points from item space into window space.
static QQuickItem * nextPrevItemInTabFocusChain(QQuickItem *item, bool forward, bool wrap=true)
quint32 inheritMirrorFromItem
void itemChange(QQuickItem::ItemChange, const QQuickItem::ItemChangeData &)
void itemToParentTransform(QTransform *) const
Modifies t with this item's local transform relative to its parent.
virtual void implicitHeightChanged()
void setSizePolicy(const QLayoutPolicy::Policy &horizontalPolicy, const QLayoutPolicy::Policy &verticalPolicy)
static void data_removeLast(QQmlListProperty< QObject > *)
QList< QQuickItem * > * sortedChildItems
QQmlListProperty< QQuickItem > visibleChildren()
void siblingOrderChanged()
static QObject * resources_at(QQmlListProperty< QObject > *, qsizetype)
virtual void mirrorChange()
QQmlListProperty< QQuickState > states()
void updateOrAddItemChangeListener(QQuickItemChangeListener *listener, ChangeTypes types)
QQuickStateGroup * _stateGroup
QVector< QQuickItemPrivate::ChangeListener > changeListeners
@ LeftMouseButtonAccepted
void addChild(QQuickItem *)
bool calcEffectiveEnable() const
static QQuickTransform * transform_at(QQmlListProperty< QQuickTransform > *list, qsizetype)
void deliverKeyEvent(QKeyEvent *)
static void resources_removeLast(QQmlListProperty< QObject > *)
QQuickAnchorLine right() const
QQuickItem * nextDirtyItem
static QObject * data_at(QQmlListProperty< QObject > *, qsizetype)
void setTransparentForPositioner(bool trans)
bool filterKeyEvent(QKeyEvent *, bool post)
void setImplicitAntialiasing(bool antialiasing)
static QQuickItem * nextTabChildItem(const QQuickItem *item, int start)
QQuickAnchorLine bottom() const
static void children_append(QQmlListProperty< QQuickItem > *, QQuickItem *)
static qsizetype visibleChildren_count(QQmlListProperty< QQuickItem > *prop)
void localizedTouchEvent(const QTouchEvent *event, bool isFiltering, QMutableTouchEvent *localized)
virtual void dumpItemTree(int indent) const
virtual void removePointerHandler(QQuickPointerHandler *h)
quint32 inheritMirrorFromParent
QLayoutPolicy sizePolicy() const
void recursiveRefFromEffectItem(int refs)
quint32 subtreeTransformChangedEnabled
static bool focusNextPrev(QQuickItem *item, bool forward)
QQuickItemPrivate::focusNextPrev focuses the next/prev item in the tab-focus-chain.
void removeFromDirtyList()
void setEffectiveEnableRecur(QQuickItem *scope, bool)
QTransform windowToGlobalTransform() const
Returns a transform that maps points from window space into global space.
void addItemChangeListener(QQuickItemChangeListener *listener, ChangeTypes types)
QList< QQuickTransform * > transforms
virtual qreal getImplicitWidth() const
static void resources_append(QQmlListProperty< QObject > *, QObject *)
static bool canAcceptTabFocus(QQuickItem *item)
void deliverShortcutOverrideEvent(QKeyEvent *)
void setHasCursorInChild(bool hasCursor)
QQuickItem::TransformOrigin origin() const
bool setEffectiveVisibleRecur(bool)
void refWindow(QQuickWindow *)
void setLastFocusChangeReason(Qt::FocusReason reason)
QQuickAnchorLine left() const
virtual void setVisible(bool visible)
QQuickAnchorLine top() const
quint32 componentComplete
void markSortedChildrenDirty(QQuickItem *child)
QQuickDeliveryAgentPrivate * deliveryAgentPrivate()
virtual void addPointerHandler(QQuickPointerHandler *h)
bool hasEnabledHoverHandlers() const
quint32 inheritedLayoutMirror
QQmlListProperty< QQuickItem > children()
void refFromEffectItem(bool hide)
QQuickDeliveryAgent * ensureSubsceneDeliveryAgent()
void enableSubtreeChangeNotificationsForParentHierachy()
QQuickAnchorLine horizontalCenter() const
void setState(const QString &)
QTransform globalToWindowTransform() const
Returns a transform that maps points from global space into window space.
void updateSubFocusItem(QQuickItem *scope, bool focus)
Clears all sub focus items from scope.
QPointF computeTransformOrigin() const
quint32 implicitAntialiasing
void _q_resourceObjectDeleted(QObject *)
QQuickStateGroup * _states()
virtual qreal getImplicitHeight() const
bool anyPointerHandlerWants(const QPointerEvent *event, const QEventPoint &point) const
QQmlListProperty< QObject > data()
static void data_append(QQmlListProperty< QObject > *, QObject *)
static void transform_clear(QQmlListProperty< QQuickTransform > *list)
virtual QSGTransformNode * createTransformNode()
static QQuickItemPrivate * get(QQuickItem *item)
void setHasHoverInChild(bool hasHover)
bool isTransparentForPositioner() const
static void transform_append(QQmlListProperty< QQuickTransform > *list, QQuickTransform *)
QPointF adjustedPosForTransform(const QPointF ¢roid, const QPointF &startPos, const QVector2D &activeTranslatation, qreal startScale, qreal activeScale, qreal startRotation, qreal activeRotation)
static void resources_clear(QQmlListProperty< QObject > *)
virtual void implicitWidthChanged()
void resolveLayoutMirror()
QList< QQuickItem * > childItems
void setImplicitLayoutMirror(bool mirror, bool inherit)
QQuickAnchorLine baseline() const
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
QPointF mapToScene(const QPointF &point) const
Maps the given point in this item's coordinate system to the equivalent point within the scene's coor...
QBindable< qreal > bindableWidth()
bool event(QEvent *) override
\reimp
void parentChanged(QQuickItem *)
virtual void focusOutEvent(QFocusEvent *)
This event handler can be reimplemented in a subclass to receive focus-out events for an item.
void setFiltersChildMouseEvents(bool filter)
Sets whether pointer events intended for this item's children should be filtered through this item.
virtual void mouseReleaseEvent(QMouseEvent *event)
This event handler can be reimplemented in a subclass to receive mouse release events for an item.
void baselineOffsetChanged(qreal)
virtual QSGNode * updatePaintNode(QSGNode *, UpdatePaintNodeData *)
Called on the render thread when it is time to sync the state of the item with the scene graph.
virtual void hoverEnterEvent(QHoverEvent *event)
This event handler can be reimplemented in a subclass to receive hover-enter events for an item.
Flags flags() const
Returns the item flags for this item.
void setKeepTouchGrab(bool)
Sets whether the touch points grabbed by this item should remain exclusively with this item.
void classBegin() override
\reimp Derived classes should call the base class method before adding their own action to perform at...
void setTransformOriginPoint(const QPointF &)
QRectF mapRectToItem(const QQuickItem *item, const QRectF &rect) const
Maps the given rect in this item's coordinate system to the equivalent rectangular area within item's...
QList< QQuickItem * > childItems() const
Returns the children of this item.
Q_INVOKABLE QPointF mapFromItem(const QQuickItem *item, const QPointF &point) const
Maps the given point in item's coordinate system to the equivalent point within this item's coordinat...
void setAntialiasing(bool)
void setSize(const QSizeF &size)
bool acceptTouchEvents() const
Returns whether touch events are accepted by this item.
TransformOrigin
\variable QQuickItem::ItemChangeData::realValue The numeric value that has changed: \l {QQuickItem::o...
QQuickItem * viewportItem() const
If the \l ItemObservesViewport flag is set, returns the nearest parent with the \l ItemIsViewport fla...
virtual void mouseDoubleClickEvent(QMouseEvent *event)
This event handler can be reimplemented in a subclass to receive mouse double-click events for an ite...
Qt::MouseButtons acceptedMouseButtons() const
Returns the mouse buttons accepted by this item.
void setFlag(Flag flag, bool enabled=true)
Enables the specified flag for this item if enabled is true; if enabled is false, the flag is disable...
void antialiasingChanged(bool)
virtual void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry)
bool isFocusScope() const
Returns true if this item is a focus scope, and false otherwise.
virtual void mouseUngrabEvent()
This event handler can be reimplemented in a subclass to be notified when a mouse ungrab event has oc...
virtual void keyPressEvent(QKeyEvent *event)
This event handler can be reimplemented in a subclass to receive key press events for an item.
Q_INVOKABLE QPointF mapToItem(const QQuickItem *item, const QPointF &point) const
Maps the given point in this item's coordinate system to the equivalent point within item's coordinat...
qreal x
\qmlproperty real QtQuick::Item::x \qmlproperty real QtQuick::Item::y \qmlproperty real QtQuick::Item...
void setParentItem(QQuickItem *parent)
qreal z
\qmlproperty real QtQuick::Item::z
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...
QBindable< qreal > bindableY()
QPointF mapFromScene(const QPointF &point) const
Maps the given point in the scene's coordinate system to the equivalent point within this item's coor...
QString state() const
\qmlproperty string QtQuick::Item::state
virtual void hoverMoveEvent(QHoverEvent *event)
This event handler can be reimplemented in a subclass to receive hover-move events for an item.
void setState(const QString &)
qreal y
Defines the item's y position relative to its parent.
bool activeFocusOnTab() const
\qmlproperty bool QtQuick::Item::activeFocusOnTab
bool hasActiveFocus() const
void setAcceptTouchEvents(bool accept)
If enabled is true, this sets the item to accept touch events; otherwise, touch events are not accept...
Qt::FocusPolicy focusPolicy
\qmlproperty enumeration QtQuick::Item::focusPolicy
qreal baselineOffset() const
\qmlproperty int QtQuick::Item::baselineOffset
Q_INVOKABLE QQuickItem * childAt(qreal x, qreal y) const
\qmlmethod QtQuick::Item::childAt(real x, real y)
TransformOrigin transformOrigin
\qmlproperty enumeration QtQuick::Item::transformOrigin This property holds the origin point around w...
virtual QSGTextureProvider * textureProvider() const
Returns the texture provider for an item.
QRectF childrenRect()
\qmlpropertygroup QtQuick::Item::childrenRect \qmlproperty real QtQuick::Item::childrenRect....
virtual Q_INVOKABLE bool contains(const QPointF &point) const
\qmlmethod bool QtQuick::Item::contains(point point)
QObject * containmentMask
\qmlproperty QObject* QtQuick::Item::containmentMask
virtual QRectF boundingRect() const
Returns the extents of the item in its own coordinate system: a rectangle from {0,...
void setAcceptedMouseButtons(Qt::MouseButtons buttons)
Sets the mouse buttons accepted by this item to buttons.
bool keepTouchGrab() const
Returns whether the touch points grabbed by this item should exclusively remain with this item.
void setFlags(Flags flags)
Enables the specified flags for this item.
QQuickWindow * window() const
Returns the window in which this item is rendered.
void setContainmentMask(QObject *mask)
virtual void mousePressEvent(QMouseEvent *event)
This event handler can be reimplemented in a subclass to receive mouse press events for an item.
~QQuickItem() override
Destroys the QQuickItem.
void setBaselineOffset(qreal)
bool acceptHoverEvents() const
Returns whether hover events are accepted by this item.
qreal width
This property holds the width of this item.
QQuickItem * scopedFocusItem() const
If this item is a focus scope, this returns the item in its focus chain that currently has focus.
QQuickItem * parentItem() const
bool filtersChildMouseEvents() const
Returns whether pointer events intended for this item's children should be filtered through this item...
QRectF mapRectFromItem(const QQuickItem *item, const QRectF &rect) const
Maps the given rect in item's coordinate system to the equivalent rectangular area within this item's...
void stackAfter(const QQuickItem *)
Moves the specified sibling item to the index after this item within the list of children.
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.
QQuickItem * parent
\qmlproperty Item QtQuick::Item::parent This property holds the visual parent of the item.
QTransform itemTransform(QQuickItem *, bool *) const
\qmlmethod point QtQuick::Item::mapFromItem(Item item, real x, real y) \qmlmethod point QtQuick::Item...
virtual void touchUngrabEvent()
This event handler can be reimplemented in a subclass to be notified when a touch ungrab event has oc...
void grabTouchPoints(const QList< int > &ids)
bool clip() const
\qmlproperty bool QtQuick::Item::clip This property holds whether clipping is enabled.
QBindable< qreal > bindableHeight()
void setImplicitHeight(qreal)
bool keepMouseGrab() const
Returns whether mouse input should exclusively remain with this item.
bool heightValid() const
Returns whether the height property has been set explicitly.
void setKeepMouseGrab(bool)
Sets whether the mouse input should remain exclusively with this item.
Q_INVOKABLE void forceActiveFocus()
\qmlmethod point QtQuick::Item::mapToItem(Item item, real x, real y) \qmlmethod point QtQuick::Item::...
bool antialiasing
\qmlproperty bool QtQuick::Item::antialiasing
bool smooth
\qmlproperty bool QtQuick::Item::smooth
qreal rotation
\qmlproperty real QtQuick::Item::rotation This property holds the rotation of the item in degrees clo...
bool widthValid() const
Returns whether the width property has been set explicitly.
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.
virtual bool childMouseEventFilter(QQuickItem *, QEvent *)
Reimplement this method to filter the pointer events that are received by this item's children.
virtual void updatePolish()
This function should perform any layout as required for this item.
void setPosition(const QPointF &)
virtual void releaseResources()
This function is called when an item should release graphics resources which are not already managed ...
virtual void keyReleaseEvent(QKeyEvent *event)
This event handler can be reimplemented in a subclass to receive key release events for an item.
QQuickItem(QQuickItem *parent=nullptr)
Constructs a QQuickItem with the given parent.
QRectF mapRectToScene(const QRectF &rect) const
Maps the given rect in this item's coordinate system to the equivalent rectangular area within the sc...
virtual QRectF clipRect() const
Returns the rectangular area within this item that is currently visible in \l viewportItem(),...
qreal scale
\qmlproperty real QtQuick::Item::scale This property holds the scale factor for this item.
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
@ ItemActiveFocusHasChanged
@ ItemAntialiasingHasChanged
@ ItemDevicePixelRatioHasChanged
virtual void focusInEvent(QFocusEvent *)
This event handler can be reimplemented in a subclass to receive focus-in events for an item.
void setTransformOrigin(TransformOrigin)
void visibleChildrenChanged()
qreal opacity
\qmlproperty real QtQuick::Item::opacity
void setFocusPolicy(Qt::FocusPolicy policy)
Sets the focus policy of this item to policy.
bool isUnderMouse() const
QRectF mapRectFromScene(const QRectF &rect) const
Maps the given rect in the scene's coordinate system to the equivalent rectangular area within this i...
Flag
\qmltype Item \instantiates QQuickItem \inherits QtObject \inqmlmodule QtQuick
@ ItemClipsChildrenToShape
bool enabled
\qmlproperty bool QtQuick::Item::enabled
bool isAncestorOf(const QQuickItem *child) const
Returns true if this item is an ancestor of child (i.e., if this item is child's parent,...
QBindable< qreal > bindableX()
void transformOriginChanged(TransformOrigin)
void setImplicitWidth(qreal)
virtual void hoverLeaveEvent(QHoverEvent *event)
This event handler can be reimplemented in a subclass to receive hover-leave events for an item.
void update()
Schedules a call to updatePaintNode() for this item.
void stackBefore(const QQuickItem *)
Moves the specified sibling item to the index before this item within the list of children.
QQmlListProperty< QQuickTransform > transform
\qmlproperty list<Transform> QtQuick::Item::transform This property holds the list of transformations...
void polish()
Schedules a polish event for this item.
virtual bool isTextureProvider() const
Returns true if this item is a texture provider.
virtual void mouseMoveEvent(QMouseEvent *event)
This event handler can be reimplemented in a subclass to receive mouse move events for an item.
void setActiveFocusOnTab(bool)
void setImplicitSize(qreal, qreal)
QPointF transformOriginPoint
void reset(QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, const QString &text=QString(), bool autorep=false, ushort count=1)
void setLeft(QQuickItem *)
static QQuickKeyNavigationAttached * qmlAttachedProperties(QObject *)
void setTab(QQuickItem *)
void setPriority(Priority)
QQuickKeyNavigationAttached(QObject *=nullptr)
\qmltype KeyNavigation \instantiates QQuickKeyNavigationAttached \inqmlmodule QtQuick
void setBacktab(QQuickItem *)
void keyReleased(QKeyEvent *event, bool post) override
void keyPressed(QKeyEvent *event, bool post) override
void setRight(QQuickItem *)
void setDown(QQuickItem *)
~QQuickKeysAttached() override
void keyPressed(QKeyEvent *event, bool post) override
static QQuickKeysAttached * qmlAttachedProperties(QObject *)
void keyReleased(QKeyEvent *event, bool post) override
QQuickKeysAttached(QObject *parent=nullptr)
\qmltype Keys \instantiates QQuickKeysAttached \inqmlmodule QtQuick
void released(QQuickKeyEvent *event)
void setPriority(Priority)
void pressed(QQuickKeyEvent *event)
void shortcutOverride(QQuickKeyEvent *event)
void shortcutOverrideEvent(QKeyEvent *event) override
void componentComplete() override
void setChildrenInherit(bool)
void childrenInheritChanged()
static QQuickLayoutMirroringAttached * qmlAttachedProperties(QObject *)
QQuickLayoutMirroringAttached(QObject *parent=nullptr)
\qmltype LayoutMirroring \instantiates QQuickLayoutMirroringAttached \inqmlmodule QtQuick
QInputDevice::DeviceTypes acceptedDevices
static QQuickPointerHandlerPrivate * get(QQuickPointerHandler *q)
static QVector< QObject * > & deviceDeliveryTargets(const QInputDevice *device)
QQuickItem * parentItem() const
\qmlproperty Item QtQuick::PointerHandler::parent
static QWindow * renderWindowFor(QQuickWindow *win, QPoint *offset=nullptr)
Returns the real window that win is being rendered to, if any.
QQmlListProperty< QQuickTransition > transitionsProperty()
\qmlproperty list<Transition> QtQuick::StateGroup::transitions This property holds a list of transiti...
void setState(const QString &)
QQmlListProperty< QQuickState > statesProperty()
\qmlproperty list<State> QtQuick::StateGroup::states This property holds a list of states defined by ...
void classBegin() override
Invoked after class creation, but before any properties have been set.
static QQuickWindowPrivate * get(QQuickWindow *c)
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
\inmodule QtCore\reentrant
constexpr qreal y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr qreal height() const noexcept
Returns the height of the rectangle.
constexpr qreal width() const noexcept
Returns the width of the rectangle.
constexpr qreal x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr void setY(qreal pos) noexcept
Sets the top edge of the rectangle to the given finite y coordinate.
constexpr void setWidth(qreal w) noexcept
Sets the width of the rectangle to the given finite width.
constexpr QPointF topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
constexpr QSizeF size() const noexcept
Returns the size of the rectangle.
constexpr void setHeight(qreal h) noexcept
Sets the height of the rectangle to the given finite height.
QRectF intersected(const QRectF &other) const noexcept
constexpr void setX(qreal pos) noexcept
Sets the left edge of the rectangle to the given finite x coordinate.
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
The QSGTextureProvider class encapsulates texture based entities in QML.
\macro QT_RESTRICTED_CAST_FROM_ASCII
The QTouchEvent class contains parameters that describe a touch event.
bool isValid() const
Returns true if the storage type of this variant is not QMetaType::UnknownType; otherwise returns fal...
bool toBool() const
Returns the variant as a bool if the variant has userType() Bool.
The QVector2D class represents a vector or vertex in 2D space.
The QVector3D class represents a vector or vertex in 3D space.
[Window class with invokable method]
Combined button and popup list for selecting options.
static void formatQRect(QDebug &debug, const Rect &rect)
@ ImInputItemClipRectangle
#define QByteArrayLiteral(str)
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qFuzzyIsNull(qfloat16 f) noexcept
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
#define Q_DECLARE_LOGGING_CATEGORY(name)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
static Q_DECL_CONST_FUNCTION bool qt_is_nan(double d)
#define Q_RETURN_ARG(Type, data)
#define Q_ARG(Type, data)
GLsizei const GLfloat * v
[13]
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat z
GLint GLint GLint GLint GLint x
[0]
GLint GLenum GLsizei GLsizei GLsizei depth
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei const GLuint * ids
GLsizei GLenum GLenum * types
GLdouble GLdouble GLdouble GLdouble top
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
GLenum GLuint GLintptr offset
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLfloat GLfloat GLfloat GLfloat h
GLuint GLenum GLenum transform
GLdouble GLdouble GLdouble GLdouble q
GLfixed GLfixed GLint GLint order
GLenum GLenum GLenum GLenum GLenum scale
static qreal component(const QPointF &point, unsigned int i)
QQmlContext * qmlContext(const QObject *obj)
#define qmlobject_disconnect(Sender, SenderType, Signal, Receiver, ReceiverType, Method)
Disconnect Signal of Sender from Method of Receiver.
#define qmlobject_connect(Sender, SenderType, Signal, Receiver, ReceiverType, Method)
Connect Signal of Sender to Method of Receiver.
T qmlobject_cast(QObject *object)
This method is identical to qobject_cast<T>() except that it does not require lazy QMetaObjects to be...
QQuickItem * qmlobject_cast< QQuickItem * >(QObject *object)
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
#define PRINT_LISTENERS()
QDebug operator<<(QDebug debug, const QQuickItem *item)
static bool itemZOrder_sort(QQuickItem *lhs, QQuickItem *rhs)
#define DIRTY_TO_STRING(value)
void debugFocusTree(QQuickItem *item, QQuickItem *scope=nullptr, int depth=1)
static void setActiveFocus(QQuickItem *item, Qt::FocusReason reason)
static QT_BEGIN_NAMESPACE const quint64 kCursorOverrideTimeout
QQuickItem * qobject_cast< QQuickItem * >(QObject *o)
static QT_BEGIN_NAMESPACE QAsn1Element wrap(quint8 type, const QAsn1Element &child)
#define QStringLiteral(str)
#define QT_CONFIG(feature)
#define QT_VERSION_CHECK(major, minor, patch)
unsigned long long quint64
#define DEFINE_OBJECT_VTABLE(classname)
#define V4_OBJECT2(DataClass, superClass)
Q_GUI_EXPORT QWindowPrivate * qt_window_private(QWindow *window)
bool testFlag(MaskType mask, FlagType flag)
if(qFloatDistance(a, b)<(1<< 7))
[0]
obj metaObject() -> className()
rect sceneTransform().map(QPointF(0
view viewport() -> scroll(dx, dy, deviceRect)
manager post(request, myJson, this, [this](QRestReply &reply) { if(!reply.isSuccess()) { } if(std::optional json=reply.readJson()) { } })
\inmodule QtCore \reentrant
qsizetype indexOf(const AT &t, qsizetype from=0) const noexcept
bool contains(const AT &t) const noexcept
QQuickItemChangeListener * listener
QQuickGeometryChange gTypes
QV4::ReturnedValue fromVariant(const QVariant &)
ReturnedValue throwTypeError()
static void markObjects(QV4::Heap::Base *that, QV4::MarkStack *markStack)
static void markWrapper(QObject *object, MarkStack *markStack)