[Interest] How can I use QPointer as an argument?

Constantin Makshin cmakshin at gmail.com
Tue Jan 13 05:41:44 CET 2015


QPointer is a template class and therefore can't be used by itself, i.e.
without specifying the template parameter.

In your case you should either:
1) specify a particular QObject-related class in the
declaration/definition of myFunction(), e.g.
   void myFunction (QPointer<QWidget>* myPointer)
   {
       // do something
   }
2) define myFunction() as a template function, e.g.
   template <class T>
   void myFunction (QPointer<T>* myPointer)
   {
       // do something
   }

On 01/13/2015 06:13 AM, Guenther Boelter wrote:
> 
> Sorrry,
> 
> I have a 'small' problem and my timeline is running so fast ...
> 
> How can I use QPointer as an argument? A simple
> 
> 
> void myFunction( QPointer *myPointer )
> {
>     // do something
> }
> 
> myFunction( myPointer );
> 
> 
> returns 'error: ‘QPointer’ is not a type'.
> 
> 
> Thanks in advance and best regards
> 
> Guenther

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150113/98b49f85/attachment.sig>


More information about the Interest mailing list