Skip to content
Permalink
Browse files
More new style Qt5 connects
  • Loading branch information
nyalldawson committed Apr 2, 2017
1 parent 6f9f087 commit 106d95b95bc662788b2e54b11619ce106fd925df
@@ -118,15 +118,15 @@ QgsEffectStackPropertiesWidget::QgsEffectStackPropertiesWidget( QgsEffectStack *
mEffectsList->setModel( mModel );

QItemSelectionModel *selModel = mEffectsList->selectionModel();
connect( selModel, SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ), this, SLOT( effectChanged() ) );
connect( selModel, &QItemSelectionModel::currentChanged, this, &QgsEffectStackPropertiesWidget::effectChanged );

loadStack( stack );
updatePreview();

connect( mUpButton, SIGNAL( clicked() ), this, SLOT( moveEffectUp() ) );
connect( mDownButton, SIGNAL( clicked() ), this, SLOT( moveEffectDown() ) );
connect( mAddButton, SIGNAL( clicked() ), this, SLOT( addEffect() ) );
connect( mRemoveButton, SIGNAL( clicked() ), this, SLOT( removeEffect() ) );
connect( mUpButton, &QAbstractButton::clicked, this, &QgsEffectStackPropertiesWidget::moveEffectUp );
connect( mDownButton, &QAbstractButton::clicked, this, &QgsEffectStackPropertiesWidget::moveEffectDown );
connect( mAddButton, &QAbstractButton::clicked, this, &QgsEffectStackPropertiesWidget::addEffect );
connect( mRemoveButton, &QAbstractButton::clicked, this, &QgsEffectStackPropertiesWidget::removeEffect );

updateUi();

@@ -253,12 +253,11 @@ void QgsEffectStackPropertiesWidget::effectChanged()
if ( !currentItem )
return;

QWidget *effectPropertiesWidget = new QgsPaintEffectPropertiesWidget( currentItem->effect() );
QgsPaintEffectPropertiesWidget *effectPropertiesWidget = new QgsPaintEffectPropertiesWidget( currentItem->effect() );
setWidget( effectPropertiesWidget );

connect( effectPropertiesWidget, SIGNAL( changeEffect( QgsPaintEffect * ) ), this, SLOT( changeEffect( QgsPaintEffect * ) ) );
connect( effectPropertiesWidget, SIGNAL( changed() ), this, SLOT( updatePreview() ) );

connect( effectPropertiesWidget, &QgsPaintEffectPropertiesWidget::changeEffect, this, &QgsEffectStackPropertiesWidget::changeEffect );
connect( effectPropertiesWidget, &QgsPaintEffectPropertiesWidget::changed, this, &QgsEffectStackPropertiesWidget::updatePreview );
}

void QgsEffectStackPropertiesWidget::setWidget( QWidget *widget )
@@ -408,8 +407,8 @@ QgsEffectStackCompactWidget::QgsEffectStackCompactWidget( QWidget *parent, QgsPa
setFocusPolicy( Qt::StrongFocus );
setFocusProxy( mEnabledCheckBox );

connect( mButton, SIGNAL( clicked() ), this, SLOT( showDialog() ) );
connect( mEnabledCheckBox, SIGNAL( toggled( bool ) ), this, SLOT( enableToggled( bool ) ) );
connect( mButton, &QAbstractButton::clicked, this, &QgsEffectStackCompactWidget::showDialog );
connect( mEnabledCheckBox, &QAbstractButton::toggled, this, &QgsEffectStackCompactWidget::enableToggled );

setPaintEffect( effect );
}
@@ -466,7 +465,7 @@ void QgsEffectStackCompactWidget::showDialog()
{
widget->setPreviewPicture( *mPreviewPicture );
}
connect( widget, SIGNAL( widgetChanged() ), this, SLOT( updateEffectLive() ) );
connect( widget, &QgsPanelWidget::widgetChanged, this, &QgsEffectStackCompactWidget::updateEffectLive );
connect( widget, &QgsPanelWidget::panelAccepted, this, &QgsEffectStackCompactWidget::updateAcceptWidget );
openPanel( widget );
}
@@ -82,7 +82,7 @@ QgsPaintEffectPropertiesWidget::QgsPaintEffectPropertiesWidget( QgsPaintEffect *
}
// set the corresponding widget
updateEffectWidget( effect );
connect( mEffectTypeCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( effectTypeChanged() ) );
connect( mEffectTypeCombo, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsPaintEffectPropertiesWidget::effectTypeChanged );
}


