Skip to content
Permalink
Browse files
More Qt5 style connect conversions
  • Loading branch information
nyalldawson committed Mar 27, 2017
1 parent 4d8df75 commit 943d1a2ca50c1ba7e9292cdb8dbb5766a6eb444e
@@ -798,6 +798,12 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow

void renameView();

void showProgress( int progress, int totalSteps );
void showStatusMessage( const QString &message );

//! set the active layer
bool setActiveLayer( QgsMapLayer * );

protected:

//! Handle state changes (WindowTitleChange)
@@ -1118,8 +1124,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
void showSelectedLayers();
//! Return pointer to the active layer
QgsMapLayer *activeLayer();
//! set the active layer
bool setActiveLayer( QgsMapLayer * );
//! Open the help contents in a browser
void helpContents();
//! Open the API documentation in a browser
@@ -1263,10 +1267,9 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow

void selectionChanged( QgsMapLayer *layer );

void showProgress( int progress, int totalSteps );
void extentChanged();
void showRotation();
void showStatusMessage( const QString &message );

void displayMapToolMessage( const QString &message, QgsMessageBar::MessageLevel level = QgsMessageBar::INFO );
void displayMessage( const QString &title, const QString &message, QgsMessageBar::MessageLevel level );
void removeMapToolMessage();
@@ -56,13 +56,13 @@ QgsBookmarks::QgsBookmarks( QWidget *parent )
QAction *btnImport = share->addAction( tr( "&Import" ) );
btnExport->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionSharingExport.svg" ) ) );
btnImport->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionSharingImport.svg" ) ) );
connect( btnExport, SIGNAL( triggered() ), this, SLOT( exportToXml() ) );
connect( btnImport, SIGNAL( triggered() ), this, SLOT( importFromXml() ) );
connect( btnExport, &QAction::triggered, this, &QgsBookmarks::exportToXml );
connect( btnImport, &QAction::triggered, this, &QgsBookmarks::importFromXml );
btnImpExp->setMenu( share );

connect( actionAdd, SIGNAL( triggered() ), this, SLOT( addClicked() ) );
connect( actionDelete, SIGNAL( triggered() ), this, SLOT( deleteClicked() ) );
connect( actionZoomTo, SIGNAL( triggered() ), this, SLOT( zoomToBookmark() ) );
connect( actionAdd, &QAction::triggered, this, &QgsBookmarks::addClicked );
connect( actionDelete, &QAction::triggered, this, &QgsBookmarks::deleteClicked );
connect( actionZoomTo, &QAction::triggered, this, &QgsBookmarks::zoomToBookmark );

mBookmarkToolbar->addWidget( btnImpExp );

@@ -394,9 +394,9 @@ void QgsBookmarks::exportToXml()

QgsProjectBookmarksTableModel::QgsProjectBookmarksTableModel()
{
QObject::connect(
QgisApp::instance(), SIGNAL( projectRead() ),
this, SLOT( projectRead() ) );
connect(
QgisApp::instance(), &QgisApp::projectRead,
this, &QgsProjectBookmarksTableModel::projectRead );
}

int QgsProjectBookmarksTableModel::rowCount( const QModelIndex &parent ) const
@@ -507,25 +507,25 @@ QgsMergedBookmarksTableModel::QgsMergedBookmarksTableModel( QAbstractTableModel
, mProjectOpen( false )
{
connect(
QgisApp::instance(), SIGNAL( projectRead() ),
this, SLOT( projectRead() ) );
QgisApp::instance(), &QgisApp::projectRead,
this, &QgsMergedBookmarksTableModel::projectRead );

connect(
&mQgisTableModel, SIGNAL( layoutChanged() ),
this, SLOT( allLayoutChanged() ) );
&mQgisTableModel, &QAbstractTableModel::layoutChanged,
this, &QgsMergedBookmarksTableModel::allLayoutChanged );
connect(
&mQgisTableModel, SIGNAL( dataChanged( const QModelIndex &, const QModelIndex & ) ),
this, SLOT( qgisDataChanged( const QModelIndex &, const QModelIndex & ) ) );
&mQgisTableModel, &QAbstractTableModel::dataChanged,
this, &QgsMergedBookmarksTableModel::qgisDataChanged );
connect(
&mQgisTableModel, SIGNAL( rowsInserted( const QModelIndex &, int, int ) ),
this, SLOT( allLayoutChanged() ) );
&mQgisTableModel, &QAbstractTableModel::rowsInserted,
this, &QgsMergedBookmarksTableModel::allLayoutChanged );
connect(
&mQgisTableModel, SIGNAL( rowsRemoved( const QModelIndex &, int, int ) ),
this, SLOT( allLayoutChanged() ) );
&mQgisTableModel, &QAbstractTableModel::rowsRemoved,
this, &QgsMergedBookmarksTableModel::allLayoutChanged );

