Skip to content
Permalink
Browse files

Replace use of deprecated QHeaderView methods

  • Loading branch information
nyalldawson committed Sep 5, 2017
1 parent 25a18b9 commit 31fcc67a69156e017996e68ad21a9c557aea154c
@@ -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 );
@@ -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" ) );
@@ -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 );
@@ -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 & )
@@ -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 )
@@ -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++ )
@@ -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( "/" ) );
@@ -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();
@@ -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 )
@@ -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 );
}
@@ -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
@@ -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 );

@@ -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 );
@@ -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 );

@@ -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 );
@@ -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 );
@@ -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 );
}

@@ -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() );

0 comments on commit 31fcc67

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