Commit 5726f1fe authored by Jonathan Marten's avatar Jonathan Marten
Browse files

Port deprecated QFontMetrics::width() -> horizontalAdvance()

parent 16a4f1e5
......@@ -199,7 +199,7 @@ void K3b::TitleLabel::updatePositioning()
d->subTitleBaseLine = d->titleBaseLine;
d->subTitleLength = ( d->subTitle.isEmpty() ? 0 : subTitleFm.width( d->subTitle ) );
d->subTitleLength = ( d->subTitle.isEmpty() ? 0 : subTitleFm.horizontalAdvance( d->subTitle ) );
// cut the text to window width
d->displayTitle = d->title;
......@@ -223,8 +223,8 @@ void K3b::TitleLabel::updatePositioning()
d->displaySubTitle = subTitleFm.elidedText( d->subTitle, Qt::ElideRight, widthAvail/2 );
}
d->displayTitleLength = titleFm.width( d->displayTitle );
d->displaySubTitleLength = subTitleFm.width( d->displaySubTitle );
d->displayTitleLength = titleFm.horizontalAdvance( d->displayTitle );
d->displaySubTitleLength = subTitleFm.horizontalAdvance( d->displaySubTitle );
//
......@@ -243,7 +243,7 @@ void K3b::TitleLabel::updatePositioning()
cutSubTitle += "...";
}
d->cachedMinimumWidth += titleFm.width( cutTitle ) + subTitleFm.width( cutSubTitle );
d->cachedMinimumWidth += titleFm.horizontalAdvance( cutTitle ) + subTitleFm.horizontalAdvance( cutSubTitle );
if( !d->subTitle.isEmpty() )
d->cachedMinimumWidth += d->spacing;
......
......@@ -106,7 +106,7 @@ QSize K3b::FlatButton::sizeHint() const
{
// height: pixmap + spacing + font height + frame width
// width: max( pixmap, text) + frame width
return QSize( qMax( iconSize().width(), fontMetrics().width( text() ) ) + ( MARGIN_SIZE + FRAME_WIDTH )*2,
return QSize( qMax( iconSize().width(), fontMetrics().horizontalAdvance( text() ) ) + ( MARGIN_SIZE + FRAME_WIDTH )*2,
iconSize().height() + fontMetrics().height() + ICON_LABEL_SPACE + ( MARGIN_SIZE + FRAME_HEIGHT )*2 );
}
......
......@@ -94,7 +94,7 @@ QSize K3b::TimeoutWidget::sizeHint() const
QSize K3b::TimeoutWidget::minimumSizeHint() const
{
int fw = fontMetrics().width( QString::number( d->timeout/1000 ) );
int fw = fontMetrics().horizontalAdvance( QString::number( d->timeout/1000 ) );
int fh = fontMetrics().height();
int diam = qMax( fw, fh ) + 2*d->padding + 2*d->margin;
......
......@@ -173,7 +173,7 @@ QSize K3b::AudioEditorWidget::minimumSizeHint() const
// FIXME: this is still bad for long sources and there might be 60 minutes sources!
int maxWidth = QApplication::desktop()->width()*2/3;
int wantedWidth = 2*d->margin + 2*frameWidth() + (d->length.totalFrames()/75/60 + 1) * fontMetrics().width( "000" );
int wantedWidth = 2*d->margin + 2*frameWidth() + (d->length.totalFrames()/75/60 + 1) * fontMetrics().horizontalAdvance( "000" );
return QSize( qMin( maxWidth, wantedWidth ),
2*d->margin + 12 + 6 /*12 for the tickmarks and 6 for the markers */ + fontMetrics().height() + 2*frameWidth() );
}
......@@ -503,7 +503,7 @@ void K3b::AudioEditorWidget::drawAll( QPainter* p, const QRect& drawRect )
int minute = 1;
int minuteStep = 1;
int markerVPos = drawRect.bottom();
int maxMarkerWidth = fontMetrics().width( QString::number(d->length.minutes()) );
int maxMarkerWidth = fontMetrics().horizontalAdvance( QString::number(d->length.minutes()) );
int minNeededSpace = maxMarkerWidth + 1;
int x = 0;
while( minute*60*75 < d->length ) {
......
......@@ -111,7 +111,7 @@ K3b::DataUrlAddingDialog::DataUrlAddingDialog( DirItem* dir, QWidget* parent )
this, SLOT(slotDirSizeDone(bool)) );
// try to start with a reasonable size
resize( (int)( fontMetrics().width( windowTitle() ) * 1.5 ), sizeHint().height() );
resize( (int)( fontMetrics().horizontalAdvance( windowTitle() ) * 1.5 ), sizeHint().height() );
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment