Skip to content
Permalink
Browse files
Some more new style connects
  • Loading branch information
nyalldawson committed Mar 22, 2017
1 parent 265da3f commit 2446dae1632132b910984bfa5f2c7215f3f921c7
@@ -252,8 +252,8 @@ void QgsAttributeTableFilterModel::setSourceModel( QgsAttributeTableModel *sourc
disconnect( sourceModel, SIGNAL( columnsAboutToBeRemoved( QModelIndex, int, int ) ), this, SLOT( _q_sourceColumnsAboutToBeRemoved( QModelIndex, int, int ) ) );
disconnect( sourceModel, SIGNAL( columnsRemoved( QModelIndex, int, int ) ), this, SLOT( _q_sourceColumnsRemoved( QModelIndex, int, int ) ) );

connect( mTableModel, SIGNAL( columnsAboutToBeInserted( QModelIndex, int, int ) ), this, SLOT( onColumnsChanged() ) );
connect( mTableModel, SIGNAL( columnsAboutToBeRemoved( QModelIndex, int, int ) ), this, SLOT( onColumnsChanged() ) );
connect( mTableModel, &QAbstractItemModel::columnsAboutToBeInserted, this, &QgsAttributeTableFilterModel::onColumnsChanged );
connect( mTableModel, &QAbstractItemModel::columnsAboutToBeRemoved, this, &QgsAttributeTableFilterModel::onColumnsChanged );
}

bool QgsAttributeTableFilterModel::selectedOnTop()
@@ -286,12 +286,12 @@ void QgsAttributeTableFilterModel::setFilterMode( FilterMode filterMode )
{
if ( filterMode == ShowVisible )
{
connect( mCanvas, SIGNAL( extentsChanged() ), this, SLOT( extentsChanged() ) );
connect( mCanvas, &QgsMapCanvas::extentsChanged, this, &QgsAttributeTableFilterModel::extentsChanged );
generateListOfVisibleFeatures();
}
else
{
disconnect( mCanvas, SIGNAL( extentsChanged() ), this, SLOT( extentsChanged() ) );
disconnect( mCanvas, &QgsMapCanvas::extentsChanged, this, &QgsAttributeTableFilterModel::extentsChanged );
}

mFilterMode = filterMode;
@@ -63,11 +63,11 @@ QgsAttributeTableView::QgsAttributeTableView( QWidget *parent )

verticalHeader()->viewport()->installEventFilter( this );

connect( verticalHeader(), SIGNAL( sectionPressed( int ) ), this, SLOT( selectRow( int ) ) );
connect( verticalHeader(), SIGNAL( sectionEntered( int ) ), this, SLOT( _q_selectRow( int ) ) );
connect( horizontalHeader(), SIGNAL( sectionResized( int, int, int ) ), this, SLOT( columnSizeChanged( int, int, int ) ) );
connect( horizontalHeader(), SIGNAL( sortIndicatorChanged( int, Qt::SortOrder ) ), this, SLOT( showHorizontalSortIndicator() ) );
connect( QgsMapLayerActionRegistry::instance(), SIGNAL( changed() ), this, SLOT( recreateActionWidgets() ) );
connect( verticalHeader(), &QHeaderView::sectionPressed, this, [ = ]( int row ) { selectRow( row, false ); } );
connect( verticalHeader(), &QHeaderView::sectionEntered, this, &QgsAttributeTableView::_q_selectRow );
connect( horizontalHeader(), &QHeaderView::sectionResized, this, &QgsAttributeTableView::columnSizeChanged );
connect( horizontalHeader(), &QHeaderView::sortIndicatorChanged, this, &QgsAttributeTableView::showHorizontalSortIndicator );
connect( QgsMapLayerActionRegistry::instance(), &QgsMapLayerActionRegistry::changed, this, &QgsAttributeTableView::recreateActionWidgets );
}

