Anyway of updating a QTableView when model signals turned off?
Hi,
When I block signals on my model which my tableview uses it is so much faster at updating, but it only updates if I click on the tableview ( repaint ). Was wondering if there is a way to update the view without having to do this?
Regards,
Steve
Re: Anyway of updating a QTableView when model signals turned off?
Unblock signals on time and emit layoutChanged() or reset the model. Or better yet - insert all items at once into the model.
Re: Anyway of updating a QTableView when model signals turned off?
Hi,
What do you mean by unblock signals on time? This after something is inserted? Unfortunately, the data in the model is continuously updated, so I guess I can't insert all items at once?
Regards,
Steve
Re: Anyway of updating a QTableView when model signals turned off?
There is no such thing as "continously". You can update the model every second or so with all items gathered through that time. I'm sure your users won't mind a small lag.
Re: Anyway of updating a QTableView when model signals turned off?
Thanks,
I am updating the model every 5 milliseconds, the model is preloaded with data and certain parts of this data is updated ( such as reading signal from a car for the rpm ).
This is the code I have now which is called every 5 milliseconds :
Code:
{
QList<QObject*> *pList = theApp->m_dcb.GetSignalList();
if( pList )
{
for( int i = 0; i < pList->count(); i++ )
{
CDADcb::CSignal* pSignal = (CDADcb::CSignal*)pList->at(i);
// This signal belong to this CAN id, there can be many signals that do
if( pSignal->m_strId == strId )
{
// we need to do the conversion here - TODO
pSignal->m_strRawData = strData;
pSignal->m_nCount++;
}
}
emit layoutChanged();
}
}
Re: Anyway of updating a QTableView when model signals turned off?
Change 5 miliseconds to 500 miliseconds. 5ms i 1/200 of a second - human eye can't distinguish anything that's shorter than 0.05s (50ms). And don't block signals, it's not required in this situation.