connect(
&projectTableModel, SIGNAL( layoutChanged() ),
this, SLOT( allLayoutChanged() ) );
&projectTableModel, &QAbstractTableModel::layoutChanged,
this, &QgsMergedBookmarksTableModel::allLayoutChanged );
}

int QgsMergedBookmarksTableModel::rowCount( const QModelIndex &parent ) const
@@ -84,8 +84,8 @@ class QgsMergedBookmarksTableModel: public QAbstractTableModel
void moveBookmark( QAbstractTableModel &modelFrom, QAbstractTableModel &modelTo, int row );

private slots:
void projectRead() { mProjectOpen = true; };
void allLayoutChanged() { emit layoutChanged(); };
void projectRead() { mProjectOpen = true; }
void allLayoutChanged() { emit layoutChanged(); }
void qgisDataChanged( const QModelIndex &topLeft, const QModelIndex &bottomRight )
{
emit dataChanged( topLeft, bottomRight );
@@ -43,7 +43,7 @@ QgsClipboard::QgsClipboard()
, mFeatureFields()
, mUseSystemClipboard( false )
{
connect( QApplication::clipboard(), SIGNAL( dataChanged() ), this, SLOT( systemClipboardChanged() ) );
connect( QApplication::clipboard(), &QClipboard::dataChanged, this, &QgsClipboard::systemClipboardChanged );
}

QgsClipboard::~QgsClipboard()
@@ -57,10 +57,10 @@ QgsCustomizationDialog::QgsCustomizationDialog( QWidget * parent, QSettings * se

mLastDirSettingsName = QStringLiteral( "/UI/lastCustomizationDir" );
//treeWidget->hideColumn(0)
connect( buttonBox->button( QDialogButtonBox::Ok ), SIGNAL( clicked() ), this, SLOT( ok() ) );
connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) );
connect( buttonBox->button( QDialogButtonBox::Cancel ), SIGNAL( clicked() ), this, SLOT( cancel() ) );
connect( buttonBox->button( QDialogButtonBox::Reset ), SIGNAL( clicked() ), this, SLOT( reset() ) );
connect( buttonBox->button( QDialogButtonBox::Ok ), &QAbstractButton::clicked, this, &QgsCustomizationDialog::ok );
connect( buttonBox->button( QDialogButtonBox::Apply ), &QAbstractButton::clicked, this, &QgsCustomizationDialog::apply );
connect( buttonBox->button( QDialogButtonBox::Cancel ), &QAbstractButton::clicked, this, &QgsCustomizationDialog::cancel );
connect( buttonBox->button( QDialogButtonBox::Reset ), &QAbstractButton::clicked, this, &QgsCustomizationDialog::reset );

}

@@ -33,7 +33,7 @@ QgsDecorationCopyrightDialog::QgsDecorationCopyrightDialog( QgsDecorationCopyrig
restoreGeometry( settings.value( QStringLiteral( "Windows/DecorationCopyright/geometry" ) ).toByteArray() );

QPushButton *applyButton = buttonBox->button( QDialogButtonBox::Apply );
connect( applyButton, SIGNAL( clicked() ), this, SLOT( apply() ) );
connect( applyButton, &QAbstractButton::clicked, this, &QgsDecorationCopyrightDialog::apply );

grpEnable->setChecked( mDeco.enabled() );
// text
@@ -61,7 +61,7 @@ QgsDecorationGridDialog::QgsDecorationGridDialog( QgsDecorationGrid &deco, QWidg

updateGuiElements();

connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) );
connect( buttonBox->button( QDialogButtonBox::Apply ), &QAbstractButton::clicked, this, &QgsDecorationGridDialog::apply );

}

