[Qt-interest] QVector with a custom type
Stephen Jackson
spjackson42 at gmail.com
Wed Jul 22 18:58:34 CEST 2009
On Wed, Jul 22, 2009 at 10:14 AM, OS Prog wrote:
> ... that's a simple source that demonstrate the problem...
>
As explained by Julien Cugnière,
Q_DECLARE_TYPEINFO(regdata_t, Q_PRIMITIVE_TYPE);
this is what causes your crash. Removing this line from mainwindow.h fixes it.
Unrelated to your crash, do you have some reason for calling data()
all the time? The following is far simpler.
rdata.resize(1);
rdata[0].RegAddress = 1;
rdata[0].RegData.resize(1);
rdata[0].RegData.data()[0] = 1; //1 register to read
HTH,
Stephen Jackson
More information about the Qt-interest-old
mailing list