Skip to content
Permalink
Browse files

Better fix for situations like #7602

- In base class, auto-remove corresponding list widget item when stack widget is removed
- Minimize band rendering group box stretching if there probably is no combo box choice (e.g. WMS layer)
  • Loading branch information
dakcarto committed Apr 14, 2013
1 parent 833ae95 commit 611f77b39b7db17e4e7fb5f0133d06f4b4e0e353
@@ -553,29 +553,40 @@ void QgsRasterLayerProperties::sync()
mOptionsStackedWidget->setCurrentWidget( mOptsPage_Metadata );
}

// TODO: Wouldn't it be better to just disable the tabs than delete them? [LS]
bool fixBandStretch = false;
// TODO: Wouldn't it be better to just removeWidget() the tabs than delete them? [LS]
if ( !( mRasterLayer->dataProvider()->capabilities() & QgsRasterDataProvider::BuildPyramids ) )
{
fixBandStretch = true;
if ( mOptsPage_Pyramids != NULL )
{
delete mOptListWidget->item( mOptStackedWidget->indexOf( mOptsPage_Pyramids ) );
delete mOptsPage_Pyramids;
mOptsPage_Pyramids = NULL;
}
}

if ( !( mRasterLayer->dataProvider()->capabilities() & QgsRasterDataProvider::Histogram ) )
{
fixBandStretch = ( fixBandStretch && true );
if ( mOptsPage_Histogram != NULL )
{
delete mOptListWidget->item( mOptStackedWidget->indexOf( mOptsPage_Histogram ) );
delete mOptsPage_Histogram;
mOptsPage_Histogram = NULL;
delete mHistogramWidget;
mHistogramWidget = NULL;
}
}

if ( fixBandStretch )
{
// probably no band rendering choices, so minimize group box
QSizePolicy sizep = mBandRenderingGrpBx->sizePolicy();
sizep.setVerticalStretch( 0 );
sizep.setVerticalPolicy( QSizePolicy::Maximum );
mBandRenderingGrpBx->setSizePolicy( sizep );
mBandRenderingGrpBx->updateGeometry();
}

QgsDebugMsg( "populate transparency tab" );

/*
@@ -1689,7 +1700,6 @@ void QgsRasterLayerProperties::updatePipeList()
QgsDebugMsg( "Entered" );

#ifndef QGISDEBUG
delete mOptListWidget->item( mOptStackedWidget->indexOf( mOptsPage_Pipe ) );
mOptionsStackedWidget->removeWidget( mOptsPage_Pipe ); // just delete instead?
#else
mPipeTreeWidget->clear();
@@ -72,6 +72,7 @@ void QgsOptionsDialogBase::initOptionsBase( bool restoreUi )
}
connect( mOptSplitter, SIGNAL( splitterMoved( int, int ) ), this, SLOT( updateOptionsListVerticalTabs() ) );
connect( mOptStackedWidget, SIGNAL( currentChanged( int ) ), this, SLOT( optionsStackedWidget_CurrentChanged( int ) ) );
connect( mOptStackedWidget, SIGNAL( widgetRemoved( int ) ), this, SLOT( optionsStackedWidget_WidgetRemoved( int ) ) );

if ( restoreUi )
restoreOptionsBaseUi();
@@ -164,6 +165,12 @@ void QgsOptionsDialogBase::optionsStackedWidget_CurrentChanged( int indx )
mOptListWidget->blockSignals( false );
}

void QgsOptionsDialogBase::optionsStackedWidget_WidgetRemoved( int indx )
{
// will need to take item first, if widgets are set for item in future
delete mOptListWidget->item( indx );
}

void QgsOptionsDialogBase::warnAboutMissingObjects()
{
QMessageBox::warning( 0, tr( "Missing objects" ),
@@ -70,6 +70,7 @@ class GUI_EXPORT QgsOptionsDialogBase : public QDialog
protected slots:
void updateOptionsListVerticalTabs();
void optionsStackedWidget_CurrentChanged( int indx );
void optionsStackedWidget_WidgetRemoved( int indx );
void warnAboutMissingObjects();

protected:
@@ -828,7 +828,7 @@
<number>0</number>
</property>
<item>
<widget class="QgsCollapsibleGroupBox" name="groupBox">
<widget class="QgsCollapsibleGroupBox" name="mBandRenderingGrpBx">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>

0 comments on commit 611f77b

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