Skip to content
Permalink
Browse files

Reimplement QgsOptionsDialogBase::optionsStackedWidget_CurrentChanged…

… in derived classes rather than duplicate it
  • Loading branch information
borysiasty committed Nov 6, 2017
1 parent 6b76c2b commit c315eb3f6a2d0158585399d4f7db7bd5528ed18d
@@ -95,7 +95,6 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
connect( mProxyTypeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsOptions::mProxyTypeComboBox_currentIndexChanged );
connect( mCustomVariablesChkBx, &QCheckBox::toggled, this, &QgsOptions::mCustomVariablesChkBx_toggled );
connect( mCurrentVariablesQGISChxBx, &QCheckBox::toggled, this, &QgsOptions::mCurrentVariablesQGISChxBx_toggled );
connect( mOptionsStackedWidget, &QStackedWidget::currentChanged, this, &QgsOptions::mOptionsStackedWidget_currentChanged );
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsOptions::showHelp );

// QgsOptionsDialogBase handles saving/restoring of geometry, splitter and current tab states,
@@ -1998,9 +1997,11 @@ void QgsOptions::clearAccessCache()
QMessageBox::information( this, tr( "Cache cleared" ), tr( "Connection authentication cache has been cleared" ) );
}

void QgsOptions::mOptionsStackedWidget_currentChanged( int indx )
void QgsOptions::optionsStackedWidget_CurrentChanged( int index )
{
Q_UNUSED( indx );
QgsOptionsDialogBase::optionsStackedWidget_CurrentChanged( index );

Q_UNUSED( index );
// load gdal driver list when gdal tab is first opened
if ( mOptionsStackedWidget->currentWidget()->objectName() == QLatin1String( "mOptionsPageGDAL" )
&& ! mLoadedGdalDriverList )
@@ -216,7 +216,7 @@ class APP_EXPORT QgsOptions : public QgsOptionsDialogBase, private Ui::QgsOption
void exportScales();

//! Auto slot executed when the active page in the option section widget is changed
void mOptionsStackedWidget_currentChanged( int indx );
void optionsStackedWidget_CurrentChanged( int index ) override;

//! A scale in the list of predefined scales changed
void scaleItemChanged( QListWidgetItem *changedScaleItem );
@@ -122,8 +122,6 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer *lyr, QgsMapCanv

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

connect( mOptionsStackedWidget, &QStackedWidget::currentChanged, this, &QgsRasterLayerProperties::mOptionsStackedWidget_CurrentChanged );

// brightness/contrast controls
connect( mSliderBrightness, &QAbstractSlider::valueChanged, mBrightnessSpinBox, &QSpinBox::setValue );
connect( mBrightnessSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), mSliderBrightness, &QAbstractSlider::setValue );
@@ -1483,21 +1481,23 @@ void QgsRasterLayerProperties::setTransparencyToEdited( int row )
mTransparencyToEdited[row] = true;
}

void QgsRasterLayerProperties::mOptionsStackedWidget_CurrentChanged( int indx )
void QgsRasterLayerProperties::optionsStackedWidget_CurrentChanged( int index )
{
QgsOptionsDialogBase::optionsStackedWidget_CurrentChanged( index );

if ( !mHistogramWidget )
return;

if ( indx == 5 )
if ( index == 5 )
{
mHistogramWidget->setActive( true );
mHistogramWidget->setActive( false );
}
else
{
mHistogramWidget->setActive( false );
}

if ( indx == mOptStackedWidget->indexOf( mOptsPage_Information ) || !mMetadataFilled )
if ( index == mOptStackedWidget->indexOf( mOptsPage_Information ) || !mMetadataFilled )
//set the metadata contents (which can be expensive)
teMetadataViewer->clear();
teMetadataViewer->setHtml( mRasterLayer->htmlMetadata() );
@@ -79,7 +79,7 @@ class APP_EXPORT QgsRasterLayerProperties : public QgsOptionsDialogBase, private
//! \brief slot executed when user wishes to export transparency values
void pbnExportTransparentPixelValues_clicked();
//! \brief auto slot executed when the active page in the main widget stack is changed
void mOptionsStackedWidget_CurrentChanged( int indx );
void optionsStackedWidget_CurrentChanged( int index ) override;
//! \brief slow executed when user wishes to import transparency values
void pbnImportTransparentPixelValues_clicked();
//! \brief slot executed when user presses "Remove Selected Row" button on the transparency page
@@ -122,8 +122,6 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
connect( this, &QDialog::accepted, this, &QgsVectorLayerProperties::apply );
connect( this, &QDialog::rejected, this, &QgsVectorLayerProperties::onCancel );

connect( mOptionsStackedWidget, &QStackedWidget::currentChanged, this, &QgsVectorLayerProperties::mOptionsStackedWidget_CurrentChanged );

mContext << QgsExpressionContextUtils::globalScope()
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
<< QgsExpressionContextUtils::atlasScope( nullptr )
@@ -1447,9 +1445,11 @@ void QgsVectorLayerProperties::pbnUpdateExtents_clicked()
mMetadataFilled = false;
}

void QgsVectorLayerProperties::mOptionsStackedWidget_CurrentChanged( int indx )
void QgsVectorLayerProperties::optionsStackedWidget_CurrentChanged( int index )
{
if ( indx != mOptStackedWidget->indexOf( mOptsPage_Information ) || mMetadataFilled )
QgsOptionsDialogBase::optionsStackedWidget_CurrentChanged( index );

if ( index != mOptStackedWidget->indexOf( mOptsPage_Information ) || mMetadataFilled )
return;

//set the metadata contents (which can be expensive)
@@ -116,7 +116,7 @@ class APP_EXPORT QgsVectorLayerProperties : public QgsOptionsDialogBase, private
void saveDefaultStyle_clicked();
void loadStyle_clicked();
void saveStyleAs_clicked();
void mOptionsStackedWidget_CurrentChanged( int indx );
void optionsStackedWidget_CurrentChanged( int index ) override;
void pbnUpdateExtents_clicked();

void mButtonAddJoin_clicked();

0 comments on commit c315eb3

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