QListWidget performace
-
[quote author="mlong" date="1354218238"]Perhaps you would have better luck with a QListView, rather than a QListWidget.
[/quote]I switchet to QlistView and I used this model class
@
#ifndef NETWORK_TESTS_RESULT_MODEL_H
#define NETWORK_TESTS_RESULT_MODEL_H#include <QAbstractListModel>
class QMimeData;
class resultListModel : public QAbstractListModel
{
Q_OBJECTpublic:
resultListModel(QObject *parent = 0);
~resultListModel();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();
private:
QPixmap *IdIcon;
QList<QString> *postationNames;
QList<QString> *hardwareIds;
QList<QPixmap> *hardwareImages;
QList<QString> *hardwareNames;
QList<QString> *results;
};#endif // NETWORK_TESTS_RESULT_MODEL_H
@
unfortunately there is no improvements on performancenow 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).