Skip to content
Permalink
Browse files

Fix more deprecation warnings

  • Loading branch information
nyalldawson committed Feb 4, 2020
1 parent 692a140 commit 3d3e1a7d32242d075b6690038b1ef113645e5d3b
@@ -34,7 +34,6 @@ class QPushButton;
class QLineEdit;
class QComboBox;
class QMenu;
class QSignalMapper;
class QgsAttributeTableModel;
class QgsAttributeTableFilterModel;
class QgsRubberBand;
@@ -766,9 +766,6 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
QStringList wfstInsertLayerIdList = QgsProject::instance()->readListEntry( QStringLiteral( "WFSTLayers" ), QStringLiteral( "Insert" ) );
QStringList wfstDeleteLayerIdList = QgsProject::instance()->readListEntry( QStringLiteral( "WFSTLayers" ), QStringLiteral( "Delete" ) );

QSignalMapper *smPublied = new QSignalMapper( this );
connect( smPublied, SIGNAL( mapped( int ) ), this, SLOT( cbxWFSPubliedStateChanged( int ) ) );

const QMap<QString, QgsMapLayer *> &mapLayers = QgsProject::instance()->mapLayers();

twWFSLayers->setColumnCount( 6 );
@@ -795,9 +792,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
QCheckBox *cbp = new QCheckBox();
cbp->setChecked( wfsLayerIdList.contains( currentLayer->id() ) );
twWFSLayers->setCellWidget( j, 1, cbp );

smPublied->setMapping( cbp, j );
connect( cbp, SIGNAL( stateChanged( int ) ), smPublied, SLOT( map() ) );
connect( cbp, &QCheckBox::stateChanged, this, [ = ] { cbxWCSPubliedStateChanged( j ); } );

QSpinBox *psb = new QSpinBox();
psb->setValue( QgsProject::instance()->readNumEntry( QStringLiteral( "WFSLayersPrecision" ), "/" + currentLayer->id(), 8 ) );
@@ -833,9 +828,6 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
mWCSUrlLineEdit->setText( QgsProject::instance()->readEntry( QStringLiteral( "WCSUrl" ), QStringLiteral( "/" ), QString() ) );
QStringList wcsLayerIdList = QgsProject::instance()->readListEntry( QStringLiteral( "WCSLayers" ), QStringLiteral( "/" ) );

QSignalMapper *smWcsPublied = new QSignalMapper( this );
connect( smWcsPublied, SIGNAL( mapped( int ) ), this, SLOT( cbxWCSPubliedStateChanged( int ) ) );

twWCSLayers->setColumnCount( 2 );
twWCSLayers->horizontalHeader()->setVisible( true );
twWCSLayers->setRowCount( mapLayers.size() );
@@ -860,8 +852,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
cbp->setChecked( wcsLayerIdList.contains( currentLayer->id() ) );
twWCSLayers->setCellWidget( j, 1, cbp );

smWcsPublied->setMapping( cbp, j );
connect( cbp, SIGNAL( stateChanged( int ) ), smWcsPublied, SLOT( map() ) );
connect( cbp, &QCheckBox::stateChanged, this, [ = ] { cbxWCSPubliedStateChanged( j ); } );

j++;
}
@@ -26,7 +26,6 @@
#include "qgis_gui.h"

class QgsFeatureRequest;
class QSignalMapper;
class QgsMapLayerAction;
class QgsScrollArea;
class QgsFieldConditionalFormatWidget;
@@ -46,7 +46,6 @@ QgsFeatureFilterWidget::QgsFeatureFilterWidget( QWidget *parent )
setupUi( this );

