View Full Version : Slow QStandardItem::setChild

29th April 2014, 09:14

I have QStandardItemModel model.

When I add an item to the invisibleRootItem() of the model with setChild, it takes me arond 200 ms.
When I add an item to an item of the model with setChild, it takes me around 0 ms.

Why is it slow ? How to do it better (because I really want to add items to the invisibleRootItem()) ?


Temporary answer :
I had this effect when I was doing on the item (or on the invisible) a setRowCount and a setColumCount.
I still have something slow...I need to figure out where it is...

30th April 2014, 13:47
The option QHeaderView::setResizeMode of the header of my view set to QHeaderView::ResizeToContents was causing the slow. I removed it.

The QStandardItem::setChild still takes around 13 ms (from 300 ms) (based on a QTime::start and QTime::elapsed around it) which I think is still a lot.

I am producing on a Debian 6.0.6 with Qt 4.6.3.