mirror of
https://github.com/OPM/ResInsight.git
synced 2024-12-28 09:51:44 -06:00
Qt6: Fix usage of deprecated QApplication::fontMetrics()
This commit is contained in:
parent
bf1c7f4b04
commit
3797aa8211
@ -79,7 +79,7 @@ QSize QShortenedLabel::minimumSizeHint() const
|
||||
{
|
||||
const int minimumNumberOfCharacters = 10;
|
||||
|
||||
QFontMetrics fontMetrics = QApplication::fontMetrics();
|
||||
QFontMetrics fontMetrics( QApplication::font() );
|
||||
QString fullLabelText = fullText();
|
||||
QString shortenedText = fullLabelText.left( minimumNumberOfCharacters );
|
||||
int minimumWidth = fontMetrics.horizontalAdvance( shortenedText );
|
||||
@ -118,8 +118,8 @@ QSize QShortenedLabel::minimumSizeHint() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QSize QShortenedLabel::sizeHint() const
|
||||
{
|
||||
QFontMetrics fontMetrics = QApplication::fontMetrics();
|
||||
QString labelText = fullText();
|
||||
QFontMetrics fontMetrics( QApplication::font() );
|
||||
QString labelText = fullText();
|
||||
|
||||
QStringList labelLines = labelText.split( "\n" );
|
||||
int maxLineWidth = 0;
|
||||
@ -147,8 +147,8 @@ void QShortenedLabel::resizeEvent( QResizeEvent* event )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void caf::QShortenedLabel::resizeText( QSize paintSize )
|
||||
{
|
||||
QString labelText = fullText();
|
||||
QFontMetrics fontMetrics = QApplication::fontMetrics();
|
||||
QString labelText = fullText();
|
||||
QFontMetrics fontMetrics( QApplication::font() );
|
||||
|
||||
QStringList labelLines = labelText.split( "\n" );
|
||||
int maxLineWidth = 0;
|
||||
|
@ -153,7 +153,7 @@ QWidget* PdmUiColorEditor::createEditorWidget( QWidget* parent )
|
||||
m_colorPreviewLabel->setText( QLatin1String( "..." ) );
|
||||
m_colorPreviewLabel->setAlignment( Qt::AlignCenter );
|
||||
|
||||
QFontMetrics fontMetrics = QApplication::fontMetrics();
|
||||
QFontMetrics fontMetrics( QApplication::font() );
|
||||
|
||||
buttonLayout->addWidget( m_colorPreviewLabel );
|
||||
m_colorSelectionButton->setMinimumWidth( fontMetrics.boundingRect( m_colorPreviewLabel->text() ).width() + 15 );
|
||||
|
Loading…
Reference in New Issue
Block a user