Remove old count.

This commit is contained in:
Teo Mrnjavac 2016-02-10 17:39:42 +01:00
parent fb4c22c274
commit 61685cec86

View File

@ -208,7 +208,6 @@ PartitionBarsView::drawPartitions( QPainter* painter, const QRect& rect, const Q
PartitionModel* modl = qobject_cast< PartitionModel* >( model() ); PartitionModel* modl = qobject_cast< PartitionModel* >( model() );
if ( !modl ) if ( !modl )
return; return;
const int count = modl->rowCount( parent );
const int totalWidth = rect.width(); const int totalWidth = rect.width();
auto pair = computeItemsVector( parent ); auto pair = computeItemsVector( parent );
@ -219,7 +218,7 @@ PartitionBarsView::drawPartitions( QPainter* painter, const QRect& rect, const Q
{ {
const auto& item = items[ row ]; const auto& item = items[ row ];
int width; int width;
if ( row < count - 1 ) if ( row < items.count() - 1 )
width = totalWidth * ( item.size / total ); width = totalWidth * ( item.size / total );
else else
// Make sure we fill the last pixel column // Make sure we fill the last pixel column
@ -241,7 +240,7 @@ PartitionBarsView::drawPartitions( QPainter* painter, const QRect& rect, const Q
x += width; x += width;
} }
if ( !count && if ( !items.count() &&
!modl->device()->partitionTable() ) // No disklabel or unknown !modl->device()->partitionTable() ) // No disklabel or unknown
{ {
int width = rect.right() - rect.x() + 1; int width = rect.right() - rect.x() + 1;
@ -265,7 +264,6 @@ PartitionBarsView::indexAt( const QPoint &point,
PartitionModel* modl = qobject_cast< PartitionModel* >( model() ); PartitionModel* modl = qobject_cast< PartitionModel* >( model() );
if ( !modl ) if ( !modl )
return QModelIndex(); return QModelIndex();
const int count = modl->rowCount( parent );
const int totalWidth = rect.width(); const int totalWidth = rect.width();
auto pair = computeItemsVector( parent ); auto pair = computeItemsVector( parent );
@ -276,7 +274,7 @@ PartitionBarsView::indexAt( const QPoint &point,
{ {
const auto& item = items[ row ]; const auto& item = items[ row ];
int width; int width;
if ( row < count - 1 ) if ( row < items.count() - 1 )
width = totalWidth * ( item.size / total ); width = totalWidth * ( item.size / total );
else else
// Make sure we fill the last pixel column // Make sure we fill the last pixel column
@ -328,7 +326,6 @@ PartitionBarsView::visualRect( const QModelIndex& index,
PartitionModel* modl = qobject_cast< PartitionModel* >( model() ); PartitionModel* modl = qobject_cast< PartitionModel* >( model() );
if ( !modl ) if ( !modl )
return QRect(); return QRect();
const int count = modl->rowCount( parent );
const int totalWidth = rect.width(); const int totalWidth = rect.width();
auto pair = computeItemsVector( parent ); auto pair = computeItemsVector( parent );
@ -339,7 +336,7 @@ PartitionBarsView::visualRect( const QModelIndex& index,
{ {
const auto& item = items[ row ]; const auto& item = items[ row ];
int width; int width;
if ( row < count - 1 ) if ( row < items.count() - 1 )
width = totalWidth * ( item.size / total ); width = totalWidth * ( item.size / total );
else else
// Make sure we fill the last pixel column // Make sure we fill the last pixel column