Skip to content

Commit aed6c73

Browse files
committedFeb 7, 2017
Swap QScopedPointer to std::unique_ptr
Why? - no benefits to QScopedPointer over std::unique_ptr - unlike QScopedPointer, std::unique_ptr has no overhead over regular pointers - using standard language features makes it more likely that compilers can optimise this use and static analysers can correctly handle code using unique_ptrs - QScopedPointer has an (IMO) uncertain future (given that Qt is dropping features which have become part of the c++ standard). Better to port now before wider use of QScopedPointer in the codebase!
1 parent 9475850 commit aed6c73

File tree

170 files changed

+680
-659
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

170 files changed

+680
-659
lines changed
 

‎src/app/composer/qgscomposer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ void QgsComposer::setTitle( const QString& title )
913913
bool QgsComposer::loadFromTemplate( const QDomDocument& templateDoc, bool clearExisting )
914914
{
915915
// provide feedback, since composer will be hidden when loading template (much faster)
916-
QScopedPointer< QDialog > dlg( new QgsBusyIndicatorDialog( tr( "Loading template into composer..." ), this ) );
916+
std::unique_ptr< QDialog > dlg( new QgsBusyIndicatorDialog( tr( "Loading template into composer..." ), this ) );
917917
dlg->setStyleSheet( mQgis->styleSheet() );
918918
dlg->show();
919919

‎src/app/dwg/qgsdwgimportdialog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ void QgsDwgImportDialog::on_pbLoadDatabase_clicked()
155155

156156
bool lblVisible = false;
157157

158-
QScopedPointer<QgsVectorLayer> d( new QgsVectorLayer( QString( "%1|layername=drawing" ).arg( leDatabase->text() ), "layers", "ogr", false ) );
158+
std::unique_ptr<QgsVectorLayer> d( new QgsVectorLayer( QString( "%1|layername=drawing" ).arg( leDatabase->text() ), "layers", "ogr", false ) );
159159
if ( d && d->isValid() )
160160
{
161161
int idxPath = d->fields().lookupField( "path" );
@@ -190,7 +190,7 @@ void QgsDwgImportDialog::on_pbLoadDatabase_clicked()
190190

191191
lblMessage->setVisible( lblVisible );
192192

193-
QScopedPointer<QgsVectorLayer> l( new QgsVectorLayer( QString( "%1|layername=layers" ).arg( leDatabase->text() ), "layers", "ogr", false ) );
193+
std::unique_ptr<QgsVectorLayer> l( new QgsVectorLayer( QString( "%1|layername=layers" ).arg( leDatabase->text() ), "layers", "ogr", false ) );
194194
if ( l && l->isValid() )
195195
{
196196
int idxName = l->fields().lookupField( "name" );

0 commit comments

Comments
 (0)
Please sign in to comment.