On Friday 02 March 2012 10:27:56 Thiago Macieira wrote:
Hello
QPointer was ported to a QWeakPointer backend and deprecated early in Qt 5
history. However, QPointer is used throughout our code and, I can expect, in
user code too. Replacing it with QWeakPointer is just monkey work, adding
.data() everywhere and buying us no better safety (because no one will
bother to verify that the pointer could be got at that point). After the
port to QWeakPointer, QPointer is no longer slow either.
I'd like to suggest we un-deprecate it and bring it back to full status.
I agree.
I have been trying to compile qtbase without the deprecated symbols, and two
issues remains that i could not solve: QPointer, and QWheelEvent's deprecated
member.
For QPointer, the task is indeed to big and I think it is best not to
deprecate it.
The alternative would be to add operator- and operator T* to QWeakPointer,
which would allow do do simply s/QPointer/QWeakPointer/g
I personaly beleive this would actually be the best option.
At the same time, I'd like to suggest we discourage using QWeakPointer for
tracking QObjects, instead leaving it to its original purpose of being the
weak reference counterpart to QSharedPointer.
Indeed, we should not have two class with the same purpose. So if QPointer
stays, QWeakPointer have to leave.
I'm not going as far as suggesting we deprecate the QWeakPointer(QObject*)
constructor yet. I need to do a bit of research on how a future
QSharedPointer QWeakPointer with full enable_shared_from_this and
QObject tracking would look like.
One problem: QPointer use QWeakPointer inline, meaning it can hardly be done
without QWeakPointer in the future.
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development