|
|
|
@ -136,20 +136,8 @@ PartitionLabelsView::getIndexesToDraw( const QModelIndex& parent ) const
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
PartitionLabelsView::drawLabels( QPainter* painter,
|
|
|
|
|
const QRect& rect,
|
|
|
|
|
const QModelIndex& parent )
|
|
|
|
|
{
|
|
|
|
|
PartitionModel* modl = qobject_cast< PartitionModel* >( model() );
|
|
|
|
|
if ( !modl )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
QModelIndexList indexesToDraw = getIndexesToDraw( parent );
|
|
|
|
|
|
|
|
|
|
int label_x = rect.x();
|
|
|
|
|
int label_y = rect.y();
|
|
|
|
|
foreach ( const QModelIndex& index, indexesToDraw )
|
|
|
|
|
QStringList
|
|
|
|
|
PartitionLabelsView::buildTexts( const QModelIndex& index ) const
|
|
|
|
|
{
|
|
|
|
|
QString firstLine, secondLine;
|
|
|
|
|
|
|
|
|
@ -189,8 +177,26 @@ PartitionLabelsView::drawLabels( QPainter* painter,
|
|
|
|
|
PartitionModel::FileSystemColumn )
|
|
|
|
|
.data().toString() );
|
|
|
|
|
|
|
|
|
|
QStringList texts = { firstLine,
|
|
|
|
|
secondLine };
|
|
|
|
|
return { firstLine, secondLine };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
PartitionLabelsView::drawLabels( QPainter* painter,
|
|
|
|
|
const QRect& rect,
|
|
|
|
|
const QModelIndex& parent )
|
|
|
|
|
{
|
|
|
|
|
PartitionModel* modl = qobject_cast< PartitionModel* >( model() );
|
|
|
|
|
if ( !modl )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
QModelIndexList indexesToDraw = getIndexesToDraw( parent );
|
|
|
|
|
|
|
|
|
|
int label_x = rect.x();
|
|
|
|
|
int label_y = rect.y();
|
|
|
|
|
foreach ( const QModelIndex& index, indexesToDraw )
|
|
|
|
|
{
|
|
|
|
|
QStringList texts = buildTexts( index );
|
|
|
|
|
|
|
|
|
|
QSize labelSize = sizeForLabel( texts );
|
|
|
|
|
|
|
|
|
@ -231,10 +237,8 @@ PartitionLabelsView::sizeForAllLabels( int maxLineWidth ) const
|
|
|
|
|
int singleLabelHeight = 0;
|
|
|
|
|
foreach ( const QModelIndex& index, indexesToDraw )
|
|
|
|
|
{
|
|
|
|
|
QStringList texts = { index.data().toString(),
|
|
|
|
|
index.sibling( index.row(),
|
|
|
|
|
PartitionModel::SizeColumn )
|
|
|
|
|
.data().toString() };
|
|
|
|
|
QStringList texts = buildTexts( index );
|
|
|
|
|
|
|
|
|
|
QSize labelSize = sizeForLabel( texts );
|
|
|
|
|
|
|
|
|
|
if ( lineLength + labelSize.width() > maxLineWidth )
|
|
|
|
|