// Initialize filter gui elements
mFilterActionMapper = new QSignalMapper( this );
mFilterColumnsMenu = new QMenu( this );
mActionFilterColumnsMenu->setMenu( mFilterColumnsMenu );
mStoredFilterExpressionMenu = new QMenu( this );
@@ -74,7 +73,6 @@ QgsFeatureFilterWidget::QgsFeatureFilterWidget( QWidget *parent )
connect( mActionSelectedFilter, &QAction::triggered, this, &QgsFeatureFilterWidget::filterSelected );
connect( mActionVisibleFilter, &QAction::triggered, this, &QgsFeatureFilterWidget::filterVisible );
connect( mActionEditedFilter, &QAction::triggered, this, &QgsFeatureFilterWidget::filterEdited );
connect( mFilterActionMapper, SIGNAL( mapped( QObject * ) ), SLOT( filterColumnChanged( QObject * ) ) );
connect( mFilterQuery, &QLineEdit::returnPressed, this, &QgsFeatureFilterWidget::filterQueryAccepted );
connect( mActionApplyFilter, &QAction::triggered, this, &QgsFeatureFilterWidget::filterQueryAccepted );
connect( mFilterQuery, &QLineEdit::textChanged, this, &QgsFeatureFilterWidget::onFilterQueryTextChanged );
@@ -186,7 +184,6 @@ void QgsFeatureFilterWidget::columnBoxInit()
for ( QAction *a : constActions )
{
mFilterColumnsMenu->removeAction( a );
mFilterActionMapper->removeMappings( a );
mFilterButton->removeAction( a );
delete a;
}
@@ -219,8 +216,8 @@ void QgsFeatureFilterWidget::columnBoxInit()
// Generate action for the filter popup button
QAction *filterAction = new QAction( icon, alias, mFilterButton );
filterAction->setData( field.name() );
mFilterActionMapper->setMapping( filterAction, filterAction );
connect( filterAction, SIGNAL( triggered() ), mFilterActionMapper, SLOT( map() ) );

connect( filterAction, &QAction::triggered, this, [ = ] { filterColumnChanged( filterAction ); } );
mFilterColumnsMenu->addAction( filterAction );
}
}
@@ -283,9 +280,9 @@ void QgsFeatureFilterWidget::storeExpressionButtonInit()
}


void QgsFeatureFilterWidget::filterColumnChanged( QObject *filterAction )
void QgsFeatureFilterWidget::filterColumnChanged( QAction *filterAction )
{
mFilterButton->setDefaultAction( qobject_cast<QAction *>( filterAction ) );
mFilterButton->setDefaultAction( filterAction );
mFilterButton->setPopupMode( QToolButton::InstantPopup );
// replace the search line edit with a search widget that is suited to the selected field
// delete previous widget
@@ -114,15 +114,14 @@ class GUI_EXPORT QgsFeatureFilterWidget : public QWidget, private Ui::QgsFeature
*/
void updateCurrentStoredFilterExpression( );

void filterColumnChanged( QObject *filterAction );
void filterColumnChanged( QAction *filterAction );

private:

/* replace the search widget with a new one */
void replaceSearchWidget( QWidget *oldw, QWidget *neww );

QMenu *mFilterColumnsMenu = nullptr;
QSignalMapper *mFilterActionMapper = nullptr;
QMenu *mStoredFilterExpressionMenu = nullptr;
QTimer mFilterQueryTimer;
QgsSearchWidgetWrapper *mCurrentSearchWidgetWrapper = nullptr;
@@ -580,7 +580,7 @@ void QgsAuthCertInfo::populateInfoDetailsSection()
mCurrentACert.subjectInfo().value( QCA::XMPP ),
LineEdit );

QMultiMap<QSsl::AlternateNameEntryType, QString> alts( mCurrentQCert.alternateSubjectNames() );
QMultiMap<QSsl::AlternateNameEntryType, QString> alts( mCurrentQCert.subjectAlternativeNames() );
QStringList altslist;
QString email( tr( "Email: " ) );
QStringList emails( alts.values( QSsl::EmailEntry ) );
@@ -192,7 +192,9 @@ void QgsAuthSslImportDialog::secureConnect()
this, &QgsAuthSslImportDialog::socketReadyRead );
}

mSocket->setCaCertificates( mTrustedCAs );
QSslConfiguration sslConfig = mSocket->sslConfiguration();
sslConfig.setCaCertificates( mTrustedCAs );
mSocket->setSslConfiguration( sslConfig );

