From 85c1009dbbb73fc9bee5911d70cdd96469ad8270 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 8 Jun 2020 18:51:19 +0200 Subject: [PATCH] QPointer: add get() [ChangeLog][QtCore][QPointer] Added get() for STL compatibility. Change-Id: I84bf9d58cd92e1bc74f731c3e9002031045f8f5c Reviewed-by: Marc Mutz --- src/corelib/kernel/qpointer.cpp | 7 +++++++ src/corelib/kernel/qpointer.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/corelib/kernel/qpointer.cpp b/src/corelib/kernel/qpointer.cpp index 068314633b..5f6826b269 100644 --- a/src/corelib/kernel/qpointer.cpp +++ b/src/corelib/kernel/qpointer.cpp @@ -155,6 +155,13 @@ Returns the pointer to the object being guarded. */ +/*! + \fn template T* QPointer::get() const + \since 6.0 + + Same as data(). This function is provided for STL compatibility. +*/ + /*! \fn template bool QPointer::isNull() const diff --git a/src/corelib/kernel/qpointer.h b/src/corelib/kernel/qpointer.h index 5efdb0b395..769ace5a71 100644 --- a/src/corelib/kernel/qpointer.h +++ b/src/corelib/kernel/qpointer.h @@ -75,6 +75,8 @@ public: inline T* data() const { return static_cast(wp.internalData()); } + inline T* get() const + { return data(); } inline T* operator->() const { return data(); } inline T& operator*() const