[QGIS Commit] r13529 - trunk/qgis/src/app
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Wed May 19 02:57:14 EDT 2010
Author: jef
Date: 2010-05-19 02:57:12 -0400 (Wed, 19 May 2010)
New Revision: 13529
Modified:
trunk/qgis/src/app/qgsvectorlayerproperties.cpp
trunk/qgis/src/app/qgsvectorlayerproperties.h
Log:
lazy fill meta data page in vector layer properties
Modified: trunk/qgis/src/app/qgsvectorlayerproperties.cpp
===================================================================
--- trunk/qgis/src/app/qgsvectorlayerproperties.cpp 2010-05-18 20:36:19 UTC (rev 13528)
+++ trunk/qgis/src/app/qgsvectorlayerproperties.cpp 2010-05-19 06:57:12 UTC (rev 13529)
@@ -65,9 +65,10 @@
QWidget * parent,
Qt::WFlags fl
)
- : QDialog( parent, fl ),
- layer( lyr ),
- mRendererDialog( 0 )
+ : QDialog( parent, fl )
+ , layer( lyr )
+ , mMetadataFilled( false )
+ , mRendererDialog( 0 )
{
setupUi( this );
setupEditTypes();
@@ -110,7 +111,6 @@
actionDialog = new QgsAttributeActionDialog( layer->actions(), fields, actionOptionsFrame );
actionLayout->addWidget( actionDialog );
-
reset();
if ( layer->dataProvider() )//enable spatial index button group if supported by provider
@@ -145,7 +145,7 @@
mOverlayDialogs.push_back( d );
//shamelessly hard coded - what will we do if other types of layer plugins exist? TS
QListWidgetItem * mypItem = new QListWidgetItem( QgisApp::getThemeIcon( "propertyicons/diagram.png" ), ( *it )->name() );
- listWidget->insertItem( stackedWidget->count()-1, mypItem );
+ listWidget->insertItem( stackedWidget->count() - 1, mypItem );
}
stackedWidget->setCurrentIndex( 0 );
@@ -498,11 +498,6 @@
// reset fields in label dialog
layer->label()->setFields( layer->pendingFields() );
- //set the metadata contents
- QString myStyle = QgsApplication::reportStyleSheet();
- teMetadata->clear();
- teMetadata->document()->setDefaultStyleSheet( myStyle );
- teMetadata->setHtml( metadata() );
actionDialog->init();
labelDialog->init();
labelCheckBox->setChecked( layer->hasLabelsEnabled() );
@@ -561,16 +556,22 @@
// Set up sql subset query if applicable
//
grpSubset->setEnabled( true );
- // set the subset sql for the layer
- layer->setSubsetString( txtSubsetSQL->toPlainText() );
- // update the metadata with the updated sql subset
- QString myStyle = QgsApplication::reportStyleSheet();
- teMetadata->clear();
- teMetadata->document()->setDefaultStyleSheet( myStyle );
- teMetadata->setHtml( metadata() );
- // update the extents of the layer (fetched from the provider)
- layer->updateExtents();
+ if ( txtSubsetSQL->toPlainText() != layer->subsetString() )
+ {
+ // set the subset sql for the layer
+ layer->setSubsetString( txtSubsetSQL->toPlainText() );
+
+ // update the metadata with the updated sql subset
+ QString myStyle = QgsApplication::reportStyleSheet();
+ teMetadata->clear();
+ teMetadata->document()->setDefaultStyleSheet( myStyle );
+ teMetadata->setHtml( metadata() );
+
+ // update the extents of the layer (fetched from the provider)
+ layer->updateExtents();
+ }
+
// set up the scale based layer visibility stuff....
layer->toggleScaleBasedVisibility( chkUseScaleDependentRendering->isChecked() );
layer->setMinimumScale( leMinimumScale->text().toFloat() );
@@ -1189,6 +1190,17 @@
widgetStackRenderers->addWidget( mRendererDialog );
widgetStackRenderers->setCurrentWidget( mRendererDialog );
}
+}
+void QgsVectorLayerProperties::on_stackedWidget_currentChanged( int index )
+{
+ if ( index != 4 || mMetadataFilled )
+ return;
+ //set the metadata contents (which can be expensive)
+ QString myStyle = QgsApplication::reportStyleSheet();
+ teMetadata->clear();
+ teMetadata->document()->setDefaultStyleSheet( myStyle );
+ teMetadata->setHtml( metadata() );
+ mMetadataFilled = true;
}
Modified: trunk/qgis/src/app/qgsvectorlayerproperties.h
===================================================================
--- trunk/qgis/src/app/qgsvectorlayerproperties.h 2010-05-18 20:36:19 UTC (rev 13528)
+++ trunk/qgis/src/app/qgsvectorlayerproperties.h 2010-05-19 06:57:12 UTC (rev 13529)
@@ -104,6 +104,7 @@
void on_tblAttributes_cellChanged( int row, int column );
void on_mCalculateFieldButton_clicked();
void on_pbnSelectEditForm_clicked();
+ void on_stackedWidget_currentChanged( int idx );
void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
void addAttribute();
@@ -140,6 +141,9 @@
};
QgsVectorLayer *layer;
+
+ bool mMetadataFilled;
+
/**Renderer dialog which is shown*/
QDialog* mRendererDialog;
/**Buffer renderer, which is assigned to the vector layer when apply is pressed*/
More information about the QGIS-commit
mailing list