Skip to content
Permalink
Browse files

More qt deprecation warning fixes

  • Loading branch information
nyalldawson committed Jan 29, 2020
1 parent ee323eb commit e5593b945e9da55fe57c42623c6d43c1f1811924
@@ -695,7 +695,7 @@ double QgsDecorationGrid::textWidthMillimeters( const QFont &font, const QString
{
QFont metricsFont = scaledFontPixelSize( font );
QFontMetrics fontMetrics( metricsFont );
return ( fontMetrics.width( text ) / FONT_WORKAROUND_SCALE );
return ( fontMetrics.boundingRect( text ).width() / FONT_WORKAROUND_SCALE );
}

double QgsDecorationGrid::fontHeightCharacterMM( const QFont &font, QChar c ) const
@@ -765,7 +765,11 @@ QgsLayoutDesignerDialog::QgsLayoutDesignerDialog( QWidget *parent, Qt::WindowFla
mMenuProvider = new QgsLayoutAppMenuProvider( this );
mView->setMenuProvider( mMenuProvider );

#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
int minDockWidth( fontMetrics().width( QStringLiteral( "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ) ) );
#else
int minDockWidth = fontMetrics().horizontalAdvance( 'X' ) * 38;
#endif

setTabPosition( Qt::AllDockWidgetAreas, QTabWidget::North );
mGeneralDock = new QgsDockWidget( tr( "Layout" ), this );
@@ -245,7 +245,7 @@ void QgsHandleBadLayers::setFilename( int row, const QString &filename )
{
QUrl uriSource = QUrl::fromEncoded( datasource.toLatin1() );
QUrl uriDest = QUrl::fromLocalFile( filename );
uriDest.setQueryItems( uriSource.queryItems() );
uriDest.setQuery( QUrlQuery( uriSource ) );
datasource = QString::fromLatin1( uriDest.toEncoded() );
}
}
@@ -360,7 +360,7 @@ QgsIdentifyResultsDialog::QgsIdentifyResultsDialog( QgsMapCanvas *canvas, QWidge
mExpandNewAction->setChecked( mySettings.value( QStringLiteral( "Map/identifyExpand" ), false ).toBool() );
mActionCopy->setEnabled( false );
lstResults->setColumnCount( 2 );
lstResults->sortByColumn( -1 );
lstResults->sortByColumn( -1, Qt::AscendingOrder );
setColumnText( 0, tr( "Feature" ) );
setColumnText( 1, tr( "Value" ) );

@@ -1355,7 +1355,7 @@ void QgsIdentifyResultsDialog::clear()
}

lstResults->clear();
lstResults->sortByColumn( -1 );
lstResults->sortByColumn( -1, Qt::AscendingOrder );
clearHighlights();

tblResults->clearContents();
@@ -156,15 +156,15 @@ void QgsSourceFieldsProperties::attributeAdded( int idx )
{
case QgsFields::OriginExpression:
if ( i == 7 ) continue;
mFieldsList->item( row, i )->setBackgroundColor( QColor( 200, 200, 255 ) );
mFieldsList->item( row, i )->setBackground( QColor( 200, 200, 255 ) );
break;

case QgsFields::OriginJoin:
mFieldsList->item( row, i )->setBackgroundColor( QColor( 200, 255, 200 ) );
mFieldsList->item( row, i )->setBackground( QColor( 200, 255, 200 ) );
break;

default:
mFieldsList->item( row, i )->setBackgroundColor( QColor( 255, 255, 200 ) );
mFieldsList->item( row, i )->setBackground( QColor( 255, 255, 200 ) );
break;
}
}
@@ -36,7 +36,7 @@ QgsStatusBarCoordinatesWidget::QgsStatusBarCoordinatesWidget( QWidget *parent )
, mMousePrecisionDecimalPlaces( 0 )
{
// calculate the size of two chars
mTwoCharSize = fontMetrics().width( QStringLiteral( "OO" ) );
mTwoCharSize = fontMetrics().boundingRect( 'O' ).width();
mMinimumWidth = mTwoCharSize * 4;

// add a label to show current position
@@ -316,7 +316,7 @@ void QgsStatusBarCoordinatesWidget::ensureCoordinatesVisible()
{

//ensure the label is big (and small) enough
int width = std::max( mLineEdit->fontMetrics().width( mLineEdit->text() ) + 16, mMinimumWidth );
int width = std::max( mLineEdit->fontMetrics().boundingRect( mLineEdit->text() ).width() + 16, mMinimumWidth );
if ( mLineEdit->minimumWidth() < width || ( mLineEdit->minimumWidth() - width ) > mTwoCharSize )
{
mLineEdit->setMinimumWidth( width );
@@ -195,9 +195,9 @@ void QgsUndoWidget::setupUi( QWidget *UndoWidget )

void QgsUndoWidget::retranslateUi( QWidget *UndoWidget )
{
UndoWidget->setWindowTitle( QApplication::translate( "UndoWidget", "Undo/Redo", nullptr, QApplication::UnicodeUTF8 ) );
undoButton->setText( QApplication::translate( "UndoWidget", "Undo", nullptr, QApplication::UnicodeUTF8 ) );
redoButton->setText( QApplication::translate( "UndoWidget", "Redo", nullptr, QApplication::UnicodeUTF8 ) );
UndoWidget->setWindowTitle( QApplication::translate( "UndoWidget", "Undo/Redo" ) );
undoButton->setText( QApplication::translate( "UndoWidget", "Undo" ) );
redoButton->setText( QApplication::translate( "UndoWidget", "Redo" ) );
Q_UNUSED( UndoWidget )
}

@@ -92,9 +92,6 @@
<height>150</height>
</size>
</property>
<property name="tabStopWidth">
<number>10</number>
</property>
</widget>
</item>
<item row="1" column="0">

0 comments on commit e5593b9

Please sign in to comment.
You can’t perform that action at this time.