Skip to content
Permalink
Browse files

Avoid use of QString("")

  • Loading branch information
nyalldawson committed Sep 7, 2015
1 parent 1412426 commit 94badce431a0025160ea8eb1de8006e65bd31a37
@@ -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;
@@ -46,7 +46,7 @@ class QgsDataDefinedButton : QToolButton
const QgsVectorLayer* vl = 0,
const QgsDataDefined* datadefined = 0,
DataTypes datatypes = AnyType,
QString description = "" );
QString description = QString() );
~QgsDataDefinedButton();

/**
@@ -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;

@@ -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();
}
@@ -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
@@ -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 )
@@ -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
@@ -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;
@@ -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
@@ -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;
@@ -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();
@@ -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() );
@@ -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 );
@@ -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();

@@ -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" );
@@ -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() );
@@ -507,7 +507,7 @@ void QgsPluginRegistry::restoreSessionPlugins( QString thePluginDirString )
{
if ( corePlugins.contains( packageName ) )
{
QgsApplication::setPkgDataPath( QString( "" ) );
QgsApplication::setPkgDataPath( QString() );
}
else
{
@@ -705,7 +705,7 @@ void QgsComposerMouseHandles::resetStatusBar()
else
{
//clear status bar message
mComposition->setStatusMessage( QString( "" ) );
mComposition->setStatusMessage( QString() );
}
}

@@ -94,7 +94,6 @@ QgsPalLayerSettings::QgsPalLayerSettings()

// text style
textFont = QApplication::font();
textNamedStyle = QString( "" );
fontSizeInMapUnits = false;
textColor = Qt::black;
textTransp = 0;
@@ -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;
}
@@ -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
@@ -37,7 +37,6 @@ QgsProjectVersion::QgsProjectVersion( QString string )

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

if ( fileVersionParts.size() > 1 )
@@ -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 );
}
@@ -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 );
@@ -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;
@@ -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" );
@@ -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
{
@@ -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 ) )
@@ -442,7 +442,7 @@ void QgsDataDefinedButton::menuActionTriggered( QAction* action )
setUseExpression( false );
setActive( false );
}
setExpression( QString( "" ) );
setExpression( QString() );
updateGui();
}
else if ( action == mActionAssistant )
@@ -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();

/**
@@ -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; }

@@ -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 );
@@ -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
{
@@ -266,7 +266,7 @@ void QgsSvgSelectorWidget::on_mFilePushButton_clicked()
QFileInfo fi( file );
if ( !fi.exists() || !fi.isReadable() )
{
updateCurrentSvgPath( QString( "" ) );
updateCurrentSvgPath( QString() );
updateLineEditFeedback( false );
return;
}
@@ -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()
@@ -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:
@@ -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() );
@@ -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;
@@ -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

0 comments on commit 94badce

Please sign in to comment.
You can’t perform that action at this time.