[Qt-interest] QPointer usage
Patric
userqt at gmail.com
Sun Aug 30 14:20:57 CEST 2009
Ah, yes...
That's a problem.
Thank you Prashanth
----- Original Message -----
From: Prashanth Udupa
To: Patric ; qt-interest at trolltech.com
Sent: Sunday, August 30, 2009 3:18 PM
Subject: Re: [Qt-interest] QPointer usage
Hi,
As the documentation says QPointer can only be used with subclasses of QObject, which QString is not.
HTH.
/ Prashanth
------------------------------------------------------------------------------
From: Patric <userqt at gmail.com>
To: qt-interest at trolltech.com
Sent: Sunday, August 30, 2009 4:35:54 PM
Subject: [Qt-interest] QPointer usage
Hello,
I'm trying to assign a normal pointer to QPointer instance. But there is an error
c:/Qt/2009.03/qt/include/QtCore/../../src/corelib/kernel/qpointer.h: In member function `QPointer<T>& QPointer<T>::operator=(T*) [with T = QString]':
main.cpp:16: instantiated from here
c:/Qt/2009.03/qt/include/QtCore/../../src/corelib/kernel/qpointer.h:68: error: comparison between distinct pointer types `QObject*' and `QString*' lacks a cast
c:/Qt/2009.03/qt/include/QtCore/../../src/corelib/kernel/qpointer.h:68: error: no matching function for call to `QMetaObject::changeGuard(QObject**, QString*&)'
c:/Qt/2009.03/qt/include/QtCore/../../src/corelib/kernel/qobjectdefs.h:340: note: candidates are: static void QMetaObject::changeGuard(QObject**, QObject*)
Here is the code
QString *string = new QString();
QPointer<QString> pointer;
pointer = string;
Why it's not working ?
Regards,
Patric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090830/28b360b8/attachment.html
More information about the Qt-interest-old
mailing list