[closed] How to fill QList with struct data more elegant
Hi,
I have a QList with a custom data type. All I found on filling the list looked like this:
Code:
customStruct newStruct;
newStruct.prperty1 = xy;
newStruct.prperty2 = xy;
newStruct.prperty3 = xy;
[...]
newStruct.prpertyN = xy;
list.append(newStruct);
Is there a more elegant way to do that? So that everything is on one line or maybe two? Or does one line only work if I create a new class?
Re: [open] How to fill QList with struct data more elegant
You can add a constructor to customStruct to that you can write
Code:
list.append(customStruct(......));
Cheers,
_
Re: [open] How to fill QList with struct data more elegant
Okay, I thought I had tried that...
Never the less I already switched to a class. Maybe I will add a signal as well.