QVector<mystruct> access
-
my mainwindows.h ..
typedef struct{ int a[12] = {} QString b[12] = {} int a1[12] = {} QString b1[12] = {} } mystruct
my mainwindows.cpp ...
QVector<mystruct *> mys(10); ..... /* insert data in struct for 10 Qvec */ void Mainwindow::call(){ int babe = mys[1]->a[2].value(); }
these is admitted or there are a best solution for? I need to have a QVector of container with an array of some mixed var type (int, qstring, double) ..... so think to declare a struct with array value .... but maybe not well done ... not experience on these things ...
regards
-
@jsulm just re-edit the question .... thanks .... so you think about QVector<Qvector<mystruct>> mst; ?? without array on struct? or in mainwindows.h ...
typedef struct{ int a; QString b; int a1; QString b1; } mystruct
than ..
QVector<QVector<mystruct >> mys(10); ..... /* insert data in struct for 10 Qvec */ void Mainwindow::call(){ int babe = mys[1].[2]a.value();
you means these? Is well write?
@gfxx said in QVector<mystruct> access:
you means these?
No, I did not mean this.
What I mean is simply:QVector<mystruct> mys(10);
-
my mainwindows.h ..
typedef struct{ int a[12] = {} QString b[12] = {} int a1[12] = {} QString b1[12] = {} } mystruct
my mainwindows.cpp ...
QVector<mystruct *> mys(10); ..... /* insert data in struct for 10 Qvec */ void Mainwindow::call(){ int babe = mys[1]->a[2].value(); }
these is admitted or there are a best solution for? I need to have a QVector of container with an array of some mixed var type (int, qstring, double) ..... so think to declare a struct with array value .... but maybe not well done ... not experience on these things ...
regards
@gfxx said in QVector<mystruct> access:
these is admitted or there are a best solution for?
I don't understand the question. Can you explain?
You could also store mystruct directly in the vector instead of pointers. -
@gfxx said in QVector<mystruct> access:
these is admitted or there are a best solution for?
I don't understand the question. Can you explain?
You could also store mystruct directly in the vector instead of pointers.@jsulm just re-edit the question .... thanks .... so you think about QVector<Qvector<mystruct>> mst; ?? without array on struct? or in mainwindows.h ...
typedef struct{ int a; QString b; int a1; QString b1; } mystruct
than ..
QVector<QVector<mystruct >> mys(10); ..... /* insert data in struct for 10 Qvec */ void Mainwindow::call(){ int babe = mys[1].[2]a.value();
you means these? Is well write?
-
@jsulm just re-edit the question .... thanks .... so you think about QVector<Qvector<mystruct>> mst; ?? without array on struct? or in mainwindows.h ...
typedef struct{ int a; QString b; int a1; QString b1; } mystruct
than ..
QVector<QVector<mystruct >> mys(10); ..... /* insert data in struct for 10 Qvec */ void Mainwindow::call(){ int babe = mys[1].[2]a.value();
you means these? Is well write?
@gfxx said in QVector<mystruct> access:
you means these?
No, I did not mean this.
What I mean is simply:QVector<mystruct> mys(10);
-
G gfxx has marked this topic as solved on