I need to clear and repopulate this widget many times
there is a noticeable performance degradation of addItem method after some clear calls
a perfectly normal working, no problem
-Perhaps you would have better luck with a QListView, rather than a QListWidget.-
[Edit: On second thought, maybe not.]
disable updates while clearing and repopulating. See setUpdatesEnabled
[quote author="mlong" date="1354218238"]Perhaps you would have better luck with a QListView, rather than a QListWidget.
I switchet to QlistView and I used this model class
class resultListModel : public QAbstractListModel
resultListModel(QObject *parent = 0);
void addResult(const QString &postation); bool setData(const QModelIndex &index, const QVariant &val,int role); QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; bool removeRows(int row, int count, const QModelIndex &parent); int rowCount(const QModelIndex &parent) const; void clear();
#endif // NETWORK_TESTS_RESULT_MODEL_H
unfortunately there is no improvements on performance
now I'm trying to use setUpdatesEnabled
thanks for help
Using Qts Model-View-Classes for performance improvement usually requires you to write your own data model which takes into account the nature of your data to get the performance improvement. Sometimes you'll even want to write your own views. Of course, that's a non-trivial task. But if using off-the-shelf model-view components (especially Qts), you generally degrade performance (with the benefit of more flexibility and possibly a less entangled application design compared to the non-mvc approach).
I agree with DerManu.
thanks for replys Qt is a great work.
I changed strategy and now all works fine