diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2019-12-20 12:41:04 +0100 |
---|---|---|
committer | Mike Krus <mike.krus@kdab.com> | 2020-02-11 06:08:41 +0000 |
commit | b828609440a4771838c242b3ad9962ecd7a2fe99 (patch) | |
tree | 5da6bce0cda327c4cca96696bce512ec243cc1fd /src/core/nodes | |
parent | b0eb152b82cdd9658154ff7d9ef9e764eccc1ebd (diff) |
Remove deprecated classes and functions
Mostly old messaging API
Change-Id: I17eb2206b2ede56d2f7d36375d5e711d6149019f
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/core/nodes')
-rw-r--r-- | src/core/nodes/nodes.pri | 4 | ||||
-rw-r--r-- | src/core/nodes/qbackendnode.cpp | 94 | ||||
-rw-r--r-- | src/core/nodes/qbackendnode.h | 12 | ||||
-rw-r--r-- | src/core/nodes/qbackendnode_p.h | 10 | ||||
-rw-r--r-- | src/core/nodes/qentity.cpp | 43 | ||||
-rw-r--r-- | src/core/nodes/qentity.h | 2 | ||||
-rw-r--r-- | src/core/nodes/qentity_p.h | 2 | ||||
-rw-r--r-- | src/core/nodes/qnode.cpp | 169 | ||||
-rw-r--r-- | src/core/nodes/qnode.h | 12 | ||||
-rw-r--r-- | src/core/nodes/qnode_p.h | 12 | ||||
-rw-r--r-- | src/core/nodes/qnodecreatedchangegenerator.cpp | 53 | ||||
-rw-r--r-- | src/core/nodes/qnodecreatedchangegenerator_p.h | 97 |
12 files changed, 24 insertions, 486 deletions
diff --git a/src/core/nodes/nodes.pri b/src/core/nodes/nodes.pri index 785ae2b21..097f1cbc7 100644 --- a/src/core/nodes/nodes.pri +++ b/src/core/nodes/nodes.pri @@ -13,7 +13,6 @@ HEADERS += \ $$PWD/qnodevisitor_p.h \ $$PWD/propertychangehandler_p.h \ $$PWD/qdestructionidandtypecollector_p.h \ - $$PWD/qnodecreatedchangegenerator_p.h \ $$PWD/qabstractnodefactory_p.h SOURCES += \ @@ -25,5 +24,4 @@ SOURCES += \ $$PWD/qnodevisitor.cpp \ $$PWD/qabstractnodefactory.cpp \ $$PWD/propertychangehandler.cpp \ - $$PWD/qdestructionidandtypecollector.cpp \ - $$PWD/qnodecreatedchangegenerator.cpp + $$PWD/qdestructionidandtypecollector.cpp diff --git a/src/core/nodes/qbackendnode.cpp b/src/core/nodes/qbackendnode.cpp index 4138ea060..433c305cc 100644 --- a/src/core/nodes/qbackendnode.cpp +++ b/src/core/nodes/qbackendnode.cpp @@ -42,8 +42,6 @@ #include <Qt3DCore/qaspectengine.h> #include <Qt3DCore/qnode.h> -#include <Qt3DCore/qnodecommand.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <Qt3DCore/private/corelogging_p.h> @@ -59,32 +57,10 @@ QBackendNodeMapper::~QBackendNodeMapper() QBackendNodePrivate::QBackendNodePrivate(QBackendNode::Mode mode) : q_ptr(nullptr) , m_mode(mode) - , m_arbiter(nullptr) , m_enabled(false) { } -// Called by backend thread (renderer or other) while we are locked to sync changes -void QBackendNodePrivate::setArbiter(QLockableObserverInterface *arbiter) -{ - Q_ASSERT(m_mode == QBackendNode::ReadWrite); - m_arbiter = arbiter; -} - -// Called by backend thread/worker threads. We don't need locking -// as setting/unsetting the arbiter cannot happen at that time -void QBackendNodePrivate::notifyObservers(const QSceneChangePtr &e) -{ - Q_ASSERT(m_mode == QBackendNode::ReadWrite); - if (m_arbiter != nullptr) - m_arbiter->sceneChangeEvent(e); -} - -void QBackendNodePrivate::sceneChangeEvent(const QSceneChangePtr &e) -{ - q_func()->sceneChangeEvent(e); -} - void QBackendNodePrivate::setEnabled(bool enabled) { m_enabled = enabled; @@ -124,7 +100,7 @@ void QBackendNodePrivate::componentRemoved(QNode *frontend) */ /*! - * \fn Qt3DCore::QBackendNode *Qt3DCore::QBackendNodeMapper::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const + * \fn Qt3DCore::QBackendNode *Qt3DCore::QBackendNodeMapper::create(Qt3DCore::QNodeId id) const * * \TODO * @@ -219,55 +195,6 @@ QBackendNode::QBackendNode(QBackendNodePrivate &dd) } /*! - * Notifies observers of scene change \a e. - * \obsolete - */ -void QBackendNode::notifyObservers(const QSceneChangePtr &e) -{ - Q_D(QBackendNode); - d->notifyObservers(e); -} - -/*! - \obsolete - - Send the command named \a name with contents \a data, - and specify \a replyTo as the command id to which the - reply needs to be sent. -*/ -QNodeCommand::CommandId QBackendNode::sendCommand(const QString &name, - const QVariant &data, - QNodeCommand::CommandId replyTo) -{ - auto e = QNodeCommandPtr::create(peerId()); - e->setName(name); - e->setData(data); - e->setReplyToCommandId(replyTo); - e->setDeliveryFlags(QSceneChange::Nodes); - notifyObservers(e); - return e->commandId(); -} - -/*! - Send the reply to \a command. - \obsolete -*/ -void QBackendNode::sendReply(const QNodeCommandPtr &command) -{ - command->setDeliveryFlags(QSceneChange::Nodes); - notifyObservers(command); -} - -/*! - * \obsolete - */ -void QBackendNode::initializeFromPeer(const QNodeCreatedChangeBasePtr &change) -{ - Q_UNUSED(change) - qCDebug(Nodes) << Q_FUNC_INFO << change->metaObject()->className() << "does not override"; -} - -/*! * Enables or disables the backend node by \a enabled. */ void QBackendNode::setEnabled(bool enabled) Q_DECL_NOTHROW @@ -276,25 +203,6 @@ void QBackendNode::setEnabled(bool enabled) Q_DECL_NOTHROW d->m_enabled = enabled; } -/*! - * \obsolete - */ -void QBackendNode::sceneChangeEvent(const QSceneChangePtr &e) -{ - Q_D(QBackendNode); - - switch (e->type()) { - case PropertyUpdated: { - auto propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e); - if (propertyChange->propertyName() == QByteArrayLiteral("enabled")) - d->m_enabled = propertyChange->value().toBool(); - break; - } - default: - break; - } -} - } // Qt3D QT_END_NAMESPACE diff --git a/src/core/nodes/qbackendnode.h b/src/core/nodes/qbackendnode.h index 691375999..4af1ae996 100644 --- a/src/core/nodes/qbackendnode.h +++ b/src/core/nodes/qbackendnode.h @@ -40,10 +40,7 @@ #ifndef QT3DCORE_QBACKENDNODE_H #define QT3DCORE_QBACKENDNODE_H -#include <Qt3DCore/qnodecreatedchange.h> #include <Qt3DCore/qnodeid.h> -#include <Qt3DCore/qnodecommand.h> -#include <Qt3DCore/qscenechange.h> #include <Qt3DCore/qt3dcore_global.h> QT_BEGIN_NAMESPACE @@ -62,7 +59,7 @@ class Q_3DCORESHARED_EXPORT QBackendNodeMapper { public: virtual ~QBackendNodeMapper(); - virtual QBackendNode *create(const QNodeCreatedChangeBasePtr &change) const = 0; // TODO QT6 change to only take a NodeId + virtual QBackendNode *create(QNodeId id) const = 0; virtual QBackendNode *get(QNodeId id) const = 0; virtual void destroy(QNodeId id) const = 0; }; @@ -90,20 +87,13 @@ public: protected: Q_DECLARE_PRIVATE(QBackendNode) explicit QBackendNode(QBackendNodePrivate &dd); - Q3D_DECL_DEPRECATED void notifyObservers(const QSceneChangePtr &e); - Q3D_DECL_DEPRECATED QNodeCommand::CommandId sendCommand(const QString &name, const QVariant &data, - QNodeCommand::CommandId replyTo = QNodeCommand::CommandId()); - Q3D_DECL_DEPRECATED void sendReply(const QNodeCommandPtr &command); - Q3D_DECL_DEPRECATED virtual void sceneChangeEvent(const QSceneChangePtr &e); QBackendNodePrivate *d_ptr; private: Q_DISABLE_COPY(QBackendNode) void setPeerId(QNodeId id) Q_DECL_NOEXCEPT; - Q3D_DECL_DEPRECATED virtual void initializeFromPeer(const QNodeCreatedChangeBasePtr &change); - friend class QBackendNodePropertyChange; friend class QAbstractAspectPrivate; #if defined(QT_BUILD_INTERNAL) friend class QBackendNodeTester; diff --git a/src/core/nodes/qbackendnode_p.h b/src/core/nodes/qbackendnode_p.h index 260eef087..8a4e4c57c 100644 --- a/src/core/nodes/qbackendnode_p.h +++ b/src/core/nodes/qbackendnode_p.h @@ -53,10 +53,6 @@ #include <Qt3DCore/qbackendnode.h> #include <Qt3DCore/qnodeid.h> - -#include <Qt3DCore/private/qlockableobserverinterface_p.h> -#include <Qt3DCore/private/qobservableinterface_p.h> -#include <Qt3DCore/private/qobserverinterface_p.h> #include <Qt3DCore/private/qt3dcore_global_p.h> QT_BEGIN_NAMESPACE @@ -66,15 +62,10 @@ namespace Qt3DCore { class QNode; class Q_3DCORE_PRIVATE_EXPORT QBackendNodePrivate - : public QObserverInterface - , public QObservableInterface { public: QBackendNodePrivate(QBackendNode::Mode mode); - void setArbiter(QLockableObserverInterface *arbiter) override; - void notifyObservers(const QSceneChangePtr &e) override; - void sceneChangeEvent(const QSceneChangePtr &e) override; void setEnabled(bool enabled); static QBackendNodePrivate *get(QBackendNode *n); @@ -83,7 +74,6 @@ public: QBackendNode *q_ptr; QBackendNode::Mode m_mode; - QLockableObserverInterface *m_arbiter; QNodeId m_peerId; bool m_enabled; diff --git a/src/core/nodes/qentity.cpp b/src/core/nodes/qentity.cpp index 1199dfc4b..ac07faaef 100644 --- a/src/core/nodes/qentity.cpp +++ b/src/core/nodes/qentity.cpp @@ -41,7 +41,6 @@ #include "qentity_p.h" #include <Qt3DCore/qcomponent.h> -#include <Qt3DCore/qnodecreatedchange.h> #include <QtCore/QMetaObject> #include <QtCore/QMetaProperty> @@ -144,7 +143,7 @@ void QEntityPrivate::removeDestroyedComponent(QComponent *comp) Q_CHECK_PTR(comp); qCDebug(Nodes) << Q_FUNC_INFO << comp; - updateNode(comp, nullptr, ComponentRemoved); + updateComponentRelationShip(comp, ComponentRelationshipChange::Removed); m_components.removeOne(comp); // Remove bookkeeping connection @@ -223,7 +222,7 @@ void QEntity::addComponent(QComponent *comp) // Ensures proper bookkeeping d->registerPrivateDestructionHelper(comp, &QEntityPrivate::removeDestroyedComponent); - d->updateNode(comp, nullptr, ComponentAdded); + d->updateComponentRelationShip(comp, ComponentRelationshipChange::Added); static_cast<QComponentPrivate *>(QComponentPrivate::get(comp))->addEntity(this); } @@ -238,7 +237,7 @@ void QEntity::removeComponent(QComponent *comp) static_cast<QComponentPrivate *>(QComponentPrivate::get(comp))->removeEntity(this); - d->updateNode(comp, nullptr, ComponentRemoved); + d->updateComponentRelationShip(comp, ComponentRelationshipChange::Removed); d->m_components.removeOne(comp); @@ -294,35 +293,17 @@ QString QEntityPrivate::dumpSceneGraph() const return dumpSG(q).join('\n'); } -QNodeCreatedChangeBasePtr QEntity::createNodeCreationChange() const +void QEntityPrivate::updateComponentRelationShip(QComponent *component, ComponentRelationshipChange::RelationShip change) { - auto creationChange = QNodeCreatedChangePtr<QEntityData>::create(this); - auto &data = creationChange->data; - - Q_D(const QEntity); - data.parentEntityId = parentEntity() ? parentEntity()->id() : Qt3DCore::QNodeId(); - - // Find all child entities - QQueue<QNode *> queue; - queue.append(childNodes().toList()); - data.childEntityIds.reserve(queue.size()); - while (!queue.isEmpty()) { - auto *child = queue.dequeue(); - auto *childEntity = qobject_cast<QEntity *>(child); - if (childEntity != nullptr) - data.childEntityIds.push_back(childEntity->id()); - else - queue.append(child->childNodes().toList()); + if (m_changeArbiter) { + // Ensure node has its postConstructorInit called if we reach this + // point, we could otherwise endup referencing a node that has yet + // to be created in the backend + QNodePrivate::get(component)->_q_ensureBackendNodeCreated(); + + Q_Q(QEntity); + m_changeArbiter->addDirtyEntityComponentNodes(q, component, change); } - - data.componentIdsAndTypes.reserve(d->m_components.size()); - const QComponentVector &components = d->m_components; - for (QComponent *c : components) { - const auto idAndType = QNodeIdTypePair(c->id(), QNodePrivate::findStaticMetaObject(c->metaObject())); - data.componentIdsAndTypes.push_back(idAndType); - } - - return creationChange; } void QEntity::onParentChanged(QObject *) diff --git a/src/core/nodes/qentity.h b/src/core/nodes/qentity.h index 62398faa1..ab87da4eb 100644 --- a/src/core/nodes/qentity.h +++ b/src/core/nodes/qentity.h @@ -88,8 +88,6 @@ private Q_SLOTS: private: Q_DECLARE_PRIVATE(QEntity) - - QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; typedef QSharedPointer<QEntity> QEntityPtr; diff --git a/src/core/nodes/qentity_p.h b/src/core/nodes/qentity_p.h index 992f81931..d074148c1 100644 --- a/src/core/nodes/qentity_p.h +++ b/src/core/nodes/qentity_p.h @@ -55,6 +55,7 @@ #include <Qt3DCore/private/qnode_p.h> #include <Qt3DCore/private/qt3dcore_global_p.h> +#include <Qt3DCore/private/qchangearbiter_p.h> QT_BEGIN_NAMESPACE @@ -69,6 +70,7 @@ public : Q_DECLARE_PUBLIC(QEntity) QNodeId parentEntityId() const; + void updateComponentRelationShip(QComponent *component, ComponentRelationshipChange::RelationShip change); template<class T> QVector<T*> componentsOfType() const diff --git a/src/core/nodes/qnode.cpp b/src/core/nodes/qnode.cpp index ad084242f..918ce0827 100644 --- a/src/core/nodes/qnode.cpp +++ b/src/core/nodes/qnode.cpp @@ -43,12 +43,7 @@ #include <Qt3DCore/QComponent> #include <Qt3DCore/qaspectengine.h> -#include <Qt3DCore/qdynamicpropertyupdatedchange.h> #include <Qt3DCore/qentity.h> -#include <Qt3DCore/qnodedestroyedchange.h> -#include <Qt3DCore/qpropertynodeaddedchange.h> -#include <Qt3DCore/qpropertynoderemovedchange.h> -#include <Qt3DCore/qpropertyupdatedchange.h> #include <QtCore/QChildEvent> #include <QtCore/QEvent> #include <QtCore/QMetaObject> @@ -57,7 +52,6 @@ #include <Qt3DCore/private/corelogging_p.h> #include <Qt3DCore/private/qdestructionidandtypecollector_p.h> #include <Qt3DCore/private/qnodevisitor_p.h> -#include <Qt3DCore/private/qpostman_p.h> #include <Qt3DCore/private/qscene_p.h> #include <Qt3DCore/private/qaspectengine_p.h> #include <Qt3DCore/private/qaspectmanager_p.h> @@ -141,13 +135,6 @@ void QNodePrivate::notifyDestructionChangesAndRemoveFromScene() { Q_Q(QNode); - // We notify the backend that the parent lost us as a child - if (m_changeArbiter != nullptr && !m_parentId.isNull()) { - const auto change = QPropertyNodeRemovedChangePtr::create(m_parentId, q); - change->setPropertyName("children"); - notifyObservers(change); - } - // Tell the backend we are about to be destroyed if (m_hasBackendNode && m_scene && m_scene->engine()) QAspectEnginePrivate::get(m_scene->engine())->removeNode(q); @@ -238,9 +225,7 @@ void QNodePrivate::_q_addChild(QNode *childNode) // we need to catch that to avoid sending more than one new child event // to the backend. childD->m_notifiedParent = true; - const auto change = QPropertyNodeAddedChangePtr::create(m_id, childNode); - change->setPropertyName("children"); - notifyObservers(change); + update(); } // Update the scene @@ -261,13 +246,7 @@ void QNodePrivate::_q_removeChild(QNode *childNode) Q_ASSERT_X(childNode->parent() == q_func(), Q_FUNC_INFO, "not a child of this node"); QNodePrivate::get(childNode)->m_parentId = QNodeId(); - - // We notify the backend that we lost a child - if (m_changeArbiter != nullptr) { - const auto change = QPropertyNodeRemovedChangePtr::create(m_id, childNode); - change->setPropertyName("children"); - notifyObservers(change); - } + update(); } /*! @@ -458,7 +437,7 @@ void QNodePrivate::addEntityComponentToScene(QNode *root) \internal */ // Called in the main thread by QScene -> following QEvent::childAdded / addChild -void QNodePrivate::setArbiter(QLockableObserverInterface *arbiter) +void QNodePrivate::setArbiter(QChangeArbiter *arbiter) { if (m_changeArbiter && m_changeArbiter != arbiter) { unregisterNotifiedProperties(); @@ -467,7 +446,7 @@ void QNodePrivate::setArbiter(QLockableObserverInterface *arbiter) Q_Q(QNode); m_changeArbiter->removeDirtyFrontEndNode(q); } - m_changeArbiter = static_cast<QAbstractArbiter *>(arbiter); + m_changeArbiter = arbiter; if (m_changeArbiter) registerNotifiedProperties(); } @@ -523,53 +502,6 @@ void QNodePrivate::_q_ensureBackendNodeCreated() */ /*! - * Sends the \a change QSceneChangePtr to any QBackendNodes in the registered - * aspects that correspond to this QNode. - * - * You only need to call this function if you wish to send a specific type of - * change in place of the automatic handling. - * - * Note: as of Qt 5.14, change messages are deprecated and should not be used, - * in particular for properties. - */ -void QNode::notifyObservers(const QSceneChangePtr &change) -{ - Q_D(QNode); - d->notifyObservers(change); -} - -/*! - \obsolete - - Called when one or more backend aspects sends a notification \a change to the - current Qt3DCore::QNode instance. - - \note This method should be reimplemented in your subclasses to properly - handle the \a change. -*/ -void QNode::sceneChangeEvent(const QSceneChangePtr &change) -{ - Q_UNUSED(change) - if (change->type() == Qt3DCore::PropertyUpdated) { - // TODO: Do this more efficiently. We could pass the metaobject and property - // index to the animation aspect via the QChannelMapping. This would - // allow us to avoid the propertyIndex lookup here by sending them in - // a new subclass of QPropertyUpdateChange. - // Try to find property and call setter - auto e = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(change); - const QMetaObject *mo = metaObject(); - const int propertyIndex = mo->indexOfProperty(e->propertyName()); - QMetaProperty mp = mo->property(propertyIndex); - bool wasBlocked = blockNotifications(true); - mp.write(this, e->value()); - blockNotifications(wasBlocked); - } else { - // Nothing is handling this change, warn the user. - qWarning() << Q_FUNC_INFO << "sceneChangeEvent should have been subclassed"; - } -} - -/*! \internal */ void QNodePrivate::setScene(QScene *scene) @@ -618,25 +550,6 @@ void QNodePrivate::notifyDynamicPropertyChange(const QByteArray &name, const QVa update(); } -/*! - \internal - */ -// Called by the main thread -void QNodePrivate::notifyObservers(const QSceneChangePtr &change) -{ - Q_ASSERT(change); - - // Don't send notifications if we are blocking - if (m_blockNotifications && change->type() == PropertyUpdated) - return; - - if (m_changeArbiter != nullptr) { - QAbstractPostman *postman = m_changeArbiter->postman(); - if (postman != nullptr) - postman->notifyBackend(change); - } -} - // Inserts this tree into the main Scene tree. // Needed when SceneLoaders provide a cloned tree from the backend // and need to insert it in the main scene tree @@ -682,19 +595,6 @@ void QNodePrivate::update() } } -void QNodePrivate::updateNode(QNode *node, const char *property, ChangeFlag change) -{ - if (m_changeArbiter) { - // Ensure node has its postConstructorInit called if we reach this - // point, we could otherwise endup referencing a node that has yet - // to be created in the backend - QNodePrivate::get(node)->_q_ensureBackendNodeCreated(); - - Q_Q(QNode); - m_changeArbiter->addDirtyFrontEndNode(q, node, property, change); - } -} - /*! \internal */ @@ -1000,21 +900,6 @@ void QNode::clearPropertyTrackings() } /*! - * \obsolete - */ -QNodeCreatedChangeBasePtr QNode::createNodeCreationChange() const -{ - // Uncomment this when implementing new frontend and backend types. - // Any classes that don't override this function will be noticeable here. - // Note that some classes actually don't need to override as they have - // no additional data to send. In those cases this default implementation - // is perfectly fine. - // const QMetaObject *mo = metaObject(); - // qDebug() << Q_FUNC_INFO << mo->className(); - return QNodeCreatedChangeBasePtr::create(this); -} - -/*! \fn Qt3DCore::QNodeCommand::CommandId Qt3DCore::QNodeCommand::inReplyTo() const Returns the id of the original QNodeCommand message that @@ -1052,52 +937,6 @@ QNodeCreatedChangeBasePtr QNode::createNodeCreationChange() const Erases all values that have been saved by the property tracking. */ -/*! - * \brief Sends a command message to the backend node - * \obsolete - * - * Creates a QNodeCommand message and dispatches it to the backend node. The - * command is given and a \a name and some \a data which can be used in the - * backend node to perform various operations. - * This returns a CommandId which can be used to identify the initial command - * when receiving a message in reply. If the command message is to be sent in - * reply to another command, \a replyTo contains the id of that command. - * - * \sa QNodeCommand, QNode::sendReply - */ -QNodeCommand::CommandId QNode::sendCommand(const QString &name, - const QVariant &data, - QNodeCommand::CommandId replyTo) -{ - Q_D(QNode); - - // Bail out early, if we can, to avoid operator new - if (d->m_blockNotifications) - return QNodeCommand::CommandId(0); - - auto e = QNodeCommandPtr::create(d->m_id); - e->setName(name); - e->setData(data); - e->setReplyToCommandId(replyTo); - d->notifyObservers(e); - return e->commandId(); -} - -/*! - * \brief Send a \a command back to the backend node. - * \obsolete - * - * Assumes the command is to be to sent back in reply to itself to the backend node. - * - * \sa QNodeCommand, QNode::sendCommand - */ -void QNode::sendReply(const QNodeCommandPtr &command) -{ - Q_D(QNode); - command->setDeliveryFlags(QSceneChange::BackendNodes); - d->notifyObservers(command); -} - namespace { diff --git a/src/core/nodes/qnode.h b/src/core/nodes/qnode.h index efdec8da5..f24daf63f 100644 --- a/src/core/nodes/qnode.h +++ b/src/core/nodes/qnode.h @@ -40,10 +40,7 @@ #ifndef QT3DCORE_QNODE_H #define QT3DCORE_QNODE_H -#include <Qt3DCore/qnodecreatedchange.h> #include <Qt3DCore/qnodeid.h> -#include <Qt3DCore/qnodecommand.h> -#include <Qt3DCore/qscenechange.h> #include <Qt3DCore/qt3dcore_global.h> #include <QtCore/QObject> @@ -99,10 +96,6 @@ public: void clearPropertyTracking(const QString &propertyName); void clearPropertyTrackings(); - Q3D_DECL_DEPRECATED QNodeCommand::CommandId sendCommand(const QString &name, const QVariant &data = QVariant(), - QNodeCommand::CommandId replyTo = QNodeCommand::CommandId()); - Q3D_DECL_DEPRECATED void sendReply(const QNodeCommandPtr &command); - public Q_SLOTS: void setParent(QNode *parent); void setEnabled(bool isEnabled); @@ -116,12 +109,9 @@ Q_SIGNALS: protected: explicit QNode(QNodePrivate &dd, QNode *parent = nullptr); - Q3D_DECL_DEPRECATED void notifyObservers(const QSceneChangePtr &change); - Q3D_DECL_DEPRECATED virtual void sceneChangeEvent(const QSceneChangePtr &change); private: Q_DECLARE_PRIVATE(QNode) - Q3D_DECL_DEPRECATED virtual QNodeCreatedChangeBasePtr createNodeCreationChange() const; // We only want setParent(QNode *) to be callable // when dealing with QNode objects @@ -135,8 +125,6 @@ private: friend class QAspectEngine; friend class QAspectEnginePrivate; friend class QAbstractAspectPrivate; - friend class QNodeCreatedChangeGenerator; - friend class QPostman; friend class QScene; #if defined(QT_BUILD_INTERNAL) diff --git a/src/core/nodes/qnode_p.h b/src/core/nodes/qnode_p.h index 5aa4c5328..907f0062a 100644 --- a/src/core/nodes/qnode_p.h +++ b/src/core/nodes/qnode_p.h @@ -57,7 +57,6 @@ #include <Qt3DCore/private/propertychangehandler_p.h> #include <Qt3DCore/private/qchangearbiter_p.h> -#include <Qt3DCore/private/qobservableinterface_p.h> #include <Qt3DCore/private/qt3dcore_global_p.h> #include <QtCore/private/qobject_p.h> #include <QQueue> @@ -69,7 +68,7 @@ namespace Qt3DCore { class QNode; class QAspectEngine; -class Q_3DCORE_PRIVATE_EXPORT QNodePrivate : public QObjectPrivate, public QObservableInterface +class Q_3DCORE_PRIVATE_EXPORT QNodePrivate : public QObjectPrivate { public: QNodePrivate(); @@ -80,26 +79,21 @@ public: virtual void setScene(QScene *scene); QScene *scene() const; - void setArbiter(QLockableObserverInterface *arbiter) override; + void setArbiter(QChangeArbiter *arbiter); void notifyPropertyChange(const char *name, const QVariant &value); void notifyDynamicPropertyChange(const QByteArray &name, const QVariant &value); - void notifyObservers(const QSceneChangePtr &change) override; void insertTree(QNode *treeRoot, int depth = 0); void updatePropertyTrackMode(); void update(); - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - void updateNode(QNode *node, const char* property, ChangeFlag change); - QT_WARNING_POP Q_DECLARE_PUBLIC(QNode) // For now this just protects access to the m_changeArbiter. // Later on we may decide to extend support for multiple observers. - QAbstractArbiter *m_changeArbiter; + QChangeArbiter *m_changeArbiter; QMetaObject *m_typeInfo; QScene *m_scene; mutable QNodeId m_id; diff --git a/src/core/nodes/qnodecreatedchangegenerator.cpp b/src/core/nodes/qnodecreatedchangegenerator.cpp deleted file mode 100644 index d91949fb1..000000000 --- a/src/core/nodes/qnodecreatedchangegenerator.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qnodecreatedchangegenerator_p.h" - -#include <Qt3DCore/private/qnodevisitor_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QNodeCreatedChangeGenerator::QNodeCreatedChangeGenerator(QNode *rootNode) -{ - QNodeVisitor visitor; - visitor.traverse(rootNode, this, &QNodeCreatedChangeGenerator::createCreationChange); -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/nodes/qnodecreatedchangegenerator_p.h b/src/core/nodes/qnodecreatedchangegenerator_p.h deleted file mode 100644 index 35e5b673e..000000000 --- a/src/core/nodes/qnodecreatedchangegenerator_p.h +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QNODECREATEDCHANGEGENERATOR_H -#define QT3DCORE_QNODECREATEDCHANGEGENERATOR_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <Qt3DCore/qnode.h> -#include <Qt3DCore/qnodecreatedchange.h> -#include <Qt3DCore/qt3dcore_global.h> -#include <QtCore/qvector.h> - -#include <Qt3DCore/private/qnode_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class Q_3DCORE_PRIVATE_EXPORT QNodeCreatedChangeGenerator -{ -public: - QNodeCreatedChangeGenerator(QNode *rootNode); - - QVector<QNodeCreatedChangeBasePtr> creationChanges() const { return m_creationChanges; } - -private: - void createCreationChange(QNode *node) - { - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - const auto creationChange = node->createNodeCreationChange(); - m_creationChanges.push_back(creationChange); - - // Store the metaobject of the node in the QNode so that we have it available - // to us during destruction in the QNode destructor. This allows us to send - // the QNodeId and the metaobject as typeinfo to the backend aspects so they - // in turn can find the correct QBackendNodeMapper object to handle the destruction - // of the corresponding backend nodes. - QNodePrivate *d = QNodePrivate::get(node); - d->m_typeInfo = const_cast<QMetaObject*>(creationChange->metaObject()); - - // Mark this node as having been handled for creation so that it is picked up - d->m_hasBackendNode = true; - QT_WARNING_POP - } - - QVector<QNodeCreatedChangeBasePtr> m_creationChanges; -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QNODECREATEDCHANGEGENERATOR_H |