[Populating a QList of structure]
Solved
Qt 6
-
Hello guys,
I hope you're doing well.So I'm trying to fill a QList of structure with some values of different types.
I defined a QList of structure and used a for loop to fill it:
struct telemetry_data { QString TimeStamp; QQuaternion quaternion_csv; int Time_ms; } telemetry_data ; QList <struct telemetry_data >telemetry; for (int i=0; i<TimeandDate.size();i++) { telemetry.TimeStamp.append(TimeandDate[i]); qDebug()<<"timestamp"<< telemetry.TimeStamp;}
However, I get an error and which is "no member named TimeStamp in 'QList <telemetry_data>'. however it does have a variable called TimeStamp.
But when I try to fill an ARRAY of structure as follows:
struct telemetry_data { QString TimeStamp; QQuaternion quaternion_csv; // int Time_ms; } telemetry_data ; struct telemetry_data telemetry[TimeandDate.size()]; for (int i=0; i<TimeandDate.size();i++) { telemetry[i].TimeStamp.append(TimeandDate[i]); qDebug()<<"timestamp"<< telemetry[i].TimeStamp;}
The array is filled correctly. I don't get any errors.
I still don't get why this error occurs.
Please help me.
Any little help is really appreciated, thank you all.