mismael85
19th January 2011, 23:56
Hello every body,
I am using QAbstractTableModel to represent more than 4000,000 record, when I scroll down the view to the end the application size is increased in the memory from 50 MB to 111 MB.
QVariant SearchModel::data(const QModelIndex &index, int role) const
{
if(!index.isValid())
return QVariant();
switch(role)
{
case Qt::DisplayRole:
{
switch(index.column())
{
case 0: // serial
{
return index.row()+1;
}
break;
case 1: // text
{
return m_pSearchEngine->getHighlightedText(index.row(), false);
}
break;
case 2: // book name
{
return m_pSearchEngine->getBookName(index.row());
}
break;
case 3:
{
return m_pSearchEngine->getTitle(index.row());
}
break;
case 4: // part no
return m_pSearchEngine->getPartNo(index.row());
break;
case 5: // page no
return m_pSearchEngine->getPageNo(index.row());
break;
}
}
break;
}
return QVariant();
}
I examined the functions I used it just return strings.
How can I decrease the amount of memory that the model take?
Thank you
I am using QAbstractTableModel to represent more than 4000,000 record, when I scroll down the view to the end the application size is increased in the memory from 50 MB to 111 MB.
QVariant SearchModel::data(const QModelIndex &index, int role) const
{
if(!index.isValid())
return QVariant();
switch(role)
{
case Qt::DisplayRole:
{
switch(index.column())
{
case 0: // serial
{
return index.row()+1;
}
break;
case 1: // text
{
return m_pSearchEngine->getHighlightedText(index.row(), false);
}
break;
case 2: // book name
{
return m_pSearchEngine->getBookName(index.row());
}
break;
case 3:
{
return m_pSearchEngine->getTitle(index.row());
}
break;
case 4: // part no
return m_pSearchEngine->getPartNo(index.row());
break;
case 5: // page no
return m_pSearchEngine->getPageNo(index.row());
break;
}
}
break;
}
return QVariant();
}
I examined the functions I used it just return strings.
How can I decrease the amount of memory that the model take?
Thank you