@@ -31,7 +31,7 @@ QgsDecorationNorthArrowDialog::QgsDecorationNorthArrowDialog( QgsDecorationNorth
restoreGeometry( settings.value( QStringLiteral( "Windows/DecorationNorthArrow/geometry" ) ).toByteArray() );

QPushButton *applyButton = buttonBox->button( QDialogButtonBox::Apply );
connect( applyButton, SIGNAL( clicked() ), this, SLOT( apply() ) );
connect( applyButton, &QAbstractButton::clicked, this, &QgsDecorationNorthArrowDialog::apply );

// rotation
rotatePixmap( mDeco.mRotationInt );
@@ -30,7 +30,7 @@ QgsDecorationScaleBarDialog::QgsDecorationScaleBarDialog( QgsDecorationScaleBar
restoreGeometry( settings.value( QStringLiteral( "Windows/DecorationScaleBar/geometry" ) ).toByteArray() );

QPushButton *applyButton = buttonBox->button( QDialogButtonBox::Apply );
connect( applyButton, SIGNAL( clicked() ), this, SLOT( apply() ) );
connect( applyButton, &QAbstractButton::clicked, this, &QgsDecorationScaleBarDialog::apply );

// set the map units in the spin box
spnSize->setShowClearButton( false );
@@ -440,10 +440,10 @@ QgsDxfExportDialog::QgsDxfExportDialog( QWidget *parent, Qt::WindowFlags f )
mTreeView->resizeColumnToContents( 0 );
mTreeView->header()->show();

connect( mFileLineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( setOkEnabled() ) );
connect( this, SIGNAL( accepted() ), this, SLOT( saveSettings() ) );
connect( mSelectAllButton, SIGNAL( clicked() ), this, SLOT( selectAll() ) );
connect( mDeselectAllButton, SIGNAL( clicked() ), this, SLOT( deSelectAll() ) );
connect( mFileLineEdit, &QLineEdit::textChanged, this, &QgsDxfExportDialog::setOkEnabled );
connect( this, &QDialog::accepted, this, &QgsDxfExportDialog::saveSettings );
connect( mSelectAllButton, &QAbstractButton::clicked, this, &QgsDxfExportDialog::selectAll );
connect( mDeselectAllButton, &QAbstractButton::clicked, this, &QgsDxfExportDialog::deSelectAll );

mFileLineEdit->setFocus();

@@ -84,11 +84,11 @@ QgsAttributeDialog *QgsFeatureAction::newDialog( bool cloneFeature )
QgsFeature &feat = const_cast<QgsFeature &>( *dialog->feature() );
QgsFeatureAction *a = new QgsFeatureAction( action.name(), feat, mLayer, action.id(), -1, dialog );
dialog->addAction( a );
connect( a, SIGNAL( triggered() ), a, SLOT( execute() ) );
connect( a, &QAction::triggered, a, &QgsFeatureAction::execute );

QAbstractButton *pb = dialog->findChild<QAbstractButton *>( action.name() );
if ( pb )
connect( pb, SIGNAL( clicked() ), a, SLOT( execute() ) );
connect( pb, &QAbstractButton::clicked, a, &QgsFeatureAction::execute );
}
}

