PDA

View Full Version : tricks to struct needed



baray98
19th February 2008, 05:54
If you have a struct say ..



struct s_A
{
int A
int B
int C
int D
int E
int F
}


if you want to have a gui to edit some or all struct member using a QSpinBox, what is the essiest impementation (less code)?

I Ended up with giving my widget some Id then , use QSignalMapper to put all editingFinished signal of QSpinbox and then figure out whose the sender everytime QSignalMapper emits SIGNAL mapped(), from the Id ill figure out which member of the struct to be updated.

But still this gets vey boring if you have like 50 struct each has like 20 members, If anybody can suggest on some technique inhandling this stuff efficiently will be appereciated

baray98

jpn
19th February 2008, 11:28
I don't know about less code but model-view would be an elegant way to handle it. You don't want to have tons of QSpinBoxes on your form but a view which keeps only one editor open at time.