@@ -112,7 +112,8 @@ void QgsPaintEffectPropertiesWidget::updateEffectWidget( QgsPaintEffect *effect
if ( stackedWidget->currentWidget() != pageDummy )
{
// stop updating from the original widget
disconnect( stackedWidget->currentWidget(), SIGNAL( changed() ), this, SLOT( emitSignalChanged() ) );
if ( QgsPaintEffectWidget *pew = qobject_cast< QgsPaintEffectWidget * >( stackedWidget->currentWidget() ) )
disconnect( pew, &QgsPaintEffectWidget::changed, this, &QgsPaintEffectPropertiesWidget::emitSignalChanged );
stackedWidget->removeWidget( stackedWidget->currentWidget() );
}

@@ -127,7 +128,7 @@ void QgsPaintEffectPropertiesWidget::updateEffectWidget( QgsPaintEffect *effect
stackedWidget->addWidget( w );
stackedWidget->setCurrentWidget( w );
// start receiving updates from widget
connect( w, SIGNAL( changed() ), this, SLOT( emitSignalChanged() ) );
connect( w, &QgsPaintEffectWidget::changed, this, &QgsPaintEffectPropertiesWidget::emitSignalChanged );
return;
}
}
@@ -429,7 +429,7 @@ QgsGlowWidget::QgsGlowWidget( QWidget *parent )
initGui();

connect( btnColorRamp, &QgsColorRampButton::colorRampChanged, this, &QgsGlowWidget::applyColorRamp );
connect( radioSingleColor, SIGNAL( toggled( bool ) ), this, SLOT( colorModeChanged() ) );
connect( radioSingleColor, &QAbstractButton::toggled, this, &QgsGlowWidget::colorModeChanged );
}

