Skip to content

Commit

Permalink
fix #6446
Browse files Browse the repository at this point in the history
  • Loading branch information
brushtyler committed Oct 3, 2012
1 parent 99876cc commit 80d645d
Showing 1 changed file with 51 additions and 24 deletions.
75 changes: 51 additions & 24 deletions src/app/qgsvectorlayerproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,30 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(

connect( btnUseNewSymbology, SIGNAL( clicked() ), this, SLOT( useNewSymbology() ) );

QVBoxLayout *layout = new QVBoxLayout( labelingFrame );
layout->setMargin( 0 );
labelingDialog = new QgsLabelingGui( QgisApp::instance()->palLabeling(), layer, QgisApp::instance()->mapCanvas(), labelingFrame );
layout->addWidget( labelingDialog );
labelingFrame->setLayout( layout );

// Create the Label dialog tab
layout = new QVBoxLayout( labelOptionsFrame );
layout->setMargin( 0 );
labelDialog = new QgsLabelDialog( layer->label(), labelOptionsFrame );
layout->addWidget( labelDialog );
labelOptionsFrame->setLayout( layout );
connect( labelDialog, SIGNAL( labelSourceSet() ), this, SLOT( setLabelCheckBox() ) );
QVBoxLayout *layout;

if ( layer->hasGeometryType() )
{
// Create the Labeling dialog tab
layout= new QVBoxLayout( labelingFrame );
layout->setMargin( 0 );
labelingDialog = new QgsLabelingGui( QgisApp::instance()->palLabeling(), layer, QgisApp::instance()->mapCanvas(), labelingFrame );
layout->addWidget( labelingDialog );
labelingFrame->setLayout( layout );

// Create the Labeling (deprecated) dialog tab
layout = new QVBoxLayout( labelOptionsFrame );
layout->setMargin( 0 );
labelDialog = new QgsLabelDialog( layer->label(), labelOptionsFrame );
layout->addWidget( labelDialog );
labelOptionsFrame->setLayout( layout );
connect( labelDialog, SIGNAL( labelSourceSet() ), this, SLOT( setLabelCheckBox() ) );
}
else
{
tabWidget->setTabEnabled( 1, false ); // hide labeling item
tabWidget->setTabEnabled( 2, false ); // hide labeling (deprecated) item
}

// Create the Actions dialog tab
QVBoxLayout *actionLayout = new QVBoxLayout( actionOptionsFrame );
Expand Down Expand Up @@ -202,19 +213,35 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
mLayerAbstractTextEdit->setPlainText( layer->abstract() );
}

tabWidget->setCurrentIndex( 0 );

QSettings settings;
restoreGeometry( settings.value( "/Windows/VectorLayerProperties/geometry" ).toByteArray() );
tabWidget->setCurrentIndex( settings.value( "/Windows/VectorLayerProperties/row" ).toInt() );
int tabIndex = settings.value( "/Windows/VectorLayerProperties/row", 0 ).toInt();

// if the last used tab is not enabled display the first enabled one
if ( !tabWidget->isTabEnabled( tabIndex ) )
{
tabIndex = 0;
for ( int i = 0; i < tabWidget->count(); i++ )
{
if ( tabWidget->isTabEnabled( i ) )
{
tabIndex = i;
break;
}
}
}
tabWidget->setCurrentIndex( tabIndex );

setWindowTitle( tr( "Layer Properties - %1" ).arg( layer->name() ) );
} // QgsVectorLayerProperties ctor


QgsVectorLayerProperties::~QgsVectorLayerProperties()
{
disconnect( labelDialog, SIGNAL( labelSourceSet() ), this, SLOT( setLabelCheckBox() ) );
if ( layer->hasGeometryType() )
{
disconnect( labelDialog, SIGNAL( labelSourceSet() ), this, SLOT( setLabelCheckBox() ) );
}

QSettings settings;
settings.setValue( "/Windows/VectorLayerProperties/geometry", saveGeometry() );
Expand Down Expand Up @@ -615,9 +642,14 @@ void QgsVectorLayerProperties::reset( void )
layer->label()->setFields( layer->pendingFields() );

actionDialog->init();
labelDialog->init();

if ( layer->hasGeometryType() )
{
labelDialog->init();
}
labelCheckBox->setChecked( layer->hasLabelsEnabled() );
labelOptionsFrame->setEnabled( layer->hasLabelsEnabled() );

//set the transparency slider
sliderTransparency->setValue( 255 - layer->getTransparency() );
//update the transparency percentage label
Expand Down Expand Up @@ -1293,12 +1325,7 @@ void QgsVectorLayerProperties::updateSymbologyPage()
}
else
{
if ( tabWidget->currentIndex() == 0 )
{
tabWidget->setCurrentIndex( 1 );
}

tabWidget->setTabEnabled( 0, true ); // hide symbology item
tabWidget->setTabEnabled( 0, false ); // hide symbology item
}

if ( mRendererDialog )
Expand Down

0 comments on commit 80d645d

Please sign in to comment.