Caching QVariant of the column to accelerate the QTreeView.

This commit is contained in:
Jean-Paul Chaput 2010-03-09 14:19:23 +00:00
parent 4449b76213
commit b7adc4db52
2 changed files with 7 additions and 3 deletions

View File

@ -116,8 +116,8 @@ namespace Hurricane {
QVariant SimpleNetInformations::getColumn ( int column ) QVariant SimpleNetInformations::getColumn ( int column )
{ {
switch ( column ) { switch ( column ) {
case 0: return QVariant(getString(getName()).c_str()); case 0: return _columnNet;
case 1: return QVariant((unsigned int)getPlugsCount()); case 1: return _columnPlug;
} }
return QVariant(QObject::tr("Column Out of Bound")); return QVariant(QObject::tr("Column Out of Bound"));
} }
@ -125,7 +125,9 @@ namespace Hurricane {
SimpleNetInformations::SimpleNetInformations ( const Net* net ) SimpleNetInformations::SimpleNetInformations ( const Net* net )
: NetInformations(net) : NetInformations(net)
, _plugsCount(_net->getPlugs().getSize()) , _plugsCount (_net->getPlugs().getSize())
, _columnNet (getString(getName()).c_str())
, _columnPlug ((unsigned int)_plugsCount)
{ } { }

View File

@ -109,6 +109,8 @@ namespace Hurricane {
protected: protected:
size_t _plugsCount; size_t _plugsCount;
QVariant _columnNet;
QVariant _columnPlug;
}; };