Skip to content

Commit

Permalink
Avoid use of QString("")
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 7, 2015
1 parent 1412426 commit 94badce
Show file tree
Hide file tree
Showing 32 changed files with 58 additions and 62 deletions.
4 changes: 2 additions & 2 deletions python/gui/qgisinterface.sip
Expand Up @@ -179,15 +179,15 @@ class QgisInterface : QObject
* @return pointer to composer's view
* @note new composer window will be shown and activated
*/
virtual QgsComposerView* createNewComposer( QString title = QString( "" ) ) = 0;
virtual QgsComposerView* createNewComposer( QString title = QString() ) = 0;

/** Duplicate an existing parent composer from composer view
* @param composerView pointer to existing composer view
* @param title window title for duplicated composer (one will be generated if empty)
* @return pointer to duplicate composer's view
* @note dupicate composer window will be hidden until loaded, then shown and activated
*/
virtual QgsComposerView* duplicateComposer( QgsComposerView* composerView, QString title = QString( "" ) ) = 0;
virtual QgsComposerView* duplicateComposer( QgsComposerView* composerView, QString title = QString() ) = 0;

/** Deletes parent composer of composer view, after closing composer window */
virtual void deleteComposer( QgsComposerView* composerView ) = 0;
Expand Down
4 changes: 2 additions & 2 deletions python/gui/qgsdatadefinedbutton.sip
Expand Up @@ -46,7 +46,7 @@ class QgsDataDefinedButton : QToolButton
const QgsVectorLayer* vl = 0,
const QgsDataDefined* datadefined = 0,
DataTypes datatypes = AnyType,
QString description = "" );
QString description = QString() );
~QgsDataDefinedButton();

/**
Expand All @@ -60,7 +60,7 @@ class QgsDataDefinedButton : QToolButton
void init( const QgsVectorLayer* vl,
const QgsDataDefined* datadefined = 0,
DataTypes datatypes = AnyType,
QString description = QString( "" ) );
QString description = QString() );

QMap< QString, QString > definedProperty() const;

Expand Down
2 changes: 1 addition & 1 deletion src/app/composer/qgscomposermanager.cpp
Expand Up @@ -96,7 +96,7 @@ QgsComposerManager::QgsComposerManager( QWidget * parent, Qt::WindowFlags f ): Q
}
}

mTemplatePathLineEdit->setText( settings.value( "/UI/ComposerManager/templatePath", QString( "" ) ).toString() );
mTemplatePathLineEdit->setText( settings.value( "/UI/ComposerManager/templatePath", QString() ).toString() );

refreshComposers();
}
Expand Down
7 changes: 3 additions & 4 deletions src/app/qgisapp.cpp
Expand Up @@ -5736,13 +5736,12 @@ QString QgisApp::uniqueComposerTitle( QWidget* parent, bool acceptEmpty, const Q
}
else
{
newTitle = QString( "" );
titleValid = true;
}
}
else if ( cNames.indexOf( newTitle, 1 ) >= 0 )
{
cNames[0] = QString( "" ); // clear non-unique name
cNames[0] = QString(); // clear non-unique name
titleMsg = chooseMsg + "\n\n" + tr( "Title already exists!" );
}
else
Expand Down Expand Up @@ -7400,7 +7399,7 @@ void QgisApp::duplicateLayers( QList<QgsMapLayer *> lyrList )
foreach ( QgsMapLayer * selectedLyr, selectedLyrs )
{
dupLayer = 0;
unSppType = QString( "" );
unSppType.clear();
layerDupName = selectedLyr->name() + " " + tr( "copy" );

if ( selectedLyr->type() == QgsMapLayer::PluginLayer )
Expand Down Expand Up @@ -10212,7 +10211,7 @@ void QgisApp::oldProjectVersionWarning( QString oldVersion )
.replace( QString( "<p>" ), QString( "\n\n" ) )
.replace( QString( "<br>" ), QString( "\n" ) )
.replace( QString( "<a href=\"http://hub.qgis.org/projects/quantum-gis\">http://hub.qgis.org/projects/quantum-gis</a> " ), QString( "\nhttp://hub.qgis.org/projects/quantum-gis" ) )
.replace( QRegExp( "</?tt>" ), QString( "" ) )
.replace( QRegExp( "</?tt>" ), QString() )
);
box.exec();
#else
Expand Down
6 changes: 3 additions & 3 deletions src/app/qgisapp.h
Expand Up @@ -256,14 +256,14 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
* @param currentTitle base name for initial title choice
* @return QString::null if user cancels input dialog
*/
QString uniqueComposerTitle( QWidget *parent, bool acceptEmpty, const QString& currentTitle = QString( "" ) );
QString uniqueComposerTitle( QWidget *parent, bool acceptEmpty, const QString& currentTitle = QString() );
/** Creates a new composer and returns a pointer to it*/
QgsComposer* createNewComposer( QString title = QString( "" ) );
QgsComposer* createNewComposer( QString title = QString() );
/** Deletes a composer and removes entry from Set*/
void deleteComposer( QgsComposer *c );
/** Duplicates a composer and adds it to Set
*/
QgsComposer *duplicateComposer( QgsComposer *currentComposer, QString title = QString( "" ) );
QgsComposer *duplicateComposer( QgsComposer *currentComposer, QString title = QString() );

