[Solved] Error in QStandardItemModel.appendRow
-
Dear all,
I use following code to appendRow List of QStandardItem, but only first row of data is appended.
I can't find out what's wrong with that code.
Plz help me..@QList<QStandardItem*> items;
item1 = new QStandardItem("text1");
item2 = new QStandardItem("text2");
item3 = new QStandardItem("text3");items.append(item1);
items.append(item2);
items.append(item3);QStandardItemModel.appendRow(items);@
Debug:
items.count is 3
QStandardItemModel.rowCount is 1Thanks
-
Isn't it more logical to do for each item in items appendrow(item)?
-
Thanks for your advice.
Firstly, I try to add item for each items with appendRow(item) method but very bad & slow performance.
I would like to know that can I speed up by adding items to List & set them to a model.So, I try with appendRow(items) method.
Thanks
-
Documentation for appendRow() clearly states that it "Appends a row containing items. If necessary, the column count is increased to the size of items." So what you get is one row with three columns.
To do what you want to do, use appendColumn() instead.