Skip to content

Commit

Permalink
Replace use of deprecated QHeaderView methods
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 5, 2017
1 parent 25a18b9 commit 31fcc67
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 31 deletions.
4 changes: 2 additions & 2 deletions src/app/composer/qgsattributeselectiondialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ QgsAttributeSelectionDialog::QgsAttributeSelectionDialog( QgsComposerAttributeTa
//set up models, views and delegates
mColumnModel = new QgsComposerAttributeTableColumnModelV2( mComposerTable, mColumnsTableView );
mColumnsTableView->setModel( mColumnModel );
mColumnsTableView->horizontalHeader()->setResizeMode( QHeaderView::Stretch );
mColumnsTableView->horizontalHeader()->setSectionResizeMode( QHeaderView::Stretch );

mColumnSourceDelegate = new QgsComposerColumnSourceDelegate( vLayer, mColumnsTableView, mComposerTable );
mColumnsTableView->setItemDelegateForColumn( 0, mColumnSourceDelegate );
Expand All @@ -312,7 +312,7 @@ QgsAttributeSelectionDialog::QgsAttributeSelectionDialog( QgsComposerAttributeTa
mSortedProxyModel->sort( 0, Qt::AscendingOrder );
mSortColumnTableView->setSortingEnabled( false );
mSortColumnTableView->setModel( mSortedProxyModel );
mSortColumnTableView->horizontalHeader()->setResizeMode( QHeaderView::Stretch );
mSortColumnTableView->horizontalHeader()->setSectionResizeMode( QHeaderView::Stretch );
}

mOrderComboBox->insertItem( 0, tr( "Ascending" ) );
Expand Down
6 changes: 3 additions & 3 deletions src/app/composer/qgscomposer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,9 +591,9 @@ QgsComposer::QgsComposer( QgsComposition *composition )

mItemsTreeView->setColumnWidth( 0, 30 );
mItemsTreeView->setColumnWidth( 1, 30 );
mItemsTreeView->header()->setResizeMode( 0, QHeaderView::Fixed );
mItemsTreeView->header()->setResizeMode( 1, QHeaderView::Fixed );
mItemsTreeView->header()->setMovable( false );
mItemsTreeView->header()->setSectionResizeMode( 0, QHeaderView::Fixed );
mItemsTreeView->header()->setSectionResizeMode( 1, QHeaderView::Fixed );
mItemsTreeView->header()->setSectionsMovable( false );

mItemsTreeView->setDragEnabled( true );
mItemsTreeView->setAcceptDrops( true );
Expand Down
2 changes: 1 addition & 1 deletion src/app/locator/qgslocatoroptionswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ QgsLocatorOptionsWidget::QgsLocatorOptionsWidget( QgsLocatorWidget *locator, QWi
mFiltersTreeView->setModel( mModel );

mFiltersTreeView->header()->setStretchLastSection( false );
mFiltersTreeView->header()->setResizeMode( 0, QHeaderView::Stretch );
mFiltersTreeView->header()->setSectionResizeMode( 0, QHeaderView::Stretch );

mConfigureFilterButton->setEnabled( false );
connect( mFiltersTreeView->selectionModel(), &QItemSelectionModel::selectionChanged, this, [ = ]( const QItemSelection & selected, const QItemSelection & )
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsidentifyresultsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ void QgsIdentifyResultsDialog::addFeature( const QgsMapToolIdentify::IdentifyRes
void QgsIdentifyResultsDialog::addFeature( QgsVectorLayer *vlayer, const QgsFeature &f, const QMap<QString, QString> &derivedAttributes )
{
QTreeWidgetItem *layItem = layerItem( vlayer );
lstResults->header()->setResizeMode( QHeaderView::ResizeToContents );
lstResults->header()->setSectionResizeMode( QHeaderView::ResizeToContents );
lstResults->header()->setStretchLastSection( false );

if ( !layItem )
Expand Down
6 changes: 3 additions & 3 deletions src/app/qgsprojectproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
twIdentifyLayers->setHorizontalHeaderItem( 2, new QTableWidgetItem( tr( "Identifiable" ) ) );
twIdentifyLayers->setHorizontalHeaderItem( 3, new QTableWidgetItem( tr( "Read Only" ) ) );
twIdentifyLayers->setRowCount( mapLayers.size() );
twIdentifyLayers->verticalHeader()->setResizeMode( QHeaderView::ResizeToContents );
twIdentifyLayers->verticalHeader()->setSectionResizeMode( QHeaderView::ResizeToContents );

int i = 0;
for ( QMap<QString, QgsMapLayer *>::const_iterator it = mapLayers.constBegin(); it != mapLayers.constEnd(); ++it, i++ )
Expand Down Expand Up @@ -620,7 +620,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
}
}
twWFSLayers->setRowCount( j );
twWFSLayers->verticalHeader()->setResizeMode( QHeaderView::ResizeToContents );
twWFSLayers->verticalHeader()->setSectionResizeMode( QHeaderView::ResizeToContents );

mWCSUrlLineEdit->setText( QgsProject::instance()->readEntry( QStringLiteral( "WCSUrl" ), QStringLiteral( "/" ), QLatin1String( "" ) ) );
QStringList wcsLayerIdList = QgsProject::instance()->readListEntry( QStringLiteral( "WCSLayers" ), QStringLiteral( "/" ) );
Expand Down Expand Up @@ -659,7 +659,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
}
}
twWCSLayers->setRowCount( j );
twWCSLayers->verticalHeader()->setResizeMode( QHeaderView::ResizeToContents );
twWCSLayers->verticalHeader()->setSectionResizeMode( QHeaderView::ResizeToContents );

// Default Styles
mStyle = QgsStyle::defaultStyle();
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsrasterlayerproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,8 @@ void QgsRasterLayerProperties::setupTransparencyTable( int nBands )
tableTransparency->setHorizontalHeaderItem( 2, new QTableWidgetItem( tr( "Percent Transparent" ) ) );
}

