[Qt-interest] Qt Complex Data structure (user defined classes with QMap)
Thiago Macieira
thiago at kde.org
Mon Apr 4 23:53:09 CEST 2011
On Monday, 4 de April de 2011 23:22:16 yogesh upreti wrote:
> QMap<QString, QList<int> > *warning; //warning as pointer
> };
>
> then I can't access value at variable "warning" it as :
>
> SettingsClass *set;
> set->warning["some text"]; // this line throws error
>
> Do you know how do I access it in that case???
Remove the * part and the comment. You don't need a pointer there.
Treat the Qt container and tool classes like you would treat an int. You don't
write this:
int *i = new int(42);
So please don't use pointers to QMap.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Senior Product Manager - Nokia, Qt Development Frameworks
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110404/182d38e5/attachment.bin
More information about the Qt-interest-old
mailing list