diff options
author | Tomi Korpipää <tomi.korpipaa@theqtcompany.com> | 2015-12-08 11:50:37 +0200 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@theqtcompany.com> | 2015-12-09 05:18:19 +0000 |
commit | 0e15154c9f0d982096a551efc53fd363d2b2f68d (patch) | |
tree | 4917ca73c44a92297db7cc3dbd72d2716481ccc7 /src/core | |
parent | 036ea9fcfdd343c805e1a900528e7a2367d6c373 (diff) |
Added parameters to signals and made setters Q_SLOTS
Change-Id: Icec2f9f207221e35ffdeeb594bb9b4dc6ef890f1
Task-number: QTBUG-49797
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/core-components/qcamera.cpp | 54 | ||||
-rw-r--r-- | src/core/core-components/qcamera.h | 69 | ||||
-rw-r--r-- | src/core/core-components/qcameralens.cpp | 18 | ||||
-rw-r--r-- | src/core/core-components/qcameralens.h | 48 | ||||
-rw-r--r-- | src/core/core-components/qcameralens_p.h | 6 | ||||
-rw-r--r-- | src/core/nodes/qcomponent.cpp | 2 | ||||
-rw-r--r-- | src/core/nodes/qcomponent.h | 8 | ||||
-rw-r--r-- | src/core/nodes/qnode.cpp | 2 | ||||
-rw-r--r-- | src/core/nodes/qnode.h | 8 | ||||
-rw-r--r-- | src/core/transforms/qtransform.cpp | 16 | ||||
-rw-r--r-- | src/core/transforms/qtransform.h | 10 |
11 files changed, 114 insertions, 127 deletions
diff --git a/src/core/core-components/qcamera.cpp b/src/core/core-components/qcamera.cpp index c26d9b67b..c83371189 100644 --- a/src/core/core-components/qcamera.cpp +++ b/src/core/core-components/qcamera.cpp @@ -68,17 +68,17 @@ QCameraPrivate::QCameraPrivate() QCamera::QCamera(QNode *parent) : QEntity(*new QCameraPrivate, parent) { - QObject::connect(d_func()->m_lens, SIGNAL(projectionTypeChanged()), this, SIGNAL(projectionTypeChanged())); - QObject::connect(d_func()->m_lens, SIGNAL(nearPlaneChanged()), this, SIGNAL(nearPlaneChanged())); - QObject::connect(d_func()->m_lens, SIGNAL(farPlaneChanged()), this, SIGNAL(farPlaneChanged())); - QObject::connect(d_func()->m_lens, SIGNAL(fieldOfViewChanged()), this, SIGNAL(fieldOfViewChanged())); - QObject::connect(d_func()->m_lens, SIGNAL(aspectRatioChanged()), this, SIGNAL(aspectRatioChanged())); - QObject::connect(d_func()->m_lens, SIGNAL(leftChanged()), this, SIGNAL(leftChanged())); - QObject::connect(d_func()->m_lens, SIGNAL(rightChanged()), this, SIGNAL(rightChanged())); - QObject::connect(d_func()->m_lens, SIGNAL(bottomChanged()), this, SIGNAL(bottomChanged())); - QObject::connect(d_func()->m_lens, SIGNAL(topChanged()), this, SIGNAL(topChanged())); - QObject::connect(d_func()->m_lens, SIGNAL(projectionMatrixChanged()), this, SIGNAL(projectionMatrixChanged())); - QObject::connect(d_func()->m_transform, SIGNAL(matrixChanged()), this, SIGNAL(viewMatrixChanged())); + QObject::connect(d_func()->m_lens, SIGNAL(projectionTypeChanged(QCameraLens::ProjectionType)), this, SIGNAL(projectionTypeChanged(QCameraLens::ProjectionType))); + QObject::connect(d_func()->m_lens, SIGNAL(nearPlaneChanged(float)), this, SIGNAL(nearPlaneChanged(float))); + QObject::connect(d_func()->m_lens, SIGNAL(farPlaneChanged(float)), this, SIGNAL(farPlaneChanged(float))); + QObject::connect(d_func()->m_lens, SIGNAL(fieldOfViewChanged(float)), this, SIGNAL(fieldOfViewChanged(float))); + QObject::connect(d_func()->m_lens, SIGNAL(aspectRatioChanged(float)), this, SIGNAL(aspectRatioChanged(float))); + QObject::connect(d_func()->m_lens, SIGNAL(leftChanged(float)), this, SIGNAL(leftChanged(float))); + QObject::connect(d_func()->m_lens, SIGNAL(rightChanged(float)), this, SIGNAL(rightChanged(float))); + QObject::connect(d_func()->m_lens, SIGNAL(bottomChanged(float)), this, SIGNAL(bottomChanged(float))); + QObject::connect(d_func()->m_lens, SIGNAL(topChanged(float)), this, SIGNAL(topChanged(float))); + QObject::connect(d_func()->m_lens, SIGNAL(projectionMatrixChanged(const QMatrix4x4 &)), this, SIGNAL(projectionMatrixChanged(const QMatrix4x4 &))); + QObject::connect(d_func()->m_transform, SIGNAL(matrixChanged(const QMatrix4x4 &)), this, SIGNAL(viewMatrixChanged(const QMatrix4x4 &))); addComponent(d_func()->m_lens); addComponent(d_func()->m_transform); } @@ -92,17 +92,17 @@ QCamera::~QCamera() QCamera::QCamera(QCameraPrivate &dd, QNode *parent) : QEntity(dd, parent) { - QObject::connect(d_func()->m_lens, SIGNAL(projectionTypeChanged()), this, SIGNAL(projectionTypeChanged())); - QObject::connect(d_func()->m_lens, SIGNAL(nearPlaneChanged()), this, SIGNAL(nearPlaneChanged())); - QObject::connect(d_func()->m_lens, SIGNAL(farPlaneChanged()), this, SIGNAL(farPlaneChanged())); - QObject::connect(d_func()->m_lens, SIGNAL(fieldOfViewChanged()), this, SIGNAL(fieldOfViewChanged())); - QObject::connect(d_func()->m_lens, SIGNAL(aspectRatioChanged()), this, SIGNAL(aspectRatioChanged())); - QObject::connect(d_func()->m_lens, SIGNAL(leftChanged()), this, SIGNAL(leftChanged())); - QObject::connect(d_func()->m_lens, SIGNAL(rightChanged()), this, SIGNAL(rightChanged())); - QObject::connect(d_func()->m_lens, SIGNAL(bottomChanged()), this, SIGNAL(bottomChanged())); - QObject::connect(d_func()->m_lens, SIGNAL(topChanged()), this, SIGNAL(topChanged())); - QObject::connect(d_func()->m_lens, SIGNAL(projectionMatrixChanged()), this, SIGNAL(projectionMatrixChanged())); - QObject::connect(d_func()->m_transform, SIGNAL(matrixChanged()), this, SIGNAL(viewMatrixChanged())); + QObject::connect(d_func()->m_lens, SIGNAL(projectionTypeChanged(QCameraLens::ProjectionType)), this, SIGNAL(projectionTypeChanged(QCameraLens::ProjectionType))); + QObject::connect(d_func()->m_lens, SIGNAL(nearPlaneChanged(float)), this, SIGNAL(nearPlaneChanged(float))); + QObject::connect(d_func()->m_lens, SIGNAL(farPlaneChanged(float)), this, SIGNAL(farPlaneChanged(float))); + QObject::connect(d_func()->m_lens, SIGNAL(fieldOfViewChanged(float)), this, SIGNAL(fieldOfViewChanged(float))); + QObject::connect(d_func()->m_lens, SIGNAL(aspectRatioChanged(float)), this, SIGNAL(aspectRatioChanged(float))); + QObject::connect(d_func()->m_lens, SIGNAL(leftChanged(float)), this, SIGNAL(leftChanged(float))); + QObject::connect(d_func()->m_lens, SIGNAL(rightChanged(float)), this, SIGNAL(rightChanged(float))); + QObject::connect(d_func()->m_lens, SIGNAL(bottomChanged(float)), this, SIGNAL(bottomChanged(float))); + QObject::connect(d_func()->m_lens, SIGNAL(topChanged(float)), this, SIGNAL(topChanged(float))); + QObject::connect(d_func()->m_lens, SIGNAL(projectionMatrixChanged(const QMatrix4x4 &)), this, SIGNAL(projectionMatrixChanged(const QMatrix4x4 &))); + QObject::connect(d_func()->m_transform, SIGNAL(matrixChanged(const QMatrix4x4 &)), this, SIGNAL(viewMatrixChanged(const QMatrix4x4 &))); addComponent(d_func()->m_lens); addComponent(d_func()->m_transform); } @@ -411,8 +411,8 @@ void QCamera::setPosition(const QVector3D &position) d->m_position = position; d->m_cameraToCenter = d->m_viewCenter - position; d->m_viewMatrixDirty = true; - emit positionChanged(); - emit viewVectorChanged(); + emit positionChanged(position); + emit viewVectorChanged(d->m_cameraToCenter); d->updateViewMatrix(); } @@ -430,7 +430,7 @@ void QCamera::setUpVector(const QVector3D &upVector) Q_D(QCamera); d->m_upVector = upVector; d->m_viewMatrixDirty = true; - emit upVectorChanged(); + emit upVectorChanged(upVector); d->updateViewMatrix(); } @@ -449,8 +449,8 @@ void QCamera::setViewCenter(const QVector3D &viewCenter) d->m_viewCenter = viewCenter; d->m_cameraToCenter = viewCenter - d->m_position; d->m_viewMatrixDirty = true; - emit viewCenterChanged(); - emit viewVectorChanged(); + emit viewCenterChanged(viewCenter); + emit viewVectorChanged(d->m_cameraToCenter); d->updateViewMatrix(); } diff --git a/src/core/core-components/qcamera.h b/src/core/core-components/qcamera.h index e44f0778c..f09281c50 100644 --- a/src/core/core-components/qcamera.h +++ b/src/core/core-components/qcamera.h @@ -109,63 +109,52 @@ public: Q_INVOKABLE void rotate(const QQuaternion& q); Q_INVOKABLE void rotateAboutViewCenter(const QQuaternion& q); - void setProjectionType(QCameraLens::ProjectionType type); QCameraLens::ProjectionType projectionType() const; - - void setNearPlane(float nearPlane); float nearPlane() const; - - void setFarPlane(float farPlane); float farPlane() const; - - void setFieldOfView(float fieldOfView); float fieldOfView() const; - - void setAspectRatio(float aspectRatio); float aspectRatio() const; - - void setLeft(float left); float left() const; - - void setRight(float right); float right() const; - - void setBottom(float bottom); float bottom() const; - - void setTop(float top); float top() const; - QMatrix4x4 projectionMatrix() const; - - void setPosition(const QVector3D &position); QVector3D position() const; - - void setUpVector(const QVector3D &upVector); QVector3D upVector() const; - - void setViewCenter(const QVector3D &viewCenter); QVector3D viewCenter() const; - QVector3D viewVector() const; QMatrix4x4 viewMatrix() const; +public Q_SLOTS: + void setProjectionType(QCameraLens::ProjectionType type); + void setNearPlane(float nearPlane); + void setFarPlane(float farPlane); + void setFieldOfView(float fieldOfView); + void setAspectRatio(float aspectRatio); + void setLeft(float left); + void setRight(float right); + void setBottom(float bottom); + void setTop(float top); + void setPosition(const QVector3D &position); + void setUpVector(const QVector3D &upVector); + void setViewCenter(const QVector3D &viewCenter); + Q_SIGNALS: - void projectionTypeChanged(); - void nearPlaneChanged(); - void farPlaneChanged(); - void fieldOfViewChanged(); - void aspectRatioChanged(); - void leftChanged(); - void rightChanged(); - void bottomChanged(); - void topChanged(); - void projectionMatrixChanged(); - void positionChanged(); - void upVectorChanged(); - void viewCenterChanged(); - void viewVectorChanged(); - void viewMatrixChanged(); + void projectionTypeChanged(QCameraLens::ProjectionType projectionType); + void nearPlaneChanged(float nearPlane); + void farPlaneChanged(float farPlane); + void fieldOfViewChanged(float fieldOfView); + void aspectRatioChanged(float aspectRatio); + void leftChanged(float left); + void rightChanged(float right); + void bottomChanged(float bottom); + void topChanged(float top); + void projectionMatrixChanged(const QMatrix4x4 &projectionMatrix); + void positionChanged(const QVector3D &position); + void upVectorChanged(const QVector3D &upVector); + void viewCenterChanged(const QVector3D &viewCenter); + void viewVectorChanged(const QVector3D &viewVector); + void viewMatrixChanged(const QMatrix4x4 &viewMatrix); protected: Q_DECLARE_PRIVATE(QCamera) diff --git a/src/core/core-components/qcameralens.cpp b/src/core/core-components/qcameralens.cpp index 31be23984..d544d8767 100644 --- a/src/core/core-components/qcameralens.cpp +++ b/src/core/core-components/qcameralens.cpp @@ -114,7 +114,7 @@ void QCameraLens::setProjectionType(QCameraLens::ProjectionType projectionType) Q_D(QCameraLens); if (d->m_projectionType != projectionType) { d->m_projectionType = projectionType; - emit projectionTypeChanged(); + emit projectionTypeChanged(projectionType); d->updateProjectionMatrix(); } } @@ -198,7 +198,7 @@ void QCameraLens::setNearPlane(float nearPlane) if (qFuzzyCompare(d->m_nearPlane, nearPlane)) return; d->m_nearPlane = nearPlane; - emit nearPlaneChanged(); + emit nearPlaneChanged(nearPlane); d->updateProjectionMatrix(); } @@ -221,7 +221,7 @@ void QCameraLens::setFarPlane(float farPlane) if (qFuzzyCompare(d->m_farPlane, farPlane)) return; d->m_farPlane = farPlane; - emit farPlaneChanged(); + emit farPlaneChanged(farPlane); d->updateProjectionMatrix(); } @@ -247,7 +247,7 @@ void QCameraLens::setFieldOfView(float fieldOfView) if (qFuzzyCompare(d->m_fieldOfView, fieldOfView)) return; d->m_fieldOfView = fieldOfView; - emit fieldOfViewChanged(); + emit fieldOfViewChanged(fieldOfView); d->updateProjectionMatrix(); } @@ -276,7 +276,7 @@ void QCameraLens::setAspectRatio(float aspectRatio) if (qFuzzyCompare(d->m_aspectRatio, aspectRatio)) return; d->m_aspectRatio = aspectRatio; - emit aspectRatioChanged(); + emit aspectRatioChanged(aspectRatio); d->updateProjectionMatrix(); } @@ -305,7 +305,7 @@ void QCameraLens::setLeft(float left) if (qFuzzyCompare(d->m_left, left)) return; d->m_left = left; - emit leftChanged(); + emit leftChanged(left); d->updateProjectionMatrix(); } @@ -334,7 +334,7 @@ void QCameraLens::setRight(float right) if (qFuzzyCompare(d->m_right, right)) return; d->m_right = right; - emit rightChanged(); + emit rightChanged(right); d->updateProjectionMatrix(); } @@ -363,7 +363,7 @@ void QCameraLens::setBottom(float bottom) if (qFuzzyCompare(d->m_bottom, bottom)) return; d->m_bottom = bottom; - emit bottomChanged(); + emit bottomChanged(bottom); d->updateProjectionMatrix(); } @@ -392,7 +392,7 @@ void QCameraLens::setTop(float top) if (qFuzzyCompare(d->m_top, top)) return; d->m_top = top; - emit topChanged(); + emit topChanged(top); d->updateProjectionMatrix(); } diff --git a/src/core/core-components/qcameralens.h b/src/core/core-components/qcameralens.h index 23379fbd9..120148e29 100644 --- a/src/core/core-components/qcameralens.h +++ b/src/core/core-components/qcameralens.h @@ -75,31 +75,14 @@ public: }; Q_ENUM(ProjectionType) - void setProjectionType(ProjectionType projectionType); ProjectionType projectionType() const; - - void setNearPlane(float nearPlane); float nearPlane() const; - - void setFarPlane(float nearPlane); float farPlane() const; - - void setFieldOfView(float fieldOfView); float fieldOfView() const; - - void setAspectRatio(float aspectRatio); float aspectRatio() const; - - void setLeft(float left); float left() const; - - void setRight(float right); float right() const; - - void setBottom(float bottom); float bottom() const; - - void setTop(float top); float top() const; QMatrix4x4 projectionMatrix() const; @@ -115,17 +98,28 @@ public: void setPerspectiveProjection(float fieldOfView, float aspect, float nearPlane, float farPlane); +public Q_SLOTS: + void setProjectionType(ProjectionType projectionType); + void setNearPlane(float nearPlane); + void setFarPlane(float farPlane); + void setFieldOfView(float fieldOfView); + void setAspectRatio(float aspectRatio); + void setLeft(float left); + void setRight(float right); + void setBottom(float bottom); + void setTop(float top); + Q_SIGNALS: - void projectionTypeChanged(); - void nearPlaneChanged(); - void farPlaneChanged(); - void fieldOfViewChanged(); - void aspectRatioChanged(); - void leftChanged(); - void rightChanged(); - void bottomChanged(); - void topChanged(); - void projectionMatrixChanged(); + void projectionTypeChanged(QCameraLens::ProjectionType projectionType); + void nearPlaneChanged(float nearPlane); + void farPlaneChanged(float farPlane); + void fieldOfViewChanged(float fieldOfView); + void aspectRatioChanged(float aspectRatio); + void leftChanged(float left); + void rightChanged(float right); + void bottomChanged(float bottom); + void topChanged(float top); + void projectionMatrixChanged(const QMatrix4x4 &projectionMatrix); protected: QCameraLens(QCameraLensPrivate &dd, QNode *parent = 0); diff --git a/src/core/core-components/qcameralens_p.h b/src/core/core-components/qcameralens_p.h index e06ee2396..02cc292bb 100644 --- a/src/core/core-components/qcameralens_p.h +++ b/src/core/core-components/qcameralens_p.h @@ -102,7 +102,7 @@ private: Q_Q(QCameraLens); m_projectionMatrix.setToIdentity(); m_projectionMatrix.perspective(m_fieldOfView, m_aspectRatio, m_nearPlane, m_farPlane); - Q_EMIT q->projectionMatrixChanged(); + Q_EMIT q->projectionMatrixChanged(m_projectionMatrix); } inline void updateOrthographicProjection() @@ -110,7 +110,7 @@ private: Q_Q(QCameraLens); m_projectionMatrix.setToIdentity(); m_projectionMatrix.ortho(m_left, m_right, m_bottom, m_top, m_nearPlane, m_farPlane); - Q_EMIT q->projectionMatrixChanged(); + Q_EMIT q->projectionMatrixChanged(m_projectionMatrix); } inline void updateFrustumProjection() @@ -118,7 +118,7 @@ private: Q_Q(QCameraLens); m_projectionMatrix.setToIdentity(); m_projectionMatrix.frustum(m_left, m_right, m_bottom, m_top, m_nearPlane, m_farPlane); - Q_EMIT q->projectionMatrixChanged(); + Q_EMIT q->projectionMatrixChanged(m_projectionMatrix); } }; diff --git a/src/core/nodes/qcomponent.cpp b/src/core/nodes/qcomponent.cpp index baa201b0f..e4fbcb67d 100644 --- a/src/core/nodes/qcomponent.cpp +++ b/src/core/nodes/qcomponent.cpp @@ -150,7 +150,7 @@ void QComponent::setShareable(bool shareable) Q_D(QComponent); if (d->m_shareable != shareable) { d->m_shareable = shareable; - emit shareableChanged(); + emit shareableChanged(shareable); } } diff --git a/src/core/nodes/qcomponent.h b/src/core/nodes/qcomponent.h index 78ec6f0ae..9ea17e454 100644 --- a/src/core/nodes/qcomponent.h +++ b/src/core/nodes/qcomponent.h @@ -56,17 +56,19 @@ public: ~QComponent(); bool shareable() const; - void setShareable(bool shareable); QVector<QEntity *> entities() const; +public Q_SLOTS: + void setShareable(bool shareable); + protected: QComponent(QComponentPrivate &dd, QNode *parent = 0); void copy(const QNode *ref) Q_DECL_OVERRIDE; Q_SIGNALS: - void shareableChanged(); - void enabledChanged(); + void shareableChanged(bool shareable); + void enabledChanged(bool enabled); private: Q_DECLARE_PRIVATE(QComponent) diff --git a/src/core/nodes/qnode.cpp b/src/core/nodes/qnode.cpp index cad9e501b..8378e1f5f 100644 --- a/src/core/nodes/qnode.cpp +++ b/src/core/nodes/qnode.cpp @@ -534,7 +534,7 @@ void QNode::setParent(QNode *parent) QObject::setParent(parent); if (parentNode()) QNodePrivate::get(parentNode())->_q_addChild(this); - emit parentChanged(); + emit parentChanged(parent); } /*! diff --git a/src/core/nodes/qnode.h b/src/core/nodes/qnode.h index 39d0eca95..f8096ed32 100644 --- a/src/core/nodes/qnode.h +++ b/src/core/nodes/qnode.h @@ -85,12 +85,14 @@ public: bool notificationsBlocked() const; bool blockNotifications(bool block); - virtual void setParent(QNode *parent); QNodeList childrenNodes() const; - void setEnabled(bool isEnabled); bool isEnabled() const; +public Q_SLOTS: + virtual void setParent(QNode *parent); + void setEnabled(bool isEnabled); + protected: // Clone should only be made in the main thread static QNode *clone(QNode *node); @@ -117,7 +119,7 @@ private: friend class QScene; Q_SIGNALS: - void parentChanged(); + void parentChanged(QObject *parent); void enabledChanged(bool enabled); }; diff --git a/src/core/transforms/qtransform.cpp b/src/core/transforms/qtransform.cpp index 81e5a83a3..ea640b802 100644 --- a/src/core/transforms/qtransform.cpp +++ b/src/core/transforms/qtransform.cpp @@ -100,12 +100,12 @@ void QTransform::setMatrix(const QMatrix4x4 &m) d->m_scale = s; d->m_rotation = r; d->m_translation = t; - emit scale3DChanged(); - emit rotationChanged(); - emit translationChanged(); + emit scale3DChanged(s); + emit rotationChanged(r); + emit translationChanged(t); const bool wasBlocked = blockNotifications(true); - emit matrixChanged(); + emit matrixChanged(m); blockNotifications(wasBlocked); } } @@ -126,7 +126,7 @@ void QTransform::setScale3D(const QVector3D &scale) if (scale != d->m_scale) { d->m_scale = scale; d->m_matrixDirty = true; - emit scale3DChanged(); + emit scale3DChanged(scale); } } @@ -142,7 +142,7 @@ void QTransform::setScale(float scale) if (scale != d->m_scale.x()) { setScale3D(QVector3D(scale, scale, scale)); const bool wasBlocked = blockNotifications(true); - emit scaleChanged(); + emit scaleChanged(scale); blockNotifications(wasBlocked); } } @@ -159,7 +159,7 @@ void QTransform::setRotation(const QQuaternion &rotation) if (rotation != d->m_rotation) { d->m_rotation = rotation; d->m_matrixDirty = true; - emit rotationChanged(); + emit rotationChanged(rotation); } } @@ -175,7 +175,7 @@ void QTransform::setTranslation(const QVector3D &translation) if (translation != d->m_translation) { d->m_translation = translation; d->m_matrixDirty = true; - emit translationChanged(); + emit translationChanged(translation); } } diff --git a/src/core/transforms/qtransform.h b/src/core/transforms/qtransform.h index c353349ab..e3c4eeef3 100644 --- a/src/core/transforms/qtransform.h +++ b/src/core/transforms/qtransform.h @@ -90,11 +90,11 @@ public Q_SLOTS: void setMatrix(const QMatrix4x4 &matrix); Q_SIGNALS: - void scaleChanged(); - void scale3DChanged(); - void rotationChanged(); - void translationChanged(); - void matrixChanged(); + void scaleChanged(float scale); + void scale3DChanged(const QVector3D &scale); + void rotationChanged(const QQuaternion &rotation); + void translationChanged(const QVector3D &translation); + void matrixChanged(const QMatrix4x4 &matrix); protected: QTransform(QTransformPrivate &dd, QNode *parent = 0); |