/** Overloaded function used to sort menu entries alphabetically */
QMenu* createPopupMenu() override;
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgisappinterface.h
Expand Up @@ -196,7 +196,7 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
* @return pointer to composer's view
* @note new composer window will be shown and activated
*/
QgsComposerView* createNewComposer( QString title = QString( "" ) ) override;
QgsComposerView* createNewComposer( QString title = QString() ) override;

// ### QGIS 3: return QgsComposer*, not QgsComposerView*
/** Duplicate an existing parent composer from composer view
Expand All @@ -205,7 +205,7 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
* @return pointer to duplicate composer's view
* @note dupicate composer window will be hidden until loaded, then shown and activated
*/
QgsComposerView* duplicateComposer( QgsComposerView* composerView, QString title = QString( "" ) ) override;
QgsComposerView* duplicateComposer( QgsComposerView* composerView, QString title = QString() ) override;

/** Deletes parent composer of composer view, after closing composer window */
void deleteComposer( QgsComposerView* composerView ) override;
Expand Down
3 changes: 1 addition & 2 deletions src/app/qgisappstylesheet.cpp
Expand Up @@ -99,8 +99,7 @@ QMap<QString, QVariant> QgisAppStyleSheet::defaultOptions()

void QgisAppStyleSheet::buildStyleSheet( const QMap<QString, QVariant>& opts )
{
QString ss = QString( "" );

QString ss;

// QgisApp-wide font
QString fontSize = opts.value( "fontPointSize" ).toString();
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsdecorationgrid.cpp
Expand Up @@ -191,7 +191,7 @@ void QgsDecorationGrid::saveToProject()
}
if ( mMarkerSymbol )
{
doc.setContent( QString( "" ) );
doc.setContent( QString() );
elem = QgsSymbolLayerV2Utils::saveSymbol( "marker symbol", mMarkerSymbol, doc );
doc.appendChild( elem );
QgsProject::instance()->writeEntry( mNameConfig, "/MarkerSymbol", doc.toString() );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsmaptoolrotatefeature.cpp
Expand Up @@ -46,7 +46,7 @@ QgsAngleMagnetWidget::QgsAngleMagnetWidget( QString label , QWidget *parent )
//mLayout->setAlignment( Qt::AlignLeft );
setLayout( mLayout );

if ( !label.isNull() )
if ( !label.isEmpty() )
{
QLabel* lbl = new QLabel( label, this );
lbl->setAlignment( Qt::AlignRight | Qt::AlignCenter );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsmaptoolrotatefeature.h
Expand Up @@ -33,7 +33,7 @@ class APP_EXPORT QgsAngleMagnetWidget : public QWidget

public:

explicit QgsAngleMagnetWidget( QString label = QString( "" ), QWidget *parent = 0 );
explicit QgsAngleMagnetWidget( QString label = QString(), QWidget *parent = 0 );

~QgsAngleMagnetWidget();

Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsoptions.cpp
Expand Up @@ -178,7 +178,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl ) :
varStrItms << varStrName << varStrValue;

// check if different than system variable
QString sysVarVal = QString( "" );
QString sysVarVal;
bool sysVarMissing = !sysVarsMap.contains( varStrName );
if ( sysVarMissing )
sysVarVal = tr( "not present" );
Expand Down Expand Up @@ -1554,7 +1554,7 @@ void QgsOptions::addCustomEnvVarRow( QString varName, QString varVal, QString va

void QgsOptions::on_mAddCustomVarBtn_clicked()
{
addCustomEnvVarRow( QString( "" ), QString( "" ) );
addCustomEnvVarRow( QString(), QString() );
mCustomVariablesTable->setFocus();
mCustomVariablesTable->setCurrentCell( mCustomVariablesTable->rowCount() - 1, 1 );
mCustomVariablesTable->edit( mCustomVariablesTable->currentIndex() );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgspluginregistry.cpp
Expand Up @@ -507,7 +507,7 @@ void QgsPluginRegistry::restoreSessionPlugins( QString thePluginDirString )
{
if ( corePlugins.contains( packageName ) )
{
QgsApplication::setPkgDataPath( QString( "" ) );
QgsApplication::setPkgDataPath( QString() );
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposermousehandles.cpp
Expand Up @@ -705,7 +705,7 @@ void QgsComposerMouseHandles::resetStatusBar()
else
{
//clear status bar message
mComposition->setStatusMessage( QString( "" ) );
mComposition->setStatusMessage( QString() );
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/core/qgspallabeling.cpp
Expand Up @@ -94,7 +94,6 @@ QgsPalLayerSettings::QgsPalLayerSettings()

// text style
textFont = QApplication::font();
textNamedStyle = QString( "" );
fontSizeInMapUnits = false;
textColor = Qt::black;
textTransp = 0;
Expand Down Expand Up @@ -4329,7 +4328,7 @@ void QgsPalLabeling::drawLabeling( QgsRenderContext& context )
//for diagrams, remove the additional 'd' at the end of the layer id
QString layerId = layerName;
layerId.chop( 1 );
mResults->mLabelSearchTree->insertLabel( *it, QString( palGeometry->strId() ).toInt(), layerId, QString( "" ), QFont(), true, false );
mResults->mLabelSearchTree->insertLabel( *it, QString( palGeometry->strId() ).toInt(), layerId, QString(), QFont(), true, false );
}
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsproject.cpp
Expand Up @@ -559,7 +559,7 @@ static QgsProjectVersion _getVersion( QDomDocument const &doc )
if ( !nl.count() )
{
QgsDebugMsg( " unable to find qgis element in project file" );
return QgsProjectVersion( 0, 0, 0, QString( "" ) );
return QgsProjectVersion( 0, 0, 0, QString() );
}

QDomNode qgisNode = nl.item( 0 ); // there should only be one, so zeroth element ok
Expand Down
3 changes: 1 addition & 2 deletions src/core/qgsprojectversion.cpp
Expand Up @@ -37,7 +37,6 @@ QgsProjectVersion::QgsProjectVersion( QString string )

mMinor = 0;
mSub = 0;
mName = "";
mMajor = fileVersionParts.at( 0 ).toInt();

if ( fileVersionParts.size() > 1 )
Expand Down Expand Up @@ -83,7 +82,7 @@ bool QgsProjectVersion::operator>( const QgsProjectVersion &other )

QString QgsProjectVersion::text()
{
if ( mName.isNull() )
if ( mName.isEmpty() )
{
return QString( "%1.%2.%3" ).arg( mMajor ).arg( mMinor ).arg( mSub );
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgisgui.cpp
Expand Up @@ -42,7 +42,7 @@ namespace QgisGui
}
else //we have to use non-native dialog to add cancel all button
{
QgsEncodingFileDialog* openFileDialog = new QgsEncodingFileDialog( 0, title, lastUsedDir, filters, QString( "" ) );
QgsEncodingFileDialog* openFileDialog = new QgsEncodingFileDialog( 0, title, lastUsedDir, filters, QString() );

// allow for selection of more than one file
openFileDialog->setFileMode( QFileDialog::ExistingFiles );
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgisinterface.h
Expand Up @@ -230,15 +230,15 @@ class GUI_EXPORT QgisInterface : public QObject
* @return pointer to composer's view
* @note new composer window will be shown and activated
*/
virtual QgsComposerView* createNewComposer( QString title = QString( "" ) ) = 0;
virtual QgsComposerView* createNewComposer( QString title = QString() ) = 0;

/** Duplicate an existing parent composer from composer view
* @param composerView pointer to existing composer view
* @param title window title for duplicated composer (one will be generated if empty)
* @return pointer to duplicate composer's view
* @note dupicate composer window will be hidden until loaded, then shown and activated
*/
virtual QgsComposerView* duplicateComposer( QgsComposerView* composerView, QString title = QString( "" ) ) = 0;
virtual QgsComposerView* duplicateComposer( QgsComposerView* composerView, QString title = QString() ) = 0;

/** Deletes parent composer of composer view, after closing composer window */
virtual void deleteComposer( QgsComposerView* composerView ) = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgscollapsiblegroupbox.cpp
Expand Up @@ -190,7 +190,7 @@ void QgsCollapsibleGroupBoxBasic::changeEvent( QEvent *event )
void QgsCollapsibleGroupBoxBasic::setSyncGroup( QString grp )
{
mSyncGroup = grp;
QString tipTxt = QString( "" );
QString tipTxt;
if ( !grp.isEmpty() )
{
tipTxt = tr( "Ctrl (or Alt)-click to toggle all" ) + "\n" + tr( "Shift-click to expand, then collapse others" );
Expand Down
14 changes: 7 additions & 7 deletions src/gui/qgsdatadefinedbutton.cpp
Expand Up @@ -120,8 +120,8 @@ void QgsDataDefinedButton::init( const QgsVectorLayer* vl,
{
mProperty.insert( "active", "0" );
mProperty.insert( "useexpr", "0" );
mProperty.insert( "expression", "" );
mProperty.insert( "field", "" );
mProperty.insert( "expression", QString() );
mProperty.insert( "field", QString() );
}
else
{
Expand All @@ -136,12 +136,12 @@ void QgsDataDefinedButton::init( const QgsVectorLayer* vl,
mFieldTypeList.clear();

mInputDescription = description;
mFullDescription = QString( "" );
mUsageInfo = QString( "" );
mCurrentDefinition = QString( "" );
mFullDescription.clear();
mUsageInfo.clear();
mCurrentDefinition.clear();

// set up data types string
mDataTypesString = QString( "" );
mDataTypesString.clear();

QStringList ts;
if ( mDataTypes.testFlag( String ) )
Expand Down Expand Up @@ -442,7 +442,7 @@ void QgsDataDefinedButton::menuActionTriggered( QAction* action )
setUseExpression( false );
setActive( false );
}
setExpression( QString( "" ) );
setExpression( QString() );
updateGui();
}
else if ( action == mActionAssistant )
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsdatadefinedbutton.h
Expand Up @@ -72,7 +72,7 @@ class GUI_EXPORT QgsDataDefinedButton: public QToolButton
const QgsVectorLayer* vl = 0,
const QgsDataDefined* datadefined = 0,
DataTypes datatypes = AnyType,
QString description = "" );
QString description = QString() );
~QgsDataDefinedButton();

/**
Expand All @@ -86,7 +86,7 @@ class GUI_EXPORT QgsDataDefinedButton: public QToolButton
void init( const QgsVectorLayer* vl,
const QgsDataDefined* datadefined = 0,
DataTypes datatypes = AnyType,
QString description = QString( "" ) );
QString description = QString() );

QMap< QString, QString > definedProperty() const { return mProperty; }

Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsmessagebar.cpp
Expand Up @@ -339,7 +339,7 @@ void QgsMessageBar::resetCountdown()

void QgsMessageBar::updateItemCount()
{
mItemCount->setText( mItems.count() > 0 ? tr( "%n more", "unread messages", mItems.count() ) : QString( "" ) );
mItemCount->setText( mItems.count() > 0 ? tr( "%n more", "unread messages", mItems.count() ) : QString() );

// do not show the down arrow for opening menu with "close all" if there is just one message
mCloseBtn->setMenu( mItems.count() > 0 ? mCloseMenu : 0 );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsprojectionselector.cpp
Expand Up @@ -308,7 +308,7 @@ QString QgsProjectionSelector::selectedProj4String()
{
databaseFileName = QgsApplication::qgisUserDbFilePath();
if ( !QFileInfo( databaseFileName ).exists() ) //its unlikely that this condition will ever be reached
return QString( "" );
return QString();
}
else //must be a system projection then
{
Expand Down
4 changes: 2 additions & 2 deletions src/gui/symbology-ng/qgssvgselectorwidget.cpp
Expand Up @@ -266,7 +266,7 @@ void QgsSvgSelectorWidget::on_mFilePushButton_clicked()
QFileInfo fi( file );
if ( !fi.exists() || !fi.isReadable() )
{
updateCurrentSvgPath( QString( "" ) );
updateCurrentSvgPath( QString() );
updateLineEditFeedback( false );
return;
}
Expand All @@ -288,7 +288,7 @@ void QgsSvgSelectorWidget::on_mFileLineEdit_textChanged( const QString& text )
bool validSVG = !resolvedPath.isNull();

updateLineEditFeedback( validSVG, resolvedPath );
updateCurrentSvgPath( validSVG ? resolvedPath : QString( "" ) );
updateCurrentSvgPath( validSVG ? resolvedPath : QString() );
}

void QgsSvgSelectorWidget::populateList()
Expand Down
2 changes: 1 addition & 1 deletion src/gui/symbology-ng/qgssvgselectorwidget.h
Expand Up @@ -101,7 +101,7 @@ class GUI_EXPORT QgsSvgSelectorWidget : public QWidget, private Ui::WidgetSvgSel
void updateCurrentSvgPath( const QString& svgPath );

void on_mFilePushButton_clicked();
void updateLineEditFeedback( bool ok, QString tip = QString( "" ) );
void updateLineEditFeedback( bool ok, QString tip = QString() );
void on_mFileLineEdit_textChanged( const QString& text );

private:
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/grass/qgsgrassmoduleparam.cpp
Expand Up @@ -994,8 +994,8 @@ void QgsGrassModuleInput::updateQgisLayers()
// layer containers.
if ( !mRequired )
{
mMaps.push_back( QString( "" ) );
mVectorLayerNames.push_back( QString( "" ) );
mMaps.push_back( QString() );
mVectorLayerNames.push_back( QString() );
mMapLayers.push_back( NULL );
mBands.append( 0 );
mLayerComboBox->addItem( tr( "Select a layer" ), QVariant() );
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/spatialquery/qgsspatialquerydialog.cpp
Expand Up @@ -256,7 +256,7 @@ QString QgsSpatialQueryDialog::getSubsetFIDs( const QgsFeatureIds *fids, QString
{
if ( fids->size() == 0 )
{
return QString( "" );
return QString();
}
QSetIterator <QgsFeatureId> item( *fids );
QStringList lstFID;
Expand Down
2 changes: 1 addition & 1 deletion src/providers/gdal/qgsgdalprovider.cpp
Expand Up @@ -913,7 +913,7 @@ QString QgsGdalProvider::generateBandName( int theBandNumber ) const
val = values.at( 1 );
if ( values.at( 0 ) == "NETCDF_DIM_EXTRA" )
{
dimExtraValues = val.replace( QString( "{" ), QString( "" ) ).replace( QString( "}" ), QString( "" ) ).split( "," );
dimExtraValues = val.replace( QString( "{" ), QString() ).replace( QString( "}" ), QString() ).split( "," );
//http://qt-project.org/doc/qt-4.8/qregexp.html#capturedTexts
}
else
Expand Down

0 comments on commit 94badce

Please sign in to comment.