tableTransparency->horizontalHeader()->setResizeMode( 0, QHeaderView::Stretch );
tableTransparency->horizontalHeader()->setResizeMode( 1, QHeaderView::Stretch );
tableTransparency->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
tableTransparency->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::Stretch );
}

void QgsRasterLayerProperties::populateTransparencyTable( QgsRasterRenderer *renderer )
Expand Down
2 changes: 1 addition & 1 deletion src/gui/auth/qgsautheditorwidgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void QgsAuthMethodPlugins::setupTable()
tblAuthPlugins->setColumnWidth( 0, 150 );
tblAuthPlugins->setColumnWidth( 1, 300 );
tblAuthPlugins->setRowCount( QgsAuthManager::instance()->authMethodsKeys().size() );
tblAuthPlugins->verticalHeader()->setResizeMode( QHeaderView::ResizeToContents );
tblAuthPlugins->verticalHeader()->setSectionResizeMode( QHeaderView::ResizeToContents );
tblAuthPlugins->setSortingEnabled( true );
tblAuthPlugins->setSelectionBehavior( QAbstractItemView::SelectRows );
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsbrowserdockwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void QgsBrowserDockWidget::showEvent( QShowEvent *e )
mBrowserView->setModel( mProxyModel );
// provide a horizontal scroll bar instead of using ellipse (...) for longer items
mBrowserView->setTextElideMode( Qt::ElideNone );
mBrowserView->header()->setResizeMode( 0, QHeaderView::ResizeToContents );
mBrowserView->header()->setSectionResizeMode( 0, QHeaderView::ResizeToContents );
mBrowserView->header()->setStretchLastSection( false );

// selectionModel is created when model is set on tree
Expand Down
6 changes: 3 additions & 3 deletions src/gui/qgsorderbydialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ QgsOrderByDialog::QgsOrderByDialog( QgsVectorLayer *layer, QWidget *parent )
{
setupUi( this );

mOrderByTableWidget->horizontalHeader()->setResizeMode( QHeaderView::Stretch );
mOrderByTableWidget->horizontalHeader()->setResizeMode( 1, QHeaderView::ResizeToContents );
mOrderByTableWidget->horizontalHeader()->setResizeMode( 2, QHeaderView::ResizeToContents );
mOrderByTableWidget->horizontalHeader()->setSectionResizeMode( QHeaderView::Stretch );
mOrderByTableWidget->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::ResizeToContents );
mOrderByTableWidget->horizontalHeader()->setSectionResizeMode( 2, QHeaderView::ResizeToContents );

mOrderByTableWidget->installEventFilter( this );