bool QgsAttributeTableView::eventFilter( QObject *object, QEvent *event )
@@ -118,8 +118,8 @@ void QgsAttributeTableView::setModel( QgsAttributeTableFilterModel *filterModel

if ( mFilterModel )
{
connect( mFilterModel, SIGNAL( destroyed() ), this, SLOT( modelDeleted() ) );
connect( mTableDelegate, SIGNAL( actionColumnItemPainted( QModelIndex ) ), this, SLOT( onActionColumnItemPainted( QModelIndex ) ) );
connect( mFilterModel, &QObject::destroyed, this, &QgsAttributeTableView::modelDeleted );
connect( mTableDelegate, &QgsAttributeTableDelegate::actionColumnItemPainted, this, &QgsAttributeTableView::onActionColumnItemPainted );
}

delete mFeatureSelectionModel;
@@ -135,8 +135,10 @@ void QgsAttributeTableView::setModel( QgsAttributeTableFilterModel *filterModel
mFeatureSelectionModel = new QgsFeatureSelectionModel( mFilterModel, mFilterModel, mFeatureSelectionManager, mFilterModel );
setSelectionModel( mFeatureSelectionModel );
mTableDelegate->setFeatureSelectionModel( mFeatureSelectionModel );
connect( mFeatureSelectionModel, SIGNAL( requestRepaint( QModelIndexList ) ), this, SLOT( repaintRequested( QModelIndexList ) ) );
connect( mFeatureSelectionModel, SIGNAL( requestRepaint() ), this, SLOT( repaintRequested() ) );
connect( mFeatureSelectionModel, static_cast<void ( QgsFeatureSelectionModel::* )( const QModelIndexList &indexes )>( &QgsFeatureSelectionModel::requestRepaint ),
this, static_cast<void ( QgsAttributeTableView::* )( const QModelIndexList &indexes )>( &QgsAttributeTableView::repaintRequested ) );
connect( mFeatureSelectionModel, static_cast<void ( QgsFeatureSelectionModel::* )()>( &QgsFeatureSelectionModel::requestRepaint ),
this, static_cast<void ( QgsAttributeTableView::* )()>( &QgsAttributeTableView::repaintRequested ) );
}
}

@@ -185,7 +187,7 @@ QWidget *QgsAttributeTableView::createActionWidget( QgsFeatureId fid )
act->setData( "user_action" );
act->setProperty( "fid", fid );
act->setProperty( "action_id", action.id() );
connect( act, SIGNAL( triggered( bool ) ), this, SLOT( actionTriggered() ) );
connect( act, &QAction::triggered, this, &QgsAttributeTableView::actionTriggered );
actionList << act;

if ( mFilterModel->layer()->actions()->defaultAction( QStringLiteral( "AttributeTableRow" ) ).id() == action.id() )
@@ -202,7 +204,7 @@ QWidget *QgsAttributeTableView::createActionWidget( QgsFeatureId fid )
action->setToolTip( mapLayerAction->text() );
action->setProperty( "fid", fid );
action->setProperty( "action", qVariantFromValue( qobject_cast<QObject *>( mapLayerAction ) ) );
connect( action, SIGNAL( triggered() ), this, SLOT( actionTriggered() ) );
connect( action, &QAction::triggered, this, &QgsAttributeTableView::actionTriggered );
actionList << action;

if ( !defaultAction &&
@@ -42,13 +42,13 @@ void QgsFeatureListModel::setSourceModel( QgsAttributeTableFilterModel *sourceMo
if ( mFilterModel )
{
// rewire (filter-)change events in the source model so this proxy reflects the changes
connect( mFilterModel, SIGNAL( rowsAboutToBeRemoved( const QModelIndex &, int, int ) ), SLOT( onBeginRemoveRows( const QModelIndex &, int, int ) ) );
connect( mFilterModel, SIGNAL( rowsRemoved( const QModelIndex &, int, int ) ), SLOT( onEndRemoveRows( const QModelIndex &, int, int ) ) );
connect( mFilterModel, SIGNAL( rowsAboutToBeInserted( const QModelIndex &, int, int ) ), SLOT( onBeginInsertRows( const QModelIndex &, int, int ) ) );
connect( mFilterModel, SIGNAL( rowsInserted( const QModelIndex &, int, int ) ), SLOT( onEndInsertRows( const QModelIndex &, int, int ) ) );
connect( mFilterModel, &QAbstractItemModel::rowsAboutToBeRemoved, this, &QgsFeatureListModel::onBeginRemoveRows );
connect( mFilterModel, &QAbstractItemModel::rowsRemoved, this, &QgsFeatureListModel::onEndRemoveRows );
connect( mFilterModel, &QAbstractItemModel::rowsAboutToBeInserted, this, &QgsFeatureListModel::onBeginInsertRows );
connect( mFilterModel, &QAbstractItemModel::rowsInserted, this, &QgsFeatureListModel::onEndInsertRows );
// propagate sort order changes from source model to views connected to this model
connect( mFilterModel, SIGNAL( layoutAboutToBeChanged() ), this, SIGNAL( layoutAboutToBeChanged() ) );
connect( mFilterModel, SIGNAL( layoutChanged() ), this, SIGNAL( layoutChanged() ) );
connect( mFilterModel, &QAbstractItemModel::layoutAboutToBeChanged, this, &QAbstractItemModel::layoutAboutToBeChanged );
connect( mFilterModel, &QAbstractItemModel::layoutChanged, this, &QAbstractItemModel::layoutChanged );
}
}

@@ -77,12 +77,12 @@ void QgsFeatureListView::setModel( QgsFeatureListModel *featureListModel )
setItemDelegate( mItemDelegate );

mItemDelegate->setFeatureSelectionModel( mFeatureSelectionModel );
connect( mFeatureSelectionModel, SIGNAL( requestRepaint( QModelIndexList ) ), this, SLOT( repaintRequested( QModelIndexList ) ) );
connect( mFeatureSelectionModel, SIGNAL( requestRepaint() ), this, SLOT( repaintRequested() ) );

connect( mCurrentEditSelectionModel, SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), SLOT( editSelectionChanged( QItemSelection, QItemSelection ) ) );

