[Qt-interest] QVector with a custom type

OS Prog osprog at gmail.com
Wed Jul 22 10:37:52 CEST 2009


Hi,
I try to use QVector with a custom type:

*typedef struct
{
    quint32 RegAddress;
    QVector<quint32> RegData;
}regdata_t;

Q_DECLARE_TYPEINFO(regdata_t, Q_PRIMITIVE_TYPE);*


*QVector<regdata_t> rdata; *<-- declared in the steck

when I resize "RegData" to 1 and assign a value:

*    rdata.resize(1);
    rdata.data()[0].RegAddress = DEVID;
    rdata.data()[0].RegData.resize(1);
    rdata.data()[0].RegData.data()[0] = 1; <---*

the programm crashes:

*Unhandled exception at 0x0042e6d1 in testusb.exe: 0xC0000005: Access
violation reading location 0x00000004.
*
Regards,
Nikolay*
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090722/af031b69/attachment.html 


More information about the Qt-interest-old mailing list