summaryrefslogtreecommitdiffstats
path: root/src/input
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2020-06-29 11:57:36 +0200
committerPaul Lemire <paul.lemire@kdab.com>2020-07-02 13:03:44 +0200
commitb70f7af20550f55e9546ff5a2192f53d6ccb62cb (patch)
treec16156ad6b57a24e72dbcf491e680f95e73bce14 /src/input
parentabb02d0aae5a114b77ad2edc07568fb0bcf4c6e5 (diff)
QAspectJob: switch to using std::vector
Change-Id: I1314bd4d37ad17442ebd6287f571e41bc5d25490 Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'src/input')
-rw-r--r--src/input/backend/keyboardmousegenericdeviceintegration.cpp4
-rw-r--r--src/input/backend/keyboardmousegenericdeviceintegration_p.h2
-rw-r--r--src/input/frontend/qinputaspect.cpp17
-rw-r--r--src/input/frontend/qinputaspect.h2
-rw-r--r--src/input/frontend/qinputdeviceintegration_p.h2
5 files changed, 15 insertions, 12 deletions
diff --git a/src/input/backend/keyboardmousegenericdeviceintegration.cpp b/src/input/backend/keyboardmousegenericdeviceintegration.cpp
index 27da019af..00699dcb5 100644
--- a/src/input/backend/keyboardmousegenericdeviceintegration.cpp
+++ b/src/input/backend/keyboardmousegenericdeviceintegration.cpp
@@ -62,10 +62,10 @@ void KeyboardMouseGenericDeviceIntegration::onInitialize()
{
}
-QVector<Qt3DCore::QAspectJobPtr> KeyboardMouseGenericDeviceIntegration::jobsToExecute(qint64 time)
+std::vector<Qt3DCore::QAspectJobPtr> KeyboardMouseGenericDeviceIntegration::jobsToExecute(qint64 time)
{
Q_UNUSED(time);
- return QVector<Qt3DCore::QAspectJobPtr>();
+ return {};
}
QAbstractPhysicalDevice *KeyboardMouseGenericDeviceIntegration::createPhysicalDevice(const QString &name)
diff --git a/src/input/backend/keyboardmousegenericdeviceintegration_p.h b/src/input/backend/keyboardmousegenericdeviceintegration_p.h
index dd7c5fc12..1b64513bd 100644
--- a/src/input/backend/keyboardmousegenericdeviceintegration_p.h
+++ b/src/input/backend/keyboardmousegenericdeviceintegration_p.h
@@ -68,7 +68,7 @@ public:
explicit KeyboardMouseGenericDeviceIntegration(InputHandler *handleer);
~KeyboardMouseGenericDeviceIntegration();
- QVector<Qt3DCore::QAspectJobPtr> jobsToExecute(qint64 time) final;
+ std::vector<Qt3DCore::QAspectJobPtr> jobsToExecute(qint64 time) final;
QAbstractPhysicalDevice *createPhysicalDevice(const QString &name) final;
QVector<Qt3DCore::QNodeId> physicalDevices() const final;
QAbstractPhysicalDeviceBackendNode *physicalDevice(Qt3DCore::QNodeId id) const final;
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;