Expand Down
8 changes: 4 additions & 4 deletions src/gui/qgsprojectionselectiontreewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ QgsProjectionSelectionTreeWidget::QgsProjectionSelectionTreeWidget( QWidget *par
// Get the full path name to the sqlite3 spatial reference database.
mSrsDatabaseFileName = QgsApplication::srsDatabaseFilePath();

lstCoordinateSystems->header()->setResizeMode( AuthidColumn, QHeaderView::Stretch );
lstCoordinateSystems->header()->setSectionResizeMode( AuthidColumn, QHeaderView::Stretch );
lstCoordinateSystems->header()->resizeSection( QgisCrsIdColumn, 0 );
lstCoordinateSystems->header()->setResizeMode( QgisCrsIdColumn, QHeaderView::Fixed );
lstCoordinateSystems->header()->setSectionResizeMode( QgisCrsIdColumn, QHeaderView::Fixed );

// Hide (internal) ID column
lstCoordinateSystems->setColumnHidden( QgisCrsIdColumn, true );

lstRecent->header()->setResizeMode( AuthidColumn, QHeaderView::Stretch );
lstRecent->header()->setSectionResizeMode( AuthidColumn, QHeaderView::Stretch );
lstRecent->header()->resizeSection( QgisCrsIdColumn, 0 );
lstRecent->header()->setResizeMode( QgisCrsIdColumn, QHeaderView::Fixed );
lstRecent->header()->setSectionResizeMode( QgisCrsIdColumn, QHeaderView::Fixed );

// Hide (internal) ID column
lstRecent->setColumnHidden( QgisCrsIdColumn, true );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgstaskmanagerwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ QgsTaskManagerWidget::QgsTaskManagerWidget( QgsTaskManager *manager, QWidget *pa
mTreeView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
mTreeView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
mTreeView->header()->setStretchLastSection( false );
mTreeView->header()->setResizeMode( 0, QHeaderView::Stretch );
mTreeView->header()->setSectionResizeMode( 0, QHeaderView::Stretch );

vLayout->addWidget( mTreeView );

Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsvariableeditorwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ QgsVariableEditorTree::QgsVariableEditorTree( QWidget *parent )
setAlternatingRowColors( true );
setEditTriggers( QAbstractItemView::AllEditTriggers );
setRootIsDecorated( false );
header()->setMovable( false );
header()->setResizeMode( QHeaderView::Interactive );
header()->setSectionsMovable( false );
header()->setSectionResizeMode( QHeaderView::Interactive );

mEditorDelegate = new VariableEditorDelegate( this, this );
setItemDelegate( mEditorDelegate );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ void QgsGeometryCheckerFixSummaryDialog::addError( QTableWidget *table, QgsGeome
void QgsGeometryCheckerFixSummaryDialog::setupTable( QTableWidget *table )
{
table->resizeColumnToContents( 0 );
table->horizontalHeader()->setResizeMode( 1, QHeaderView::Stretch );
table->horizontalHeader()->setResizeMode( 2, QHeaderView::Stretch );
table->horizontalHeader()->setResizeMode( 3, QHeaderView::Stretch );
table->horizontalHeader()->setResizeMode( 4, QHeaderView::Stretch );
table->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::Stretch );
table->horizontalHeader()->setSectionResizeMode( 2, QHeaderView::Stretch );
table->horizontalHeader()->setSectionResizeMode( 3, QHeaderView::Stretch );
table->horizontalHeader()->setSectionResizeMode( 4, QHeaderView::Stretch );

table->setEditTriggers( QAbstractItemView::NoEditTriggers );
table->setSelectionBehavior( QAbstractItemView::SelectRows );
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/grass/qgsgrassmoduleinput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -754,8 +754,8 @@ void QgsGrassModuleInputSelectedView::setModel( QAbstractItemModel *model )
QTreeView::setModel( model );
header()->hide();
header()->setStretchLastSection( false );
header()->setResizeMode( 0, QHeaderView::Stretch );
header()->setResizeMode( 1, QHeaderView::Fixed );
header()->setSectionResizeMode( 0, QHeaderView::Stretch );
header()->setSectionResizeMode( 1, QHeaderView::Fixed );
header()->resizeSection( 1, 16 );
}

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/grass/qgsgrassnewmapset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ QgsGrassNewMapset::QgsGrassNewMapset( QgisInterface *iface,
mMapsetsListView->clear();
mMapsetLineEdit->setValidator( new QRegExpValidator( rx, mMapsetLineEdit ) );

mMapsetsListView->header()->setResizeMode( QHeaderView::ResizeToContents );
mMapsetsListView->header()->setSectionResizeMode( QHeaderView::ResizeToContents );

// FINISH
mOpenNewMapsetCheckBox->setChecked( settings.value( QStringLiteral( "GRASS/newMapsetWizard/openMapset" ), true ).toBool() );
Expand Down

0 comments on commit 31fcc67

Please sign in to comment.