@@ -207,7 +207,7 @@ bool QgsFeatureAction::addFeature( const QgsAttributeMap &defaultAttributes, boo
dialog->setMode( QgsAttributeForm::AddFeatureMode );
dialog->setEditCommandMessage( text() );

connect( dialog->attributeForm(), SIGNAL( featureSaved( const QgsFeature & ) ), this, SLOT( onFeatureSaved( const QgsFeature & ) ) );
connect( dialog->attributeForm(), &QgsAttributeForm::featureSaved, this, &QgsFeatureAction::onFeatureSaved );

if ( !showModal )
{
@@ -51,8 +51,8 @@ QgsFieldCalculator::QgsFieldCalculator( QgsVectorLayer *vl, QWidget *parent )
populateFields();
populateOutputFieldTypes();

connect( builder, SIGNAL( expressionParsed( bool ) ), this, SLOT( setOkButtonState() ) );
connect( mOutputFieldWidthSpinBox, SIGNAL( editingFinished() ), this, SLOT( setPrecisionMinMax() ) );
connect( builder, &QgsExpressionBuilderWidget::expressionParsed, this, &QgsFieldCalculator::setOkButtonState );
connect( mOutputFieldWidthSpinBox, &QAbstractSpinBox::editingFinished, this, &QgsFieldCalculator::setPrecisionMinMax );

QgsDistanceArea myDa;
myDa.setSourceCrs( vl->crs() );
@@ -63,11 +63,11 @@ QgsFieldsProperties::QgsFieldsProperties( QgsVectorLayer *layer, QWidget *parent
mToggleEditingButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionToggleEditing.svg" ) ) );
mCalculateFieldButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionCalculateField.svg" ) ) );

connect( mToggleEditingButton, SIGNAL( clicked() ), this, SIGNAL( toggleEditing() ) );
connect( mLayer, SIGNAL( editingStarted() ), this, SLOT( editingToggled() ) );
connect( mLayer, SIGNAL( editingStopped() ), this, SLOT( editingToggled() ) );
connect( mLayer, SIGNAL( attributeAdded( int ) ), this, SLOT( attributeAdded( int ) ) );
connect( mLayer, SIGNAL( attributeDeleted( int ) ), this, SLOT( attributeDeleted( int ) ) );
connect( mToggleEditingButton, &QAbstractButton::clicked, this, &QgsFieldsProperties::toggleEditing );
connect( mLayer, &QgsVectorLayer::editingStarted, this, &QgsFieldsProperties::editingToggled );
connect( mLayer, &QgsVectorLayer::editingStopped, this, &QgsFieldsProperties::editingToggled );
connect( mLayer, &QgsVectorLayer::attributeAdded, this, &QgsFieldsProperties::attributeAdded );
connect( mLayer, &QgsVectorLayer::attributeDeleted, this, &QgsFieldsProperties::attributeDeleted );

// tab and group display
mAddItemButton->setEnabled( false );
@@ -100,8 +100,8 @@ QgsFieldsProperties::QgsFieldsProperties( QgsVectorLayer *layer, QWidget *parent
mFieldsList->setSelectionMode( QAbstractItemView::ExtendedSelection );
mFieldsList->verticalHeader()->hide();

connect( mDesignerTree, SIGNAL( itemSelectionChanged() ), this, SLOT( onAttributeSelectionChanged() ) );
connect( mFieldsList, SIGNAL( itemSelectionChanged() ), this, SLOT( onAttributeSelectionChanged() ) );
connect( mDesignerTree, &QTreeWidget::itemSelectionChanged, this, &QgsFieldsProperties::onAttributeSelectionChanged );
connect( mFieldsList, &QTableWidget::itemSelectionChanged, this, &QgsFieldsProperties::onAttributeSelectionChanged );

mRelationsList = new DragList( mRelationsFrame );
mRelationsFrameLayout->addWidget( mRelationsList );
@@ -262,7 +262,7 @@ void QgsFieldsProperties::loadAttributeEditorTree()

void QgsFieldsProperties::loadRows()
{
disconnect( mFieldsList, SIGNAL( cellChanged( int, int ) ), this, SLOT( attributesListCellChanged( int, int ) ) );
disconnect( mFieldsList, &QTableWidget::cellChanged, this, &QgsFieldsProperties::attributesListCellChanged );
const QgsFields &fields = mLayer->fields();

mIndexedWidgets.clear();
@@ -272,7 +272,7 @@ void QgsFieldsProperties::loadRows()
attributeAdded( i );

mFieldsList->resizeColumnsToContents();
connect( mFieldsList, SIGNAL( cellChanged( int, int ) ), this, SLOT( attributesListCellChanged( int, int ) ) );
connect( mFieldsList, &QTableWidget::cellChanged, this, &QgsFieldsProperties::attributesListCellChanged );
updateFieldRenamingStatus();
}

@@ -310,7 +310,7 @@ void QgsFieldsProperties::setRow( int row, int idx, const QgsField &field )
QToolButton *editExpressionButton = new QToolButton;
editExpressionButton->setProperty( "Index", idx );
editExpressionButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mIconExpression.svg" ) ) );
connect( editExpressionButton, SIGNAL( clicked() ), this, SLOT( updateExpression() ) );
connect( editExpressionButton, &QAbstractButton::clicked, this, &QgsFieldsProperties::updateExpression );
expressionWidget->layout()->setContentsMargins( 0, 0, 0, 0 );
expressionWidget->layout()->addWidget( editExpressionButton );
expressionWidget->layout()->addWidget( new QLabel( mLayer->expressionField( idx ) ) );
@@ -343,7 +343,7 @@ void QgsFieldsProperties::setRow( int row, int idx, const QgsField &field )
cfg.mButton = pb;
mFieldsList->setCellWidget( row, AttrEditTypeCol, pb );

connect( pb, SIGNAL( pressed() ), this, SLOT( attributeTypeDialog() ) );
connect( pb, &QAbstractButton::pressed, this, &QgsFieldsProperties::attributeTypeDialog );

setConfigForRow( row, cfg );

@@ -1167,7 +1167,7 @@ DesignerTree::DesignerTree( QgsVectorLayer *layer, QWidget *parent )
: QTreeWidget( parent )
, mLayer( layer )
{
connect( this, SIGNAL( itemDoubleClicked( QTreeWidgetItem *, int ) ), this, SLOT( onItemDoubleClicked( QTreeWidgetItem *, int ) ) );
connect( this, &QTreeWidget::itemDoubleClicked, this, &DesignerTree::onItemDoubleClicked );
}

QTreeWidgetItem *DesignerTree::addItem( QTreeWidgetItem *parent, QgsFieldsProperties::DesignerTreeItemData data )
@@ -1370,8 +1370,8 @@ void DesignerTree::onItemDoubleClicked( QTreeWidgetItem *item, int column )
QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok
| QDialogButtonBox::Cancel );

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

layout->addWidget( buttonBox );

@@ -1408,8 +1408,8 @@ void DesignerTree::onItemDoubleClicked( QTreeWidgetItem *item, int column )

QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel );

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

dlg.layout()->addWidget( buttonBox );

@@ -1434,8 +1434,8 @@ void DesignerTree::onItemDoubleClicked( QTreeWidgetItem *item, int column )
QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok
| QDialogButtonBox::Cancel );

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

dlg.layout()->addWidget( buttonBox );

@@ -178,8 +178,8 @@ void QgsGuiVectorLayerTools::commitError( QgsVectorLayer *vlayer ) const
showMore->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Preferred );
showMore->addAction( act );
showMore->setDefaultAction( act );
connect( showMore, SIGNAL( triggered( QAction * ) ), mv, SLOT( exec() ) );
connect( showMore, SIGNAL( triggered( QAction * ) ), showMore, SLOT( deleteLater() ) );
connect( showMore, &QToolButton::triggered, mv, &QDialog::exec );
connect( showMore, &QToolButton::triggered, showMore, &QObject::deleteLater );

