summaryrefslogtreecommitdiffstats
path: root/src/input
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-05-10 14:40:14 +0200
committerSean Harmer <sean.harmer@kdab.com>2016-05-14 16:02:20 +0000
commitd03cfcec1448b8df7ff5084df21f427c58466cdc (patch)
tree9fc9bb1d784109b6394a0ee9c5ee331f158e4cd4 /src/input
parent91e831fee437fb44a1e2104fb4c94ccb7019819a (diff)
Qt3DInput: eradicate remaining Q_FOREACH loop
Change-Id: Ib3347e8f6bde8cfae9529c72bf63c93b21be213d Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/input')
-rw-r--r--src/input/backend/inputhandler.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/input/backend/inputhandler.cpp b/src/input/backend/inputhandler.cpp
index 2e2f2febc..6208c902f 100644
--- a/src/input/backend/inputhandler.cpp
+++ b/src/input/backend/inputhandler.cpp
@@ -208,25 +208,25 @@ QVector<Qt3DCore::QAspectJobPtr> InputHandler::keyboardJobs()
QVector<QAspectJobPtr> jobs;
const QList<QT_PREPEND_NAMESPACE(QKeyEvent)> events = pendingKeyEvents();
- Q_FOREACH (const HKeyboardDevice cHandle, m_activeKeyboardDevices) {
+ for (const HKeyboardDevice cHandle : qAsConst(m_activeKeyboardDevices)) {
KeyboardDevice *keyboardDevice = m_keyboardDeviceManager->data(cHandle);
if (keyboardDevice) {
keyboardDevice->updateKeyEvents(events);
- QAspectJobPtr focusChangeJob;
+ bool haveFocusChangeJob = false;
if (keyboardDevice->lastKeyboardInputRequester() != keyboardDevice->currentFocusItem()) {
- AssignKeyboardFocusJob *job = new AssignKeyboardFocusJob(keyboardDevice->peerId());
+ auto job = QSharedPointer<AssignKeyboardFocusJob>::create(keyboardDevice->peerId());
job->setInputHandler(this);
- focusChangeJob.reset(job);
- jobs.append(focusChangeJob);
+ haveFocusChangeJob= true;
+ jobs.append(std::move(job));
// One job for Keyboard events (depends on the focus change job if there was one)
}
// Event dispacthing job
if (!events.isEmpty()) {
- KeyEventDispatcherJob *job = new KeyEventDispatcherJob(keyboardDevice->currentFocusItem(), events);
+ auto job = QSharedPointer<KeyEventDispatcherJob>::create(keyboardDevice->currentFocusItem(), events);
job->setInputHandler(this);
- if (focusChangeJob)
- job->addDependency(focusChangeJob);
- jobs.append(QAspectJobPtr(job));
+ if (haveFocusChangeJob)
+ job->addDependency(qAsConst(jobs).back());
+ jobs.append(std::move(job));
}
}
}
@@ -239,7 +239,7 @@ QVector<Qt3DCore::QAspectJobPtr> InputHandler::mouseJobs()
const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> mouseEvents = pendingMouseEvents();
const QList<QT_PREPEND_NAMESPACE(QWheelEvent)> wheelEvents = pendingWheelEvents();
- Q_FOREACH (const HMouseDevice cHandle, m_activeMouseDevices) {
+ for (const HMouseDevice cHandle : qAsConst(m_activeMouseDevices)) {
MouseDevice *controller = m_mouseDeviceManager->data(cHandle);
controller->updateMouseEvents(mouseEvents);