void QgsGlowWidget::setPaintEffect( QgsPaintEffect *effect )
@@ -32,8 +32,8 @@ void QgsLayerTreeEmbeddedConfigWidget::setLayer( QgsMapLayer *layer )
{
mLayer = layer;

connect( mBtnAdd, SIGNAL( clicked( bool ) ), this, SLOT( onAddClicked() ) );
connect( mBtnRemove, SIGNAL( clicked( bool ) ), this, SLOT( onRemoveClicked() ) );
connect( mBtnAdd, &QAbstractButton::clicked, this, &QgsLayerTreeEmbeddedConfigWidget::onAddClicked );
connect( mBtnRemove, &QAbstractButton::clicked, this, &QgsLayerTreeEmbeddedConfigWidget::onRemoveClicked );

QStandardItemModel *modelAvailable = new QStandardItemModel( this );
QStandardItemModel *modelUsed = new QStandardItemModel( this );
@@ -43,15 +43,16 @@ QgsLayerTreeTransparencyWidget::QgsLayerTreeTransparencyWidget( QgsMapLayer *lay
mTimer = new QTimer( this );
mTimer->setSingleShot( true );
mTimer->setInterval( 100 );
connect( mTimer, SIGNAL( timeout() ), this, SLOT( updateTransparencyFromSlider() ) );
connect( mTimer, &QTimer::timeout, this, &QgsLayerTreeTransparencyWidget::updateTransparencyFromSlider );

connect( mSlider, SIGNAL( valueChanged( int ) ), this, SLOT( sliderValueChanged( int ) ) );
connect( mSlider, &QAbstractSlider::valueChanged, this, &QgsLayerTreeTransparencyWidget::sliderValueChanged );

// init from layer
if ( mLayer->type() == QgsMapLayer::VectorLayer )
{
mSlider->setValue( qobject_cast<QgsVectorLayer *>( mLayer )->layerTransparency() );
connect( mLayer, SIGNAL( layerTransparencyChanged( int ) ), this, SLOT( layerTrChanged() ) );
QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( mLayer );
mSlider->setValue( vl->layerTransparency() );
connect( vl, &QgsVectorLayer::layerTransparencyChanged, this, &QgsLayerTreeTransparencyWidget::layerTrChanged );
}
else if ( mLayer->type() == QgsMapLayer::RasterLayer )
{
@@ -42,8 +42,8 @@ QgsLayerTreeView::QgsLayerTreeView( QWidget *parent )
setSelectionMode( ExtendedSelection );
setDefaultDropAction( Qt::MoveAction );

connect( this, SIGNAL( collapsed( QModelIndex ) ), this, SLOT( updateExpandedStateToNode( QModelIndex ) ) );
connect( this, SIGNAL( expanded( QModelIndex ) ), this, SLOT( updateExpandedStateToNode( QModelIndex ) ) );
connect( this, &QTreeView::collapsed, this, &QgsLayerTreeView::updateExpandedStateToNode );
connect( this, &QTreeView::expanded, this, &QgsLayerTreeView::updateExpandedStateToNode );
}

QgsLayerTreeView::~QgsLayerTreeView()
@@ -56,16 +56,16 @@ void QgsLayerTreeView::setModel( QAbstractItemModel *model )
if ( !qobject_cast<QgsLayerTreeModel *>( model ) )
return;

connect( model, SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SLOT( modelRowsInserted( QModelIndex, int, int ) ) );
connect( model, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SLOT( modelRowsRemoved() ) );
connect( model, &QAbstractItemModel::rowsInserted, this, &QgsLayerTreeView::modelRowsInserted );
connect( model, &QAbstractItemModel::rowsRemoved, this, &QgsLayerTreeView::modelRowsRemoved );

QTreeView::setModel( model );

connect( layerTreeModel()->rootGroup(), SIGNAL( expandedChanged( QgsLayerTreeNode *, bool ) ), this, SLOT( onExpandedChanged( QgsLayerTreeNode *, bool ) ) );
connect( layerTreeModel()->rootGroup(), &QgsLayerTreeNode::expandedChanged, this, &QgsLayerTreeView::onExpandedChanged );

connect( selectionModel(), SIGNAL( currentChanged( QModelIndex, QModelIndex ) ), this, SLOT( onCurrentChanged() ) );
connect( selectionModel(), &QItemSelectionModel::currentChanged, this, &QgsLayerTreeView::onCurrentChanged );

connect( layerTreeModel(), SIGNAL( modelReset() ), this, SLOT( onModelReset() ) );
connect( layerTreeModel(), &QAbstractItemModel::modelReset, this, &QgsLayerTreeView::onModelReset );

updateExpandedStateFromNode( layerTreeModel()->rootGroup() );
}
@@ -34,14 +34,14 @@ QgsLayerTreeViewDefaultActions::QgsLayerTreeViewDefaultActions( QgsLayerTreeView
QAction *QgsLayerTreeViewDefaultActions::actionAddGroup( QObject *parent )
{
QAction *a = new QAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddGroup.svg" ) ), tr( "&Add Group" ), parent );
connect( a, SIGNAL( triggered() ), this, SLOT( addGroup() ) );
connect( a, &QAction::triggered, this, &QgsLayerTreeViewDefaultActions::addGroup );
return a;
}

QAction *QgsLayerTreeViewDefaultActions::actionRemoveGroupOrLayer( QObject *parent )
{
QAction *a = new QAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionRemoveLayer.svg" ) ), tr( "&Remove" ), parent );
connect( a, SIGNAL( triggered() ), this, SLOT( removeGroupOrLayer() ) );
connect( a, &QAction::triggered, this, &QgsLayerTreeViewDefaultActions::removeGroupOrLayer );
return a;
}

@@ -52,7 +52,7 @@ QAction *QgsLayerTreeViewDefaultActions::actionShowInOverview( QObject *parent )
return nullptr;

QAction *a = new QAction( tr( "&Show in Overview" ), parent );
connect( a, SIGNAL( triggered() ), this, SLOT( showInOverview() ) );
connect( a, &QAction::triggered, this, &QgsLayerTreeViewDefaultActions::showInOverview );
a->setCheckable( true );
a->setChecked( node->customProperty( QStringLiteral( "overview" ), 0 ).toInt() );
return a;
@@ -61,7 +61,7 @@ QAction *QgsLayerTreeViewDefaultActions::actionShowInOverview( QObject *parent )
QAction *QgsLayerTreeViewDefaultActions::actionRenameGroupOrLayer( QObject *parent )
{
QAction *a = new QAction( tr( "Re&name" ), parent );
connect( a, SIGNAL( triggered() ), this, SLOT( renameGroupOrLayer() ) );
connect( a, &QAction::triggered, this, &QgsLayerTreeViewDefaultActions::renameGroupOrLayer );
return a;
}

@@ -72,7 +72,7 @@ QAction *QgsLayerTreeViewDefaultActions::actionShowFeatureCount( QObject *parent
return nullptr;

QAction *a = new QAction( tr( "Show Feature Count" ), parent );
connect( a, SIGNAL( triggered() ), this, SLOT( showFeatureCount() ) );
connect( a, &QAction::triggered, this, &QgsLayerTreeViewDefaultActions::showFeatureCount );
a->setCheckable( true );
a->setChecked( node->customProperty( QStringLiteral( "showFeatureCount" ), 0 ).toInt() );
return a;
@@ -83,7 +83,7 @@ QAction *QgsLayerTreeViewDefaultActions::actionZoomToLayer( QgsMapCanvas *canvas
QAction *a = new QAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionZoomToLayer.svg" ) ),
tr( "&Zoom to Layer" ), parent );
a->setData( QVariant::fromValue( reinterpret_cast<void *>( canvas ) ) );
connect( a, SIGNAL( triggered() ), this, SLOT( zoomToLayer() ) );
connect( a, &QAction::triggered, this, static_cast<void ( QgsLayerTreeViewDefaultActions::* )()>( &QgsLayerTreeViewDefaultActions::zoomToLayer ) );
return a;
}

@@ -92,21 +92,21 @@ QAction *QgsLayerTreeViewDefaultActions::actionZoomToGroup( QgsMapCanvas *canvas
QAction *a = new QAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionZoomToLayer.svg" ) ),
tr( "&Zoom to Group" ), parent );
a->setData( QVariant::fromValue( reinterpret_cast<void *>( canvas ) ) );
connect( a, SIGNAL( triggered() ), this, SLOT( zoomToGroup() ) );
connect( a, &QAction::triggered, this, static_cast<void ( QgsLayerTreeViewDefaultActions::* )()>( &QgsLayerTreeViewDefaultActions::zoomToGroup ) );
return a;
}

QAction *QgsLayerTreeViewDefaultActions::actionMakeTopLevel( QObject *parent )
{
QAction *a = new QAction( tr( "&Move to Top-level" ), parent );
connect( a, SIGNAL( triggered() ), this, SLOT( makeTopLevel() ) );
connect( a, &QAction::triggered, this, &QgsLayerTreeViewDefaultActions::makeTopLevel );
return a;
}

QAction *QgsLayerTreeViewDefaultActions::actionGroupSelected( QObject *parent )
{
QAction *a = new QAction( tr( "&Group Selected" ), parent );
connect( a, SIGNAL( triggered() ), this, SLOT( groupSelected() ) );
connect( a, &QAction::triggered, this, &QgsLayerTreeViewDefaultActions::groupSelected );
return a;
}

@@ -119,7 +119,7 @@ QAction *QgsLayerTreeViewDefaultActions::actionMutuallyExclusiveGroup( QObject *
QAction *a = new QAction( tr( "Mutually Exclusive Group" ), parent );
a->setCheckable( true );
a->setChecked( QgsLayerTree::toGroup( node )->isMutuallyExclusive() );
connect( a, SIGNAL( triggered() ), this, SLOT( mutuallyExclusiveGroup() ) );
connect( a, &QAction::triggered, this, &QgsLayerTreeViewDefaultActions::mutuallyExclusiveGroup );
return a;
}

@@ -1697,8 +1697,8 @@ void QgsAttributeForm::addWidgetWrapper( QgsEditorWidgetWrapper *eww )
{
if ( meww->field() == eww->field() )
{
connect( meww, SIGNAL( valueChanged( QVariant ) ), eww, SLOT( setValue( QVariant ) ) );
connect( eww, SIGNAL( valueChanged( QVariant ) ), meww, SLOT( setValue( QVariant ) ) );
connect( meww, static_cast<void ( QgsEditorWidgetWrapper::* )( const QVariant & )>( &QgsEditorWidgetWrapper::valueChanged ), eww, &QgsEditorWidgetWrapper::setValue );
connect( eww, static_cast<void ( QgsEditorWidgetWrapper::* )( const QVariant & )>( &QgsEditorWidgetWrapper::valueChanged ), meww, &QgsEditorWidgetWrapper::setValue );
break;
}
}
@@ -1762,7 +1762,7 @@ void QgsAttributeForm::afterWidgetInit()
isFirstEww = false;
}

