
Originally Posted by
wysota
What does refreshData() do?
This method makes async request to apache using QHttp.
// QHttp http;
TxTableModel
::TxTableModel(QObject *parent
) :{
connect(&http, SIGNAL(done(bool)), this, SLOT(httpDone(bool)));
connect(timer, SIGNAL(timeout()), this, SLOT(timerDone()));
timer->start(1000);
}
// QHttp http;
TxTableModel::TxTableModel(QObject *parent) :
QAbstractTableModel(parent)
{
timer = new QTimer(this);
connect(&http, SIGNAL(done(bool)), this, SLOT(httpDone(bool)));
connect(timer, SIGNAL(timeout()), this, SLOT(timerDone()));
timer->start(1000);
}
To copy to clipboard, switch view to plain text mode
Read more carefully documentation of QAbstractTableModel and QAbstractItemModel!
see QAbstractItemModel::beginInsertRows, QAbstractItemModel::beginRemoveColumns and so on
I get every time a new XML. New and deleted rows can be both at the beginning and at the end or the middle of the document. If I want to use QAbstractItemModel::beginInsertColumns and QAbstractItemModel::beginRemoveRows, should I remove all old rows and then insert all new rows?
Also, I think I can compare the rows and add or remove the necessary ones without clearing the entire table.
Is there another way to insert and remove these lines?
I ask this because I used a similar approach (remove all old rows, add all new rows) in working with wxWidgets. It was very slow, so I decided to switch to Qt.
Bookmarks