if ( !mTimer )
{
@@ -18,7 +18,6 @@

#include <QMenu>
#include "qgis_sip.h"
#include <QSignalMapper>

#include "qgsfeature.h"
#include "qgsaction.h"
@@ -57,7 +57,13 @@ QgsNewNameDialog::QgsNewNameDialog( const QString &source, const QString &initia
QRegExpValidator *validator = new QRegExpValidator( regexp, this );
mLineEdit->setValidator( validator );
}


#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
mLineEdit->setMinimumWidth( mLineEdit->fontMetrics().width( QStringLiteral( "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ) ) );
#else
mLineEdit->setMinimumWidth( mLineEdit->fontMetrics().horizontalAdvance( 'x' ) * 44 );
#endif
connect( mLineEdit, &QLineEdit::textChanged, this, &QgsNewNameDialog::nameChanged );
connect( mLineEdit, &QLineEdit::textChanged, this, &QgsNewNameDialog::newNameChanged );
layout()->addWidget( mLineEdit );
@@ -72,9 +72,19 @@ QgsStyleItemsListWidget::QgsStyleItemsListWidget( QWidget *parent )
btnAdvanced->hide(); // advanced button is hidden by default
btnAdvanced->setMenu( new QMenu( this ) );


#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
double iconSize = Qgis::UI_SCALE_FACTOR * fontMetrics().width( 'X' ) * 10;
#else
double iconSize = Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance( 'X' ) * 10;
#endif
viewSymbols->setIconSize( QSize( static_cast< int >( iconSize ), static_cast< int >( iconSize * 0.9 ) ) ); // ~100, 90 on low dpi

#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
double treeIconSize = Qgis::UI_SCALE_FACTOR * fontMetrics().width( 'X' ) * 2;
#else
double treeIconSize = Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance( 'X' ) * 2;
#endif
mSymbolTreeView->setIconSize( QSize( static_cast< int >( treeIconSize ), static_cast< int >( treeIconSize ) ) );

viewSymbols->setSelectionBehavior( QAbstractItemView::SelectRows );
@@ -550,7 +550,12 @@ void QgsSymbolButton::updatePreview( const QColor &color, QgsSymbol *tempSymbol

// set tooltip
// create very large preview image

#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
int width = static_cast< int >( Qgis::UI_SCALE_FACTOR * fontMetrics().width( 'X' ) * 23 );
#else
int width = static_cast< int >( Qgis::UI_SCALE_FACTOR * fontMetrics().horizontalAdvance( 'X' ) * 23 );
#endif
int height = static_cast< int >( width / 1.61803398875 ); // golden ratio

QPixmap pm = QgsSymbolLayerUtils::symbolPreviewPixmap( previewSymbol.get(), QSize( width, height ), height / 20 );
@@ -46,9 +46,19 @@ QgsTaskManagerWidget::QgsTaskManagerWidget( QgsTaskManager *manager, QWidget *pa
mTreeView->setHeaderHidden( true );
mTreeView->setRootIsDecorated( false );
mTreeView->setSelectionBehavior( QAbstractItemView::SelectRows );

#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
int progressColWidth = static_cast< int >( fontMetrics().width( 'X' ) * 10 * Qgis::UI_SCALE_FACTOR );
#else
int progressColWidth = static_cast< int >( fontMetrics().horizontalAdvance( 'X' ) * 10 * Qgis::UI_SCALE_FACTOR );
#endif
mTreeView->setColumnWidth( QgsTaskManagerModel::Progress, progressColWidth );

#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
int statusColWidth = static_cast< int >( fontMetrics().width( 'X' ) * 2 * Qgis::UI_SCALE_FACTOR );
#else
int statusColWidth = static_cast< int >( fontMetrics().horizontalAdvance( 'X' ) * 2 * Qgis::UI_SCALE_FACTOR );
#endif
mTreeView->setColumnWidth( QgsTaskManagerModel::Status, statusColWidth );
mTreeView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
mTreeView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
@@ -571,7 +581,12 @@ QgsTaskManagerFloatingWidget::QgsTaskManagerFloatingWidget( QgsTaskManager *mana
{
setLayout( new QVBoxLayout() );
QgsTaskManagerWidget *w = new QgsTaskManagerWidget( manager );

#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
int minWidth = static_cast< int >( fontMetrics().width( 'X' ) * 60 * Qgis::UI_SCALE_FACTOR );
#else
int minWidth = static_cast< int >( fontMetrics().horizontalAdvance( 'X' ) * 60 * Qgis::UI_SCALE_FACTOR );
#endif
int minHeight = static_cast< int >( fontMetrics().height() * 15 * Qgis::UI_SCALE_FACTOR );
setMinimumSize( minWidth, minHeight );
layout()->addWidget( w );
@@ -610,7 +625,12 @@ QgsTaskManagerStatusBarWidget::QgsTaskManagerStatusBarWidget( QgsTaskManager *ma

QSize QgsTaskManagerStatusBarWidget::sizeHint() const
{

#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
int width = static_cast< int >( fontMetrics().width( 'X' ) * 20 * Qgis::UI_SCALE_FACTOR );
#else
int width = static_cast< int >( fontMetrics().horizontalAdvance( 'X' ) * 20 * Qgis::UI_SCALE_FACTOR );
#endif
int height = QToolButton::sizeHint().height();
return QSize( width, height );
}
@@ -1157,7 +1157,7 @@ void eVisGenericEventBrowserGui::renderSymbol( QPainter *painter )
QPixmap myTempPixmap( mPointerSymbol.height(), mPointerSymbol.height() );
myTempPixmap.fill( QColor( 255, 255, 255, 0 ) );
QPainter p( &myTempPixmap );
QMatrix wm;
QTransform wm;
wm.translate( myTempPixmap.width() / 2, myTempPixmap.height() / 2 ); // really center

double myBearing = mCompassBearing;
@@ -1183,7 +1183,7 @@ void eVisGenericEventBrowserGui::renderSymbol( QPainter *painter )

wm.rotate( myBearing );

p.setWorldMatrix( wm );
p.setWorldTransform( wm );
p.drawPixmap( -mPointerSymbol.width() / 2, -mPointerSymbol.height() / 2, mPointerSymbol );

int xShift = static_cast<int>( myPoint.x() ) - ( myTempPixmap.width() / 2 );
@@ -106,10 +106,10 @@ QgsGeometryCheckerResultTab::QgsGeometryCheckerResultTab( QgisInterface *iface,
ui.tableWidgetErrors->horizontalHeader()->setSortIndicator( 0, Qt::AscendingOrder );
ui.tableWidgetErrors->resizeColumnToContents( 0 );
ui.tableWidgetErrors->resizeColumnToContents( 1 );
ui.tableWidgetErrors->horizontalHeader()->setResizeMode( 2, QHeaderView::Stretch );
ui.tableWidgetErrors->horizontalHeader()->setResizeMode( 3, QHeaderView::Stretch );
ui.tableWidgetErrors->horizontalHeader()->setResizeMode( 4, QHeaderView::Stretch );
ui.tableWidgetErrors->horizontalHeader()->setResizeMode( 5, QHeaderView::Stretch );
ui.tableWidgetErrors->horizontalHeader()->setSectionResizeMode( 2, QHeaderView::Stretch );
ui.tableWidgetErrors->horizontalHeader()->setSectionResizeMode( 3, QHeaderView::Stretch );
ui.tableWidgetErrors->horizontalHeader()->setSectionResizeMode( 4, QHeaderView::Stretch );
ui.tableWidgetErrors->horizontalHeader()->setSectionResizeMode( 5, QHeaderView::Stretch );
// Not sure why, but this is needed...
ui.tableWidgetErrors->setSortingEnabled( true );
ui.tableWidgetErrors->setSortingEnabled( false );
@@ -115,7 +115,7 @@ QgsOfflineEditingPluginGui::QgsOfflineEditingPluginGui( QWidget *parent, Qt::Win
QgsLayerTree *rootNode = QgsProject::instance()->layerTreeRoot()->clone();
QgsLayerTreeModel *treeModel = new QgsSelectLayerTreeModel( rootNode, this );
mLayerTree->setModel( treeModel );
mLayerTree->header()->setResizeMode( QHeaderView::ResizeToContents );
mLayerTree->header()->setSectionResizeMode( QHeaderView::ResizeToContents );

connect( mSelectAllButton, &QAbstractButton::clicked, this, &QgsOfflineEditingPluginGui::selectAll );
connect( mDeselectAllButton, &QAbstractButton::clicked, this, &QgsOfflineEditingPluginGui::deSelectAll );

0 comments on commit 3d3e1a7

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