diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2015-06-27 16:11:18 +0100 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2015-06-28 17:57:03 +0000 |
commit | 56aaa976625a2cd337ccf24b29ae563dc8292778 (patch) | |
tree | 84639e83fdee76f5bac0a6b4ee9d4c7ec78e5b72 /src/core/services/qservicelocator.cpp | |
parent | 1a72328bcc622d27dfc3a87570e93b7a5f38da18 (diff) |
Use tick clock service by default via service provider mechanism
If the QRendererAspect is present it provdes a vsync based service
still.
Change-Id: Ib9119a2ee9dc3936d3a1548940a6e4e30dd38b11
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/core/services/qservicelocator.cpp')
-rw-r--r-- | src/core/services/qservicelocator.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/core/services/qservicelocator.cpp b/src/core/services/qservicelocator.cpp index 8ceb3879e..4015f123b 100644 --- a/src/core/services/qservicelocator.cpp +++ b/src/core/services/qservicelocator.cpp @@ -37,6 +37,7 @@ #include "qservicelocator.h" #include "qabstractserviceprovider_p.h" #include "nullservices_p.h" +#include "qtickclockservice.h" #include <QHash> QT_BEGIN_NAMESPACE @@ -86,6 +87,7 @@ public: NullSystemInformationService m_nullSystemInfo; NullOpenGLInformationService m_nullOpenGLInfo; + QTickClockService m_defaultFrameAdvanceService; int m_nonNullDefaultServices; }; @@ -195,6 +197,17 @@ QOpenGLInformationService *QServiceLocator::openGLInformation() } /*! + Returns a pointer to a provider for the frame advance service. If no provider + has been explicitly registered for this service type, then a pointer to a simple timer-based + service is returned. +*/ +QAbstractFrameAdvanceService *QServiceLocator::frameAdvanceService() +{ + Q_D(QServiceLocator); + return static_cast<QAbstractFrameAdvanceService *>(d->m_services.value(FrameAdvanceService, &d->m_defaultFrameAdvanceService)); +} + +/*! \internal */ QAbstractServiceProvider *QServiceLocator::_q_getServiceHelper(int type) @@ -205,6 +218,8 @@ QAbstractServiceProvider *QServiceLocator::_q_getServiceHelper(int type) return systemInformation(); case OpenGLInformation: return openGLInformation(); + case FrameAdvanceService: + return frameAdvanceService(); default: return d->m_services.value(type, Q_NULLPTR); } |