knobby67
16th August 2014, 11:41
Hi ll
I've been trying to send multiple items to a table row at once but with little success.
First I tried
QStandardItem *item = new QStandardItem( QString( "hello" ), QString( "world" ) );
model.setItem( 0,0, item);
this just gives an error.
Next I tried
QStandardItem *item = new QStandardItem( QString( "hello" ) );
model.setItem( 0,0, item);
item->appendRow( new QStandardItem( "Wold" ) );
(with or with out this line) model.setItem( 0,1, item);
that just puts hello in position 0,0. No world in 1,0.
I can get it to work by doing
QStandardItem *item = new QStandardItem( QString( "hello" ) );
model.setItem( 0,0, item);
QStandardItem *item2 = new QStandardItem( "Wold" ) );
model.setItem( 0,1, item2);
Is there anyway where I can send a list of items to each contiguous column along the row.
I think I'm missing something obvious :D.
Thanks in advance
I've been trying to send multiple items to a table row at once but with little success.
First I tried
QStandardItem *item = new QStandardItem( QString( "hello" ), QString( "world" ) );
model.setItem( 0,0, item);
this just gives an error.
Next I tried
QStandardItem *item = new QStandardItem( QString( "hello" ) );
model.setItem( 0,0, item);
item->appendRow( new QStandardItem( "Wold" ) );
(with or with out this line) model.setItem( 0,1, item);
that just puts hello in position 0,0. No world in 1,0.
I can get it to work by doing
QStandardItem *item = new QStandardItem( QString( "hello" ) );
model.setItem( 0,0, item);
QStandardItem *item2 = new QStandardItem( "Wold" ) );
model.setItem( 0,1, item2);
Is there anyway where I can send a list of items to each contiguous column along the row.
I think I'm missing something obvious :D.
Thanks in advance