connect( mModel->layerCache()->layer(), SIGNAL( attributeValueChanged( QgsFeatureId, int, QVariant ) ), this, SLOT( repaintRequested() ) );
connect( mFeatureSelectionModel, static_cast<void ( QgsFeatureSelectionModel::* )( const QModelIndexList &indexes )>( &QgsFeatureSelectionModel::requestRepaint ),
this, static_cast<void ( QgsFeatureListView::* )( const QModelIndexList &indexes )>( &QgsFeatureListView::repaintRequested ) );
connect( mFeatureSelectionModel, static_cast<void ( QgsFeatureSelectionModel::* )()>( &QgsFeatureSelectionModel::requestRepaint ),
this, static_cast<void ( QgsFeatureListView::* )()>( &QgsFeatureListView::repaintRequested ) );
connect( mCurrentEditSelectionModel, &QItemSelectionModel::selectionChanged, this, &QgsFeatureListView::editSelectionChanged );
connect( mModel->layerCache()->layer(), &QgsVectorLayer::attributeValueChanged, this, [ = ] { repaintRequested(); } );
}

bool QgsFeatureListView::setDisplayExpression( const QString &expression )
@@ -82,7 +82,7 @@ void QgsFeatureSelectionModel::selectFeatures( const QItemSelection &selection,
ids << id;
}

disconnect( mFeatureSelectionManager, SIGNAL( selectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ), this, SLOT( layerSelectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ) );
disconnect( mFeatureSelectionManager, &QgsIFeatureSelectionManager::selectionChanged, this, &QgsFeatureSelectionModel::layerSelectionChanged );

if ( command.testFlag( QItemSelectionModel::ClearAndSelect ) )
{
@@ -137,7 +137,7 @@ void QgsFeatureSelectionModel::selectFeatures( const QItemSelection &selection,
}
}

connect( mFeatureSelectionManager, SIGNAL( selectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ), this, SLOT( layerSelectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ) );
connect( mFeatureSelectionManager, &QgsIFeatureSelectionManager::selectionChanged, this, &QgsFeatureSelectionModel::layerSelectionChanged );

