[Interest] QSharedpointer members are not accessible: isNull and data

Thiago Macieira thiago.macieira at intel.com
Fri Oct 23 21:29:56 CEST 2020

On Friday, 23 October 2020 05:16:08 PDT Tamás Nagy wrote:
>     QSharedPointer<QValidator> m_Validator;
> }
> My custom program:
>  if(di.Validator()->isNull())

Are you sure -> is the right operator here?

You didn't give us the implementation of this Validator function, so we have 
to guess. If it is:

    QSharedPointer &Validator() { return m_validator; }

Then -> is wrong. The type returned by -> is QValidator and that one has no 
isNull() method.

If it is

    QSharedPointer *Validator() { return &m_validator; }

Then -> would be correct but then there's a further problem in your code, 
where you use validator.data().

Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering

More information about the Interest mailing list