[Qt-interest] QPointer usage

Patric userqt at gmail.com
Sun Aug 30 13:05:54 CEST 2009


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/64dff852/attachment.html 


More information about the Qt-interest-old mailing list