QModelIndexList updatedIndexes;
Q_FOREACH ( const QModelIndex &idx, selection.indexes() )
@@ -152,7 +152,7 @@ void QgsFeatureSelectionModel::setFeatureSelectionManager( QgsIFeatureSelectionM
{
mFeatureSelectionManager = featureSelectionManager;

connect( mFeatureSelectionManager, SIGNAL( selectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ), this, SLOT( layerSelectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ) );
connect( mFeatureSelectionManager, &QgsIFeatureSelectionManager::selectionChanged, this, &QgsFeatureSelectionModel::layerSelectionChanged );
}

void QgsFeatureSelectionModel::layerSelectionChanged( const QgsFeatureIds &selected, const QgsFeatureIds &deselected, bool clearAndSelect )
@@ -30,17 +30,17 @@ QgsFieldConditionalFormatWidget::QgsFieldConditionalFormatWidget( QWidget *paren
{
setupUi( this );
mDeleteButton->hide();
connect( mFieldCombo, SIGNAL( fieldChanged( QString ) ), SLOT( fieldChanged( QString ) ) );
connect( fieldRadio, SIGNAL( clicked() ), SLOT( reloadStyles() ) );
connect( rowRadio, SIGNAL( clicked() ), SLOT( reloadStyles() ) );
connect( mNewButton, SIGNAL( clicked() ), SLOT( addNewRule() ) );
connect( mSaveRule, SIGNAL( clicked() ), SLOT( saveRule() ) );
connect( mCancelButton, SIGNAL( clicked() ), SLOT( cancelRule() ) );
connect( mDeleteButton, SIGNAL( clicked() ), SLOT( deleteRule() ) );
connect( listView, SIGNAL( clicked( QModelIndex ) ), SLOT( ruleClicked( QModelIndex ) ) );
connect( btnChangeIcon, SIGNAL( clicked() ), SLOT( updateIcon() ) );
connect( btnBuildExpression, SIGNAL( clicked() ), SLOT( setExpression() ) );
connect( mPresetsList, SIGNAL( currentIndexChanged( int ) ), SLOT( presetSet( int ) ) );
connect( mFieldCombo, &QgsFieldComboBox::fieldChanged, this, &QgsFieldConditionalFormatWidget::fieldChanged );
connect( fieldRadio, &QAbstractButton::clicked, this, &QgsFieldConditionalFormatWidget::reloadStyles );
connect( rowRadio, &QAbstractButton::clicked, this, &QgsFieldConditionalFormatWidget::reloadStyles );
connect( mNewButton, &QAbstractButton::clicked, this, &QgsFieldConditionalFormatWidget::addNewRule );
connect( mSaveRule, &QAbstractButton::clicked, this, &QgsFieldConditionalFormatWidget::saveRule );
connect( mCancelButton, &QAbstractButton::clicked, this, &QgsFieldConditionalFormatWidget::cancelRule );
connect( mDeleteButton, &QAbstractButton::clicked, this, &QgsFieldConditionalFormatWidget::deleteRule );
connect( listView, &QAbstractItemView::clicked, this, &QgsFieldConditionalFormatWidget::ruleClicked );
connect( btnChangeIcon, &QAbstractButton::clicked, this, &QgsFieldConditionalFormatWidget::updateIcon );
connect( btnBuildExpression, &QAbstractButton::clicked, this, &QgsFieldConditionalFormatWidget::setExpression );
connect( mPresetsList, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsFieldConditionalFormatWidget::presetSet );
btnBackgroundColor->setAllowAlpha( true );
btnBackgroundColor->setShowNoColor( true );
btnTextColor->setAllowAlpha( true );
@@ -45,8 +45,8 @@ QgsOrganizeTableColumnsDialog::QgsOrganizeTableColumnsDialog( const QgsVectorLay
{
setupUi( this );

connect( mShowAllButton, SIGNAL( clicked( bool ) ), this, SLOT( showAll() ) );
connect( mHideAllButton, SIGNAL( clicked( bool ) ), this, SLOT( hideAll() ) );
connect( mShowAllButton, &QAbstractButton::clicked, this, &QgsOrganizeTableColumnsDialog::showAll );
connect( mHideAllButton, &QAbstractButton::clicked, this, &QgsOrganizeTableColumnsDialog::hideAll );

if ( vl )
{
@@ -64,21 +64,21 @@ QgsAuthAuthoritiesEditor::QgsAuthAuthoritiesEditor( QWidget *parent )
{
setupUi( this );

connect( QgsAuthManager::instance(), SIGNAL( messageOut( const QString &, const QString &, QgsAuthManager::MessageLevel ) ),
this, SLOT( authMessageOut( const QString &, const QString &, QgsAuthManager::MessageLevel ) ) );
connect( QgsAuthManager::instance(), &QgsAuthManager::messageOut,
this, &QgsAuthAuthoritiesEditor::authMessageOut );

connect( QgsAuthManager::instance(), SIGNAL( authDatabaseChanged() ),
this, SLOT( refreshCaCertsView() ) );
connect( QgsAuthManager::instance(), &QgsAuthManager::authDatabaseChanged,
this, &QgsAuthAuthoritiesEditor::refreshCaCertsView );

setupCaCertsTree();

connect( treeWidgetCAs->selectionModel(), SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection & ) ),
this, SLOT( selectionChanged( const QItemSelection &, const QItemSelection & ) ) );
connect( treeWidgetCAs->selectionModel(), &QItemSelectionModel::selectionChanged,
this, &QgsAuthAuthoritiesEditor::selectionChanged );

connect( treeWidgetCAs, SIGNAL( itemDoubleClicked( QTreeWidgetItem *, int ) ),
this, SLOT( handleDoubleClick( QTreeWidgetItem *, int ) ) );
connect( treeWidgetCAs, &QTreeWidget::itemDoubleClicked,
this, &QgsAuthAuthoritiesEditor::handleDoubleClick );

connect( btnViewRefresh, SIGNAL( clicked() ), this, SLOT( refreshCaCertsView() ) );
connect( btnViewRefresh, &QAbstractButton::clicked, this, &QgsAuthAuthoritiesEditor::refreshCaCertsView );

QVariant cafileval = QgsAuthManager::instance()->getAuthSetting( QStringLiteral( "cafile" ) );
if ( !cafileval.isNull() )
@@ -336,10 +336,10 @@ void QgsAuthAuthoritiesEditor::updateCertTrustPolicyCache()
void QgsAuthAuthoritiesEditor::populateUtilitiesMenu()
{
mActionDefaultTrustPolicy = new QAction( QStringLiteral( "Change default trust policy" ), this );
connect( mActionDefaultTrustPolicy, SIGNAL( triggered() ), this, SLOT( editDefaultTrustPolicy() ) );
connect( mActionDefaultTrustPolicy, &QAction::triggered, this, &QgsAuthAuthoritiesEditor::editDefaultTrustPolicy );

mActionShowTrustedCAs = new QAction( QStringLiteral( "Show trusted authorities/issuers" ), this );
connect( mActionShowTrustedCAs, SIGNAL( triggered() ), this, SLOT( showTrustedCertificateAuthorities() ) );
connect( mActionShowTrustedCAs, &QAction::triggered, this, &QgsAuthAuthoritiesEditor::showTrustedCertificateAuthorities );

mUtilitiesMenu = new QMenu( this );
mUtilitiesMenu->addAction( mActionDefaultTrustPolicy );
@@ -621,8 +621,8 @@ void QgsAuthAuthoritiesEditor::editDefaultTrustPolicy()

layout->addWidget( buttonBox );

connect( buttonBox, SIGNAL( accepted() ), dlg, SLOT( accept() ) );
connect( buttonBox, SIGNAL( rejected() ), dlg, SLOT( close() ) );
connect( buttonBox, &QDialogButtonBox::accepted, dlg, &QDialog::accept );
connect( buttonBox, &QDialogButtonBox::rejected, dlg, &QWidget::close );

dlg->setLayout( layout );
dlg->setWindowModality( Qt::WindowModal );
@@ -85,8 +85,8 @@ QgsAuthCertInfo::QgsAuthCertInfo( const QSslCertificate &cert,

treeHierarchy->setRootIsDecorated( false );

connect( treeHierarchy, SIGNAL( currentItemChanged( QTreeWidgetItem *, QTreeWidgetItem * ) ),
this, SLOT( currentCertItemChanged( QTreeWidgetItem *, QTreeWidgetItem * ) ) );
connect( treeHierarchy, &QTreeWidget::currentItemChanged,
this, &QgsAuthCertInfo::currentCertItemChanged );

mCaCertsCache = QgsAuthManager::instance()->getCaCertsCache();

@@ -107,8 +107,8 @@ QgsAuthCertInfo::QgsAuthCertInfo( const QSslCertificate &cert,
if ( res )
setCertHierarchy();

connect( cmbbxTrust, SIGNAL( currentIndexChanged( int ) ),
this, SLOT( currentPolicyIndexChanged( int ) ) );
connect( cmbbxTrust, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ),
this, &QgsAuthCertInfo::currentPolicyIndexChanged );
}
}

@@ -929,7 +929,7 @@ QgsAuthCertInfoDialog::QgsAuthCertInfoDialog( const QSslCertificate &cert,
QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Close,
Qt::Horizontal, this );
buttonBox->button( QDialogButtonBox::Close )->setDefault( true );
connect( buttonBox, SIGNAL( rejected() ), this, SLOT( close() ) );
connect( buttonBox, &QDialogButtonBox::rejected, this, &QWidget::close );
layout->addWidget( buttonBox );

setLayout( layout );
@@ -40,7 +40,7 @@ QgsAuthCertManager::QgsAuthCertManager( QWidget *parent )
QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Close,
Qt::Horizontal, this );
buttonBox->button( QDialogButtonBox::Close )->setDefault( true );
connect( buttonBox, SIGNAL( rejected() ), this, SLOT( close() ) );
connect( buttonBox, &QDialogButtonBox::rejected, this, &QWidget::close );
layout->addWidget( buttonBox );

setLayout( layout );
@@ -51,8 +51,8 @@ QgsAuthCertTrustPolicyComboBox::QgsAuthCertTrustPolicyComboBox( QWidget *parent,
// setEditable( true );
// lineEdit()->setReadOnly( true );

connect( this, SIGNAL( currentIndexChanged( int ) ),
this, SLOT( highlightCurrentIndex( int ) ) );
connect( this, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ),
this, &QgsAuthCertTrustPolicyComboBox::highlightCurrentIndex );

setTrustPolicy( policy );
setDefaultTrustPolicy( defaultpolicy );

0 comments on commit 2446dae

Please sign in to comment.