diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2020-06-29 11:57:36 +0200 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2020-07-02 13:03:44 +0200 |
commit | b70f7af20550f55e9546ff5a2192f53d6ccb62cb (patch) | |
tree | c16156ad6b57a24e72dbcf491e680f95e73bce14 /src/input/frontend | |
parent | abb02d0aae5a114b77ad2edc07568fb0bcf4c6e5 (diff) |
QAspectJob: switch to using std::vector
Change-Id: I1314bd4d37ad17442ebd6287f571e41bc5d25490
Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'src/input/frontend')
-rw-r--r-- | src/input/frontend/qinputaspect.cpp | 17 | ||||
-rw-r--r-- | src/input/frontend/qinputaspect.h | 2 | ||||
-rw-r--r-- | src/input/frontend/qinputdeviceintegration_p.h | 2 |
3 files changed, 12 insertions, 9 deletions
diff --git a/src/input/frontend/qinputaspect.cpp b/src/input/frontend/qinputaspect.cpp index 65cd35b14..3d2b6526b 100644 --- a/src/input/frontend/qinputaspect.cpp +++ b/src/input/frontend/qinputaspect.cpp @@ -221,23 +221,26 @@ QStringList QInputAspect::availablePhysicalDevices() const /*! \internal */ -QVector<QAspectJobPtr> QInputAspect::jobsToExecute(qint64 time) +std::vector<QAspectJobPtr> QInputAspect::jobsToExecute(qint64 time) { Q_D(QInputAspect); const qint64 deltaTime = time - d->m_time; const float dt = static_cast<float>(deltaTime) / 1.0e9f; d->m_time = time; - QVector<QAspectJobPtr> jobs; + std::vector<QAspectJobPtr> jobs; d->m_inputHandler->updateEventSource(); // Mouse and keyboard handlers will have seen the events already. // All we need now is to update the axis and the accumulators since // they depend on time, and other bookkeeping. + const auto integrations = d->m_inputHandler->inputDeviceIntegrations(); - for (QInputDeviceIntegration *integration : integrations) - jobs += integration->jobsToExecute(time); + for (QInputDeviceIntegration *integration : integrations) { + const std::vector<QAspectJobPtr> integrationJobs = integration->jobsToExecute(time); + jobs.insert(jobs.end(), std::make_move_iterator(integrationJobs.begin()), std::make_move_iterator(integrationJobs.end())); + } const QVector<Qt3DCore::QNodeId> proxiesToLoad = d->m_inputHandler->physicalDeviceProxyManager()->takePendingProxiesToLoad(); if (!proxiesToLoad.isEmpty()) { @@ -251,11 +254,11 @@ QVector<QAspectJobPtr> QInputAspect::jobsToExecute(qint64 time) // All the jobs added up until this point are independents // but the axis action jobs will be dependent on these - const QVector<QAspectJobPtr> dependsOnJobs = jobs; + const std::vector<QAspectJobPtr> dependsOnJobs = jobs; // Jobs that update Axis/Action (store combined axis/action value) const auto devHandles = d->m_inputHandler->logicalDeviceManager()->activeDevices(); - QVector<QAspectJobPtr> axisActionJobs; + std::vector<QAspectJobPtr> axisActionJobs; axisActionJobs.reserve(devHandles.size()); for (const Input::HLogicalDevice &devHandle : devHandles) { const auto device = d->m_inputHandler->logicalDeviceManager()->data(devHandle); @@ -263,7 +266,7 @@ QVector<QAspectJobPtr> QInputAspect::jobsToExecute(qint64 time) continue; QAspectJobPtr updateAxisActionJob(new Input::UpdateAxisActionJob(time, d->m_inputHandler.data(), devHandle)); - jobs += updateAxisActionJob; + jobs.push_back(updateAxisActionJob); axisActionJobs.push_back(updateAxisActionJob); for (const QAspectJobPtr &job : dependsOnJobs) updateAxisActionJob->addDependency(job); diff --git a/src/input/frontend/qinputaspect.h b/src/input/frontend/qinputaspect.h index eff1b9e53..0ccc0abff 100644 --- a/src/input/frontend/qinputaspect.h +++ b/src/input/frontend/qinputaspect.h @@ -62,7 +62,7 @@ public: QStringList availablePhysicalDevices() const; private: - QVector<Qt3DCore::QAspectJobPtr> jobsToExecute(qint64 time) override; + std::vector<Qt3DCore::QAspectJobPtr> jobsToExecute(qint64 time) override; void onRegistered() override; void onUnregistered() override; diff --git a/src/input/frontend/qinputdeviceintegration_p.h b/src/input/frontend/qinputdeviceintegration_p.h index 4522e2654..438e407fb 100644 --- a/src/input/frontend/qinputdeviceintegration_p.h +++ b/src/input/frontend/qinputdeviceintegration_p.h @@ -90,7 +90,7 @@ protected: public: void initialize(Qt3DInput::QInputAspect *aspect); - virtual QVector<Qt3DCore::QAspectJobPtr> jobsToExecute(qint64 time) = 0; + virtual std::vector<Qt3DCore::QAspectJobPtr> jobsToExecute(qint64 time) = 0; virtual QAbstractPhysicalDevice *createPhysicalDevice(const QString &name) = 0; virtual QVector<Qt3DCore::QNodeId> physicalDevices() const = 0; virtual QAbstractPhysicalDeviceBackendNode *physicalDevice(Qt3DCore::QNodeId id) const = 0; |