Tidy up and expand QSharedPointer documentation.
Also adds the 5.4.0 changes file. Change-Id: I10967ca179b91229e7d1ee0fc666bbd8dbe54425 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
7021188778
commit
b398515b09
26
dist/changes-5.4.0
vendored
Normal file
26
dist/changes-5.4.0
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
Qt 5.4 introduces many new features and improvements as well as bugfixes
|
||||||
|
over the 5.3.x series. For more details, refer to the online documentation
|
||||||
|
included in this distribution. The documentation is also available online:
|
||||||
|
|
||||||
|
http://qt-project.org/doc/qt-5.4
|
||||||
|
|
||||||
|
The Qt version 5.4 series is binary compatible with the 5.3.x series.
|
||||||
|
Applications compiled for 5.3 will continue to run with 5.4.
|
||||||
|
|
||||||
|
Some of the changes listed in this file include issue tracking numbers
|
||||||
|
corresponding to tasks in the Qt Bug Tracker:
|
||||||
|
|
||||||
|
http://bugreports.qt-project.org/
|
||||||
|
|
||||||
|
Each of these identifiers can be entered in the bug tracker to obtain more
|
||||||
|
information about a particular change.
|
||||||
|
|
||||||
|
****************************************************************************
|
||||||
|
* Library *
|
||||||
|
****************************************************************************
|
||||||
|
|
||||||
|
QtCore
|
||||||
|
------
|
||||||
|
|
||||||
|
- Added QEnableSharedFromThis, a class that allows obtaining a
|
||||||
|
QSharedPointer for an object already managed by a shared pointer.
|
@ -374,12 +374,12 @@
|
|||||||
/*!
|
/*!
|
||||||
\class QEnableSharedFromThis
|
\class QEnableSharedFromThis
|
||||||
\inmodule QtCore
|
\inmodule QtCore
|
||||||
\brief A base class that allows to obtain a QSharedPointer for an object already managed by a shared pointer
|
\brief A base class that allows obtaining a QSharedPointer for an object already managed by a shared pointer
|
||||||
\since 5.4
|
\since 5.4
|
||||||
|
|
||||||
You can inherit this class when you need to create a QSharedPointer
|
You can inherit this class when you need to create a QSharedPointer
|
||||||
from any instance of a class -- for instance, from within the
|
from any instance of a class; for instance, from within the
|
||||||
object itself. The key point is that the "obvious" technique of
|
object itself. The key point is that the technique of
|
||||||
just returning QSharedPointer<T>(this) can not be used, because
|
just returning QSharedPointer<T>(this) can not be used, because
|
||||||
this winds up creating multiple distinct QSharedPointer objects
|
this winds up creating multiple distinct QSharedPointer objects
|
||||||
with separate reference counts. For this reason you must never
|
with separate reference counts. For this reason you must never
|
||||||
@ -406,6 +406,27 @@
|
|||||||
Q_ASSERT(p == y); // p and q must share ownership
|
Q_ASSERT(p == y); // p and q must share ownership
|
||||||
}
|
}
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
|
It is also possible to get a shared pointer from an object outside of
|
||||||
|
the class itself. This is especially useful in code that provides an
|
||||||
|
interface to scripts, where it is currently not possible to use shared
|
||||||
|
pointers. For example:
|
||||||
|
|
||||||
|
\code
|
||||||
|
class ScriptInterface : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
// ...
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void slotCalledByScript(Y *managedBySharedPointer)
|
||||||
|
{
|
||||||
|
QSharedPointer<Y> yPtr = managedBySharedPointer->sharedFromThis();
|
||||||
|
// Some other code unrelated to scripts that expects a QSharedPointer<Y> ...
|
||||||
|
}
|
||||||
|
};
|
||||||
|
\endcode
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
Loading…
Reference in New Issue
Block a user