6#include <QtCore/qpointer.h>
7#include <QtQuick/qquickwindow.h>
8#include <QtQuick/private/qquickitem_p.h>
9#include <QtQuick/private/qquickitemchangelistener_p.h>
10#include <QtQuickTemplates2/private/qquickpopup_p.h>
11#include <QtQuickTemplates2/private/qquickpopupitem_p_p.h>
79 qCDebug(lcAttached).noquote() <<
"findAttachedParent called with" << ourAttachedType->className() << objectWeAreAttachedTo;
99 auto popupItem = qobject_cast<QQuickPopupItem *>(objectWeAreAttachedTo);
101 qCDebug(lcAttached).noquote() <<
"- attachee belongs to popup item" << popupItem <<
"- checking if it has an attached object";
105 qCDebug(lcAttached).noquote() <<
"- popup item has attached object" << popupAttached <<
"- returning";
106 return popupAttached;
108 qCDebug(lcAttached).noquote() <<
"- popup item does not have attached object";
111 qCDebug(lcAttached).noquote() <<
"- attachee does not belong to a popup";
116 qCDebug(lcAttached).noquote() <<
"- attachee is an item; checking its parent items and popups";
120 qCDebug(lcAttached).noquote() <<
" - checking parent item" << parent;
123 qCDebug(lcAttached).noquote() <<
" - parent item has attached object" << attached <<
"- returning";
129 qCDebug(lcAttached).noquote() <<
" - parent popup has attached object" << attached <<
"- returning";
140 qCDebug(lcAttached).noquote() <<
"- parent window has attached object" << attached <<
"- returning";
145 QQuickPopup *popup = qobject_cast<QQuickPopup *>(objectWeAreAttachedTo);
147 qCDebug(lcAttached).noquote() <<
"- attachee is a popup; checking its window";
157 qCDebug(lcAttached).noquote() <<
"- attachee is a window; checking its parent window" << parentWindow;
161 qCDebug(lcAttached).noquote() <<
"- parent window has attached object" << attached <<
"- returning";
168 if (objectWeAreAttachedTo) {
170 qCDebug(lcAttached).noquote() <<
"- falling back to engine" <<
engine;
187 QList<QQuickAttachedPropertyPropagator *> children;
208 children += attached;
217 const auto &windowChildren =
item->children();
223 children += attached;
234 QQuickPopup *popup = qobject_cast<QQuickPopup *>(parent);
236 item = popup->popupItem();
268 }
else if (
auto *
window = qobject_cast<QQuickWindow *>(
object)) {
279 }
else if (
auto *
window = qobject_cast<QQuickWindow *>(
object)) {
310 qCDebug(lcAttached).noquote() <<
"setAttachedParent called on" <<
q <<
"with parent" <<
parent;
317 qCDebug(lcAttached).noquote() <<
"- adding ourselves as an attached child of" <<
parent;
320 q->attachedParentChange(
parent, oldParent);
343 qCDebug(lcAttached).noquote() <<
"window of" <<
q <<
"changed to" <<
window;
355 qCDebug(lcAttached).noquote() <<
"transient parent window of" <<
q <<
"changed to" << newTransientParent;
392 d->setAttachedParent(
nullptr);
408 return d->attachedChildren;
423 return d->attachedParent;
445 qCDebug(lcAttached) <<
"initialize called for" <<
parent() <<
"- looking for attached parent...";
457 qCDebug(lcAttached) <<
"... finished initializing";
478#ifndef QT_NO_DEBUG_STREAM
482 debug.nospace().noquote();
484 debug <<
"QQuickAttachedPropertyPropagator(nullptr)";
489 debug << static_cast<const QObject *>(propagator) <<
" (which is attached to " << propagator->parent() <<
')';
496#include "moc_qquickattachedpropertypropagator.cpp"
QList< QGraphicsItem * > childItems() const
QGraphicsWidget * window() const
QGraphicsItem * parentItem() const
Returns a pointer to this item's parent item.
qsizetype size() const noexcept
static QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
static bool disconnect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot)
QObject * parent() const
Returns a pointer to the parent object.
QVariant property(const char *name) const
Returns the value of the object's name property.
bool setProperty(const char *name, const QVariant &value)
Sets the value of the object's name property to value.
static QQmlPropertyCache::ConstPtr ensurePropertyCache(QObject *object)
The QQmlEngine class provides an environment for instantiating QML components.
QList< QQuickAttachedPropertyPropagator * > attachedChildren
QPointer< QQuickAttachedPropertyPropagator > attachedParent
void transientParentWindowChanged(QWindow *newTransientParent)
void detachFrom(QObject *object)
static QQuickAttachedPropertyPropagatorPrivate * get(QQuickAttachedPropertyPropagator *attachedObject)
void itemParentChanged(QQuickItem *item, QQuickItem *parent) override
void itemWindowChanged(QQuickWindow *window)
void attachTo(QObject *object)
void setAttachedParent(QQuickAttachedPropertyPropagator *parent)
The QQuickAttachedPropertyPropagator class provides a way to propagate attached properties.
QQuickAttachedPropertyPropagator * attachedParent() const
This function returns the attached parent of this attached object.
~QQuickAttachedPropertyPropagator()
Destroys the QQuickAttachedPropertyPropagator.
QQuickAttachedPropertyPropagator(QObject *parent=nullptr)
Constructs a QQuickAttachedPropertyPropagator with the given parent.
QList< QQuickAttachedPropertyPropagator * > attachedChildren() const
This function returns the attached children of this attached object.
void initialize()
Finds and sets the attached parent for this attached object, and then does the same for its children.
virtual void attachedParentChange(QQuickAttachedPropertyPropagator *newParent, QQuickAttachedPropertyPropagator *oldParent)
This function is called whenever the attached parent of this QQuickAttachedPropertyPropagator changes...
static QQuickItemPrivate * get(QQuickItem *item)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
QQuickWindow * window() const
Returns the window in which this item is rendered.
QQuickItem * parentItem() const
QQuickItem * parent
\qmlproperty Item QtQuick::Item::parent This property holds the visual parent of the item.
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
Combined button and popup list for selecting options.
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
GLdouble GLdouble GLdouble GLdouble q
QQmlAttachedPropertiesFunc qmlAttachedPropertiesFunction(QObject *object, const QMetaObject *attachedMetaObject)
QQmlEngine * qmlEngine(const QObject *obj)
QObject * qmlAttachedPropertiesObject(QObject *object, QQmlAttachedPropertiesFunc func, bool create)
static QList< QQuickAttachedPropertyPropagator * > findAttachedChildren(const QMetaObject *type, QObject *object)
static QQuickAttachedPropertyPropagator * attachedObject(const QMetaObject *type, QObject *object, bool create=false)
static QQuickItem * findAttachedItem(QObject *parent)
static QQuickAttachedPropertyPropagator * findAttachedParent(const QMetaObject *ourAttachedType, QObject *objectWeAreAttachedTo)
QDebug operator<<(QDebug debug, const QQuickAttachedPropertyPropagator *propagator)
const QMetaObject * firstCppMetaObject(QQuickAttachedPropertyPropagator *propagator)
QQuickItem * qobject_cast< QQuickItem * >(QObject *o)
obj metaObject() -> className()
myObject disconnect()
[26]