From b7adc4db524a6f2f03a26c48bb54f6cac383ec03 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Tue, 9 Mar 2010 14:19:23 +0000 Subject: [PATCH] Caching QVariant of the column to accelerate the QTreeView. --- hurricane/src/hviewer/NetInformations.cpp | 8 +++++--- hurricane/src/hviewer/hurricane/viewer/NetInformations.h | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/hurricane/src/hviewer/NetInformations.cpp b/hurricane/src/hviewer/NetInformations.cpp index 62041ff3..750a8557 100644 --- a/hurricane/src/hviewer/NetInformations.cpp +++ b/hurricane/src/hviewer/NetInformations.cpp @@ -116,8 +116,8 @@ namespace Hurricane { QVariant SimpleNetInformations::getColumn ( int column ) { switch ( column ) { - case 0: return QVariant(getString(getName()).c_str()); - case 1: return QVariant((unsigned int)getPlugsCount()); + case 0: return _columnNet; + case 1: return _columnPlug; } return QVariant(QObject::tr("Column Out of Bound")); } @@ -125,7 +125,9 @@ namespace Hurricane { SimpleNetInformations::SimpleNetInformations ( const Net* net ) : NetInformations(net) - , _plugsCount(_net->getPlugs().getSize()) + , _plugsCount (_net->getPlugs().getSize()) + , _columnNet (getString(getName()).c_str()) + , _columnPlug ((unsigned int)_plugsCount) { } diff --git a/hurricane/src/hviewer/hurricane/viewer/NetInformations.h b/hurricane/src/hviewer/hurricane/viewer/NetInformations.h index a4ba1391..b12ed551 100644 --- a/hurricane/src/hviewer/hurricane/viewer/NetInformations.h +++ b/hurricane/src/hviewer/hurricane/viewer/NetInformations.h @@ -109,6 +109,8 @@ namespace Hurricane { protected: size_t _plugsCount; + QVariant _columnNet; + QVariant _columnPlug; };