connect( eww, SIGNAL( valueChanged( const QVariant & ) ), this, SLOT( onAttributeChanged( const QVariant & ) ) );
connect( eww, static_cast<void ( QgsEditorWidgetWrapper::* )( const QVariant & )>( &QgsEditorWidgetWrapper::valueChanged ), this, &QgsAttributeForm::onAttributeChanged );
connect( eww, &QgsEditorWidgetWrapper::constraintStatusChanged, this, &QgsAttributeForm::onConstraintStatusChanged );
}
}
@@ -55,8 +55,8 @@ QgsAttributeFormEditorWidget::QgsAttributeFormEditorWidget( QgsEditorWidgetWrapp
mSearchPage->setLayout( l );
l->addWidget( mSearchFrame, 1 );
mSearchWidgetToolButton = new QgsSearchWidgetToolButton();
connect( mSearchWidgetToolButton, SIGNAL( activeFlagsChanged( QgsSearchWidgetWrapper::FilterFlags ) ),
this, SLOT( searchWidgetFlagsChanged( QgsSearchWidgetWrapper::FilterFlags ) ) );
connect( mSearchWidgetToolButton, &QgsSearchWidgetToolButton::activeFlagsChanged,
this, &QgsAttributeFormEditorWidget::searchWidgetFlagsChanged );
l->addWidget( mSearchWidgetToolButton, 0 );


@@ -79,9 +79,9 @@ QgsAttributeFormEditorWidget::QgsAttributeFormEditorWidget( QgsEditorWidgetWrapp
{
mWidget->widget()->setObjectName( mWidget->field().name() );
}
connect( mWidget, SIGNAL( valueChanged( const QVariant & ) ), this, SLOT( editorWidgetChanged( const QVariant & ) ) );
connect( mMultiEditButton, SIGNAL( resetFieldValueTriggered() ), this, SLOT( resetValue() ) );
connect( mMultiEditButton, SIGNAL( setFieldValueTriggered() ), this, SLOT( setFieldTriggered() ) );
connect( mWidget, static_cast<void ( QgsEditorWidgetWrapper::* )( const QVariant &value )>( &QgsEditorWidgetWrapper::valueChanged ), this, &QgsAttributeFormEditorWidget::editorWidgetChanged );
connect( mMultiEditButton, &QgsMultiEditToolButton::resetFieldValueTriggered, this, &QgsAttributeFormEditorWidget::resetValue );
connect( mMultiEditButton, &QgsMultiEditToolButton::setFieldValueTriggered, this, &QgsAttributeFormEditorWidget::setFieldTriggered );

mMultiEditButton->setField( mWidget->field() );

@@ -119,8 +119,8 @@ void QgsAttributeFormEditorWidget::setSearchWidgetWrapper( QgsSearchWidgetWrappe
mSearchWidgetToolButton->setAvailableFlags( wrapper->supportedFlags() );
mSearchWidgetToolButton->setActiveFlags( QgsSearchWidgetWrapper::FilterFlags() );
mSearchWidgetToolButton->setDefaultFlags( wrapper->defaultFlags() );
connect( wrapper, SIGNAL( valueChanged() ), mSearchWidgetToolButton, SLOT( searchWidgetValueChanged() ) );
connect( wrapper, SIGNAL( valueCleared() ), mSearchWidgetToolButton, SLOT( setInactive() ) );
connect( wrapper, &QgsSearchWidgetWrapper::valueChanged, mSearchWidgetToolButton, &QgsSearchWidgetToolButton::setActive );
connect( wrapper, &QgsSearchWidgetWrapper::valueCleared, mSearchWidgetToolButton, &QgsSearchWidgetToolButton::setInactive );
}

QWidget *QgsAttributeFormEditorWidget::searchWidgetFrame()
@@ -41,10 +41,10 @@ QgsAttributeTypeLoadDialog::QgsAttributeTypeLoadDialog( QgsVectorLayer *vl )
{
setupUi( this );

connect( layerComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( fillComboBoxes( int ) ) );
connect( keyComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( createPreview( int ) ) );
connect( valueComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( createPreview( int ) ) );
connect( previewButton, SIGNAL( pressed() ), this, SLOT( previewButtonPushed() ) );
connect( layerComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsAttributeTypeLoadDialog::fillComboBoxes );
connect( keyComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, [ = ]( int index ) { createPreview( index ); } );
connect( valueComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, [ = ]( int index ) { createPreview( index ); } );
connect( previewButton, &QAbstractButton::pressed, this, &QgsAttributeTypeLoadDialog::previewButtonPushed );

fillLayerList();

@@ -25,7 +25,7 @@ QgsCharacterSelectorDialog::QgsCharacterSelectorDialog( QWidget *parent, Qt::Win
setupUi( this );
mCharWidget = new CharacterWidget( this );
mCharSelectScrollArea->setWidget( mCharWidget );
connect( mCharWidget, SIGNAL( characterSelected( const QChar & ) ), this, SLOT( setCharacter( const QChar & ) ) );
connect( mCharWidget, &CharacterWidget::characterSelected, this, &QgsCharacterSelectorDialog::setCharacter );
}

const QChar &QgsCharacterSelectorDialog::selectCharacter( bool *gotChar, const QFont &font, const QString &style )
@@ -69,9 +69,9 @@ void QgsCollapsibleGroupBoxBasic::init()
setFocusProxy( mCollapseButton );
setFocusPolicy( Qt::StrongFocus );

connect( mCollapseButton, SIGNAL( clicked() ), this, SLOT( toggleCollapsed() ) );
connect( this, SIGNAL( toggled( bool ) ), this, SLOT( checkToggled( bool ) ) );
connect( this, SIGNAL( clicked( bool ) ), this, SLOT( checkClicked( bool ) ) );
connect( mCollapseButton, &QAbstractButton::clicked, this, &QgsCollapsibleGroupBoxBasic::toggleCollapsed );
connect( this, &QGroupBox::toggled, this, &QgsCollapsibleGroupBoxBasic::checkToggled );
connect( this, &QGroupBox::clicked, this, &QgsCollapsibleGroupBoxBasic::checkClicked );
}

void QgsCollapsibleGroupBoxBasic::showEvent( QShowEvent *event )
Loading

0 comments on commit 106d95b

Please sign in to comment.