PDA

View Full Version : inserting rows performance with custom widget



migel
7th September 2011, 09:54
How to improve loading data, inserting list items with custom widget using setIndexWidget(). The speed is terrible slow, without widget inserts much faster. The widget is a QLabel, which I need it to make a text as a hyper link.


QLabel *link = new QLabel(this);
connect(link , SIGNAL(linkActivated(QString)), this, SLOT(openLink(QString)));
nameLink->setText("<html><a href='"+fileID+"'><font color='#616E7F'>"+text+"</font></a></html>");

QStandardItem *item = new QStandardItem;
nameItem->setData(name, ListView::SORTBYFILEDATE);
nameItem->setData(linkID, ListView::LINKID);

model()->setItem(row, col, item);
setIndexWidget(nameItem->index(),link);

inserting about 20 items takes about a second

How QML about adding QML widget there ?
Thanks

wysota
7th September 2011, 18:04
Don't use widgets. Implement a proper item delegate.