Skip to content
Permalink
Browse files
Fix coverity use of uninitialized variable error
  • Loading branch information
nyalldawson committed Mar 21, 2017
1 parent f0709ae commit 545da60a77c00534c77dddddef6eca8f138f525e
Showing with 16 additions and 12 deletions.
  1. +8 −7 src/gui/qgssublayersdialog.cpp
  2. +8 −5 src/gui/qgssublayersdialog.h
@@ -25,8 +25,6 @@ QgsSublayersDialog::QgsSublayersDialog( ProviderType providerType, const QString
QWidget *parent, Qt::WindowFlags fl )
: QDialog( parent, fl )
, mName( name )
, mShowCount( false )
, mShowType( false )
{
setupUi( this );

@@ -61,11 +59,13 @@ QgsSublayersDialog::QgsSublayersDialog( ProviderType providerType, const QString
restoreGeometry( settings.value( "/Windows/" + mName + "SubLayers/geometry" ).toByteArray() );

// Checkbox about adding sublayers to a group
checkboxAddToGroup = new QCheckBox( tr( "Add layers to a group" ) );
bool addToGroup = settings.value( QStringLiteral( "/qgis/openSublayersInGroup" ), false ).toBool();
checkboxAddToGroup->setChecked( addToGroup );
if ( mShowAddToGroupCheckbox )
buttonBox->addButton( checkboxAddToGroup, QDialogButtonBox::ActionRole );
{
mCheckboxAddToGroup = new QCheckBox( tr( "Add layers to a group" ) );
bool addToGroup = settings.value( QStringLiteral( "/qgis/openSublayersInGroup" ), false ).toBool();
mCheckboxAddToGroup->setChecked( addToGroup );
buttonBox->addButton( mCheckboxAddToGroup, QDialogButtonBox::ActionRole );
}
}

QgsSublayersDialog::~QgsSublayersDialog()
@@ -185,6 +185,7 @@ int QgsSublayersDialog::exec()
if ( overrideCursor )
QApplication::setOverrideCursor( cursor );

settings.setValue( QStringLiteral( "/qgis/openSublayersInGroup" ), checkboxAddToGroup->isChecked() );
if ( mCheckboxAddToGroup )
settings.setValue( QStringLiteral( "/qgis/openSublayersInGroup" ), mCheckboxAddToGroup->isChecked() );
return ret;
}
@@ -74,7 +74,7 @@ class GUI_EXPORT QgsSublayersDialog : public QDialog, private Ui::QgsSublayersDi

//! If we should add layers in a group
//! @note added in 3.0
bool addToGroupCheckbox() const { return checkboxAddToGroup->isChecked(); }
bool addToGroupCheckbox() const { return mCheckboxAddToGroup->isChecked(); }

public slots:
void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
@@ -83,10 +83,13 @@ class GUI_EXPORT QgsSublayersDialog : public QDialog, private Ui::QgsSublayersDi
protected:
QString mName;
QStringList mSelectedSubLayers;
bool mShowCount; //!< Whether to show number of features in the table
bool mShowType; //!< Whether to show type in the table
bool mShowAddToGroupCheckbox; //!< Whether to show the add to group checkbox
QCheckBox *checkboxAddToGroup = nullptr;
bool mShowCount = false; //!< Whether to show number of features in the table
bool mShowType = false; //!< Whether to show type in the table

private:

bool mShowAddToGroupCheckbox = false; //!< Whether to show the add to group checkbox
QCheckBox *mCheckboxAddToGroup = nullptr;
};

#endif

0 comments on commit 545da60

Please sign in to comment.