[Qt-interest] Accessing a class member from an operator
Oliver Heins
heins at sopos.org
Thu Apr 22 19:27:48 CEST 2010
Hi John,
John Weeks <john at wavemetrics.com> writes:
> On Apr 22, 2010, at 10:09 AM, Oliver Heins wrote:
>
>> When compiling, I get an »error: ‘partnerMap’ was not declared in this
>> scope«, even if the operator is a friend of Editor. I don't want to
>> make partnerMap global or static, which feels wrong to me even if I
>> don't think there could be concurrent access to it.
>
> You need an instance of Editor before you can access partnerMap:
>
> Editor * editor();
>
> editor->partnerMap.insert(...);
I call the QDataStream &operator>> within Editor::readFile(). So there
is an instance of Editor when the operator is called.
Regards,
olli
More information about the Qt-interest-old
mailing list