What is the proper way to update lots of QStandardItem?
-
I have a QStandardItemModel and have a lot of items. The Items may changed their Text frequently.
I use perf to find out the bottleneck of my task. And found that QStandardItem::row() cost above 80% cpu cycle. After add some workaround to skip the calling of QStandardItem::row(), I found QStandardItem::setText() cost above 80% cpu now.
Both row() and setText() are finally calling QStandardItemPrivate::position(), which is the real expensive function.I can move row() to another thread, but is it safe to call setText() in another thread?
-
I have a QStandardItemModel and have a lot of items. The Items may changed their Text frequently.
I use perf to find out the bottleneck of my task. And found that QStandardItem::row() cost above 80% cpu cycle. After add some workaround to skip the calling of QStandardItem::row(), I found QStandardItem::setText() cost above 80% cpu now.
Both row() and setText() are finally calling QStandardItemPrivate::position(), which is the real expensive function.I can move row() to another thread, but is it safe to call setText() in another thread?
-
In addition what @jsulm said, from where the data is coming ? Is it user entering it or some back end process updates it ? What is the size of your model ? How many rows & cols ?