// no timeout set, since notice needs attention and is only shown first time layer is labeled
QgsMessageBarItem *errorMsg = new QgsMessageBarItem(
@@ -72,9 +72,9 @@ QgsHandleBadLayers::QgsHandleBadLayers( const QList<QDomNode> &layers )
buttonBox->addButton( mBrowseButton, QDialogButtonBox::ActionRole );
mBrowseButton->setDisabled( true );

connect( mLayerList, SIGNAL( itemSelectionChanged() ), this, SLOT( selectionChanged() ) );
connect( mBrowseButton, SIGNAL( clicked() ), this, SLOT( browseClicked() ) );
connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) );
connect( mLayerList, &QTableWidget::itemSelectionChanged, this, &QgsHandleBadLayers::selectionChanged );
connect( mBrowseButton, &QAbstractButton::clicked, this, &QgsHandleBadLayers::browseClicked );
connect( buttonBox->button( QDialogButtonBox::Apply ), &QAbstractButton::clicked, this, &QgsHandleBadLayers::apply );

mLayerList->clear();
mLayerList->setSortingEnabled( true );
@@ -133,7 +133,7 @@ QgsHandleBadLayers::QgsHandleBadLayers( const QList<QDomNode> &layers )
btn->setMinimumHeight( 24 );
btn->setText( tr( "Edit" ) );
btn->setProperty( "row", j );
connect( btn, SIGNAL( clicked() ), this, SLOT( editAuthCfg() ) );
connect( btn, &QAbstractButton::clicked, this, &QgsHandleBadLayers::editAuthCfg );
mLayerList->setCellWidget( j, 3, btn );
}
else

0 comments on commit 943d1a2

Please sign in to comment.