mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
[FEATURE] Add style options for legend layer/groups, and live refresh of all legend style options
- Based of off work from Stefan Ziegler (pull request #331) - Options inherited by embedded groups (which are still always italic) - Original layer name now saved to project file (instead of adjusted display name) - Fix bug where setting capitalization, then saving/reopening would permanently set capitalization - [API] Add originalName() to QgsMapLayer to access original (pre-adjusted name) - [API] Add setupFont() method to legend group items - [API] Add updateLegendItemStyles() and updateLegendItemSymbologies() to QgsLegend to allow style option changes to become active without app restart
This commit is contained in:
parent
9dffa42eea
commit
94491b8479
@ -73,6 +73,11 @@ class QgsMapLayer : QObject
|
||||
*/
|
||||
const QString & name() const;
|
||||
|
||||
/** Get the original name of the layer
|
||||
* @note added in 1.9
|
||||
*/
|
||||
const QString & originalName() const;
|
||||
|
||||
void setTitle( const QString& title );
|
||||
const QString& title() const;
|
||||
|
||||
@ -207,8 +212,8 @@ class QgsMapLayer : QObject
|
||||
@note emitSignal added in 1.4 */
|
||||
void setCrs( const QgsCoordinateReferenceSystem& srs, bool emitSignal = true );
|
||||
|
||||
/** A convenience function to capitalise the layer name */
|
||||
static QString capitaliseLayerName( const QString name );
|
||||
/** A convenience function to (un)capitalise the layer name */
|
||||
static QString capitaliseLayerName( const QString& name );
|
||||
|
||||
/** Retrieve the style URI for this layer
|
||||
* (either as a .qml file on disk or as a
|
||||
|
@ -970,7 +970,8 @@ QgsLegendGroup* QgsLegend::addEmbeddedGroup( const QString& groupName, const QSt
|
||||
group->setEmbedded( true );
|
||||
group->setProjectPath( projectFilePath );
|
||||
|
||||
QFont groupFont;
|
||||
// start with already set font style
|
||||
QFont groupFont = group->font( 0 );
|
||||
groupFont.setItalic( true );
|
||||
group->setFont( 0, groupFont );
|
||||
setCurrentItem( group );
|
||||
@ -1075,7 +1076,8 @@ void QgsLegend::addLayers( QList<QgsMapLayer *> theLayerList )
|
||||
QgsLegendLayer* llayer = new QgsLegendLayer( layer );
|
||||
if ( !QgsProject::instance()->layerIsEmbedded( layer->id() ).isEmpty() )
|
||||
{
|
||||
QFont itemFont;
|
||||
// start with already set font style
|
||||
QFont itemFont = llayer->font( 0 );
|
||||
itemFont.setItalic( true );
|
||||
llayer->setFont( 0, itemFont );
|
||||
}
|
||||
@ -1897,7 +1899,8 @@ bool QgsLegend::readXML( QgsLegendGroup *parent, const QDomNode &node )
|
||||
|
||||
if ( currentLayer->layer() && !QgsProject::instance()->layerIsEmbedded( currentLayer->layer()->id() ).isEmpty() )
|
||||
{
|
||||
QFont itemFont;
|
||||
// start with already set font style
|
||||
QFont itemFont = currentLayer->font( 0 );
|
||||
itemFont.setItalic( true );
|
||||
currentLayer->setFont( 0, itemFont );
|
||||
}
|
||||
@ -3094,3 +3097,35 @@ QList< LegendLayerAction > QgsLegend::legendLayerActions( QgsMapLayer::LayerType
|
||||
{
|
||||
return mLegendLayerActionMap.contains( type ) ? mLegendLayerActionMap.value( type ) : QList< LegendLayerAction >() ;
|
||||
}
|
||||
|
||||
void QgsLegend::updateLegendItemStyles()
|
||||
{
|
||||
QgsLegendGroup* lg = 0;
|
||||
QgsLegendLayer* ll = 0;
|
||||
for ( QTreeWidgetItem* theItem = firstItem(); theItem; theItem = nextItem( theItem ) )
|
||||
{
|
||||
ll = dynamic_cast<QgsLegendLayer *>( theItem );
|
||||
if ( ll )
|
||||
{
|
||||
ll->setupFont();
|
||||
// map layer name capitalize option may have changed
|
||||
ll->layer()->setLayerName( ll->layer()->originalName() );
|
||||
continue;
|
||||
}
|
||||
|
||||
lg = dynamic_cast<QgsLegendGroup *>( theItem );
|
||||
if ( lg )
|
||||
{
|
||||
lg->setupFont();
|
||||
}
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
void QgsLegend::updateLegendItemSymbologies()
|
||||
{
|
||||
foreach ( QgsLegendLayer* ll, legendLayers() )
|
||||
{
|
||||
ll->refreshSymbology( ll->layer()->id() );
|
||||
}
|
||||
}
|
||||
|
@ -382,6 +382,17 @@ class QgsLegend : public QTreeWidget
|
||||
void removeLegendLayerActionsForLayer( QgsMapLayer* layer );
|
||||
QList< LegendLayerAction > legendLayerActions( QgsMapLayer::LayerType type ) const;
|
||||
|
||||
/** Slot to update styles for legend items, since
|
||||
* QgsLegend::item doesn't work in app stylesheet for individual legend types
|
||||
* @note added in QGIS 1.9
|
||||
*/
|
||||
void updateLegendItemStyles();
|
||||
|
||||
/** Slot to update symbology for legend items
|
||||
* @note added in QGIS 1.9
|
||||
*/
|
||||
void updateLegendItemSymbologies();
|
||||
|
||||
protected:
|
||||
|
||||
/*!Event handler for mouse movements.
|
||||
|
@ -27,6 +27,7 @@ QgsLegendGroup::QgsLegendGroup( QTreeWidgetItem * theItem, QString theName )
|
||||
setCheckState( 0, Qt::Checked );
|
||||
QIcon myIcon = QgsApplication::getThemeIcon( "/mActionFolder.png" );
|
||||
setIcon( 0, myIcon );
|
||||
setupFont();
|
||||
mEmbedded = false;
|
||||
mDrawingOrder = -1;
|
||||
}
|
||||
@ -38,6 +39,7 @@ QgsLegendGroup::QgsLegendGroup( QTreeWidget* theListView, QString theString )
|
||||
setCheckState( 0, Qt::Checked );
|
||||
QIcon myIcon = QgsApplication::getThemeIcon( "/mActionFolder.png" );
|
||||
setIcon( 0, myIcon );
|
||||
setupFont();
|
||||
mEmbedded = false;
|
||||
mDrawingOrder = -1;
|
||||
}
|
||||
@ -50,6 +52,7 @@ QgsLegendGroup::QgsLegendGroup( QString name ): QgsLegendItem()
|
||||
QIcon myIcon = QgsApplication::getThemeIcon( + "/mActionFolder.png" );
|
||||
setText( 0, name );
|
||||
setIcon( 0, myIcon );
|
||||
setupFont();
|
||||
mEmbedded = false;
|
||||
mDrawingOrder = -1;
|
||||
}
|
||||
@ -57,6 +60,14 @@ QgsLegendGroup::QgsLegendGroup( QString name ): QgsLegendItem()
|
||||
QgsLegendGroup::~QgsLegendGroup()
|
||||
{}
|
||||
|
||||
void QgsLegendGroup::setupFont()
|
||||
{
|
||||
QSettings settings;
|
||||
QFont myFont = font( 0 );
|
||||
//visually differentiate group labels from the rest
|
||||
myFont.setBold( settings.value( "/qgis/legendGroupsBold", false ).toBool() );
|
||||
setFont( 0, myFont );
|
||||
}
|
||||
|
||||
bool QgsLegendGroup::insert( QgsLegendItem* theItem )
|
||||
{
|
||||
|
@ -32,6 +32,13 @@ class QgsLegendGroup : public QgsLegendItem
|
||||
QgsLegendGroup( QString name );
|
||||
~QgsLegendGroup();
|
||||
|
||||
/** Helper method to set font characteristics.
|
||||
* Not to be confused with setFont() which is inherited
|
||||
* from the QTreeWidgetItem base class.
|
||||
* @note added in QGIS 1.9
|
||||
*/
|
||||
void setupFont();
|
||||
|
||||
bool insert( QgsLegendItem* theItem );
|
||||
/**Returns all legend layers under this group (including those of subgroups by default)*/
|
||||
QList<QgsLegendLayer*> legendLayers( bool recurse = true );
|
||||
|
@ -112,10 +112,12 @@ void QgsLegendLayer::setCheckState( int column, Qt::CheckState state )
|
||||
}
|
||||
}
|
||||
|
||||
void QgsLegendLayer::setupFont() //private method
|
||||
void QgsLegendLayer::setupFont()
|
||||
{
|
||||
QSettings settings;
|
||||
QFont myFont = font( 0 );
|
||||
myFont.setBold( true ); //visually differentiate layer labels from the rest
|
||||
//visually differentiate layer labels from the rest
|
||||
myFont.setBold( settings.value( "/qgis/legendLayersBold", true ).toBool() );
|
||||
setFont( 0, myFont );
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,12 @@ class QgsLegendLayer : public QgsLegendItem
|
||||
/**Updates symbology of the layer and copies symbology to other layer files in the group*/
|
||||
void refreshSymbology( const QString& key, double widthScale = 1.0 );
|
||||
|
||||
/** Helper method to set font characteristics.
|
||||
* Not to be confused with setFont() which is inherited
|
||||
* from the QTreeWidgetItem base class.
|
||||
*/
|
||||
void setupFont();
|
||||
|
||||
/** called to add appropriate menu items to legend's popup menu */
|
||||
void addToPopupMenu( QMenu& theMenu );
|
||||
|
||||
@ -122,11 +128,6 @@ class QgsLegendLayer : public QgsLegendItem
|
||||
QPixmap getOriginalPixmap();
|
||||
|
||||
private:
|
||||
/** Helper method to make the font bold from all ctors.
|
||||
* Not to be confused with setFont() which is inherited
|
||||
* from the QTreeWidgetItem base class.
|
||||
*/
|
||||
void setupFont();
|
||||
|
||||
/** Label, may be layer name or layer name + [feature count] */
|
||||
QString label();
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "qgis.h"
|
||||
#include "qgisapp.h"
|
||||
#include "qgisappstylesheet.h"
|
||||
#include "qgslegend.h"
|
||||
#include "qgsmapcanvas.h"
|
||||
#include "qgsmaprenderer.h"
|
||||
#include "qgsgenericprojectionselector.h"
|
||||
@ -504,6 +505,8 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
|
||||
chkUseQPixmap->setChecked( !( settings.value( "/qgis/use_qimage_to_render", true ).toBool() ) );
|
||||
chkAddedVisibility->setChecked( settings.value( "/qgis/new_layers_visible", true ).toBool() );
|
||||
cbxLegendClassifiers->setChecked( settings.value( "/qgis/showLegendClassifiers", false ).toBool() );
|
||||
mLegendLayersBoldChkBx->setChecked( settings.value( "/qgis/legendLayersBold", true ).toBool() );
|
||||
mLegendGroupsBoldChkBx->setChecked( settings.value( "/qgis/legendGroupsBold", false ).toBool() );
|
||||
cbxHideSplash->setChecked( settings.value( "/qgis/hideSplash", false ).toBool() );
|
||||
cbxShowTips->setChecked( settings.value( "/qgis/showTips", true ).toBool() );
|
||||
cbxAttributeTableDocked->setChecked( settings.value( "/qgis/dockAttributeTable", false ).toBool() );
|
||||
@ -562,7 +565,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
|
||||
myBlue = settings.value( "/qgis/default_measure_color_blue", 180 ).toInt();
|
||||
pbnMeasureColor->setColor( QColor( myRed, myGreen, myBlue ) );
|
||||
|
||||
capitaliseCheckBox->setChecked( settings.value( "qgis/capitaliseLayerName", QVariant( false ) ).toBool() );
|
||||
capitaliseCheckBox->setChecked( settings.value( "/qgis/capitaliseLayerName", QVariant( false ) ).toBool() );
|
||||
|
||||
chbAskToSaveProjectChanges->setChecked( settings.value( "qgis/askToSaveProjectChanges", QVariant( true ) ).toBool() );
|
||||
chbWarnOldProjectVersion->setChecked( settings.value( "/qgis/warnOldProjectVersion", QVariant( true ) ).toBool() );
|
||||
@ -1003,7 +1006,12 @@ void QgsOptions::saveOptions()
|
||||
settings.setValue( "/Map/identifyMode", cmbIdentifyMode->itemData( cmbIdentifyMode->currentIndex() ).toInt() );
|
||||
settings.setValue( "/Map/identifyAutoFeatureForm", cbxAutoFeatureForm->isChecked() );
|
||||
settings.setValue( "/Map/identifyRadius", spinBoxIdentifyValue->value() );
|
||||
bool showLegendClassifiers = settings.value( "/qgis/showLegendClassifiers", false ).toBool();
|
||||
settings.setValue( "/qgis/showLegendClassifiers", cbxLegendClassifiers->isChecked() );
|
||||
bool legendLayersBold = settings.value( "/qgis/legendLayersBold", true ).toBool();
|
||||
settings.setValue( "/qgis/legendLayersBold", mLegendLayersBoldChkBx->isChecked() );
|
||||
bool legendGroupsBold = settings.value( "/qgis/legendGroupsBold", false ).toBool();
|
||||
settings.setValue( "/qgis/legendGroupsBold", mLegendGroupsBoldChkBx->isChecked() );
|
||||
settings.setValue( "/qgis/hideSplash", cbxHideSplash->isChecked() );
|
||||
settings.setValue( "/qgis/showTips", cbxShowTips->isChecked() );
|
||||
settings.setValue( "/qgis/dockAttributeTable", cbxAttributeTableDocked->isChecked() );
|
||||
@ -1019,6 +1027,7 @@ void QgsOptions::saveOptions()
|
||||
settings.setValue( "/qgis/dockSnapping", cbxSnappingOptionsDocked->isChecked() );
|
||||
settings.setValue( "/qgis/addPostgisDC", cbxAddPostgisDC->isChecked() );
|
||||
settings.setValue( "/qgis/addNewLayersToCurrentGroup", cbxAddNewLayersToCurrentGroup->isChecked() );
|
||||
bool createRasterLegendIcons = settings.value( "/qgis/createRasterLegendIcons", true ).toBool();
|
||||
settings.setValue( "/qgis/createRasterLegendIcons", cbxCreateRasterLegendIcons->isChecked() );
|
||||
settings.setValue( "/qgis/copyGeometryAsWKT", cbxCopyWKTGeomFromTable->isChecked() );
|
||||
settings.setValue( "/qgis/new_layers_visible", chkAddedVisibility->isChecked() );
|
||||
@ -1027,6 +1036,7 @@ void QgsOptions::saveOptions()
|
||||
settings.setValue( "/qgis/use_qimage_to_render", !( chkUseQPixmap->isChecked() ) );
|
||||
settings.setValue( "/qgis/use_symbology_ng", chkUseSymbologyNG->isChecked() );
|
||||
settings.setValue( "/qgis/legendDoubleClickAction", cmbLegendDoubleClickAction->currentIndex() );
|
||||
bool legendLayersCapitalise = settings.value( "/qgis/capitaliseLayerName", false ).toBool();
|
||||
settings.setValue( "/qgis/capitaliseLayerName", capitaliseCheckBox->isChecked() );
|
||||
|
||||
// project
|
||||
@ -1233,6 +1243,21 @@ void QgsOptions::saveOptions()
|
||||
if ( mLoadedGdalDriverList )
|
||||
saveGdalDriverList();
|
||||
|
||||
// refresh legend if any legend item's state is to be changed
|
||||
if ( legendLayersBold != mLegendLayersBoldChkBx->isChecked()
|
||||
|| legendGroupsBold != mLegendGroupsBoldChkBx->isChecked()
|
||||
|| legendLayersCapitalise != capitaliseCheckBox->isChecked() )
|
||||
{
|
||||
QgisApp::instance()->legend()->updateLegendItemStyles();
|
||||
}
|
||||
|
||||
// refresh symbology for any legend items, only if needed
|
||||
if ( showLegendClassifiers != cbxLegendClassifiers->isChecked()
|
||||
|| createRasterLegendIcons != cbxCreateRasterLegendIcons->isChecked() )
|
||||
{
|
||||
QgisApp::instance()->legend()->updateLegendItemSymbologies();
|
||||
}
|
||||
|
||||
// save app stylesheet last (in case reset becomes necessary)
|
||||
if ( mStyleSheetNewOpts != mStyleSheetOldOpts )
|
||||
{
|
||||
|
@ -591,6 +591,7 @@ void QgsRasterLayerProperties::sync()
|
||||
|
||||
//these properties (layer name and label) are provided by the qgsmaplayer superclass
|
||||
leLayerSource->setText( mRasterLayer->source() );
|
||||
mLayerOrigNameLineEd->setText( mRasterLayer->originalName() );
|
||||
leDisplayName->setText( mRasterLayer->name() );
|
||||
|
||||
//display the raster dimensions and no data value
|
||||
@ -749,7 +750,7 @@ void QgsRasterLayerProperties::apply()
|
||||
/*
|
||||
* General Tab
|
||||
*/
|
||||
mRasterLayer->setLayerName( leDisplayName->text() );
|
||||
mRasterLayer->setLayerName( mLayerOrigNameLineEd->text() );
|
||||
|
||||
// set up the scale based layer visibility stuff....
|
||||
mRasterLayer->toggleScaleBasedVisibility( chkUseScaleDependentRendering->isChecked() );
|
||||
@ -819,6 +820,11 @@ void QgsRasterLayerProperties::apply()
|
||||
updatePipeList();
|
||||
}//apply
|
||||
|
||||
void QgsRasterLayerProperties::on_mLayerOrigNameLineEd_textEdited( const QString& text )
|
||||
{
|
||||
leDisplayName->setText( mRasterLayer->capitaliseLayerName( text ) );
|
||||
}
|
||||
|
||||
void QgsRasterLayerProperties::on_buttonBuildPyramids_clicked()
|
||||
{
|
||||
QgsRasterDataProvider* provider = mRasterLayer->dataProvider();
|
||||
|
@ -56,6 +56,9 @@ class QgsRasterLayerProperties : public QDialog, private Ui::QgsRasterLayerPrope
|
||||
//TODO: Verify that these all need to be public
|
||||
/** \brief Applies the settings made in the dialog without closing the box */
|
||||
void apply();
|
||||
/** \brief Slot to update layer display name as original is edited
|
||||
* @note added in QGIS 1.9 */
|
||||
void on_mLayerOrigNameLineEd_textEdited( const QString& text );
|
||||
/** \brief this slot asks the rasterlayer to construct pyramids */
|
||||
void on_buttonBuildPyramids_clicked();
|
||||
/** \brief slot executed when user presses "Add Values From Display" button on the transparency page */
|
||||
|
@ -337,6 +337,7 @@ void QgsVectorLayerProperties::setDisplayField( QString name )
|
||||
void QgsVectorLayerProperties::reset( void )
|
||||
{
|
||||
// populate the general information
|
||||
mLayerOrigNameLineEdit->setText( layer->originalName() );
|
||||
txtDisplayName->setText( layer->name() );
|
||||
pbnQueryBuilder->setWhatsThis( tr( "This button opens the query "
|
||||
"builder and allows you to create a subset of features to display on "
|
||||
@ -468,7 +469,7 @@ void QgsVectorLayerProperties::apply()
|
||||
if ( labelDialog )
|
||||
labelDialog->apply();
|
||||
layer->enableLabels( labelCheckBox->isChecked() );
|
||||
layer->setLayerName( displayName() );
|
||||
layer->setLayerName( mLayerOrigNameLineEdit->text() );
|
||||
|
||||
QSet<QString> excludeAttributesWMS, excludeAttributesWFS;
|
||||
|
||||
@ -584,7 +585,10 @@ QString QgsVectorLayerProperties::metadata()
|
||||
return layer->metadata();
|
||||
}
|
||||
|
||||
|
||||
void QgsVectorLayerProperties::on_mLayerOrigNameLineEdit_textEdited( const QString& text )
|
||||
{
|
||||
txtDisplayName->setText( layer->capitaliseLayerName( text ) );
|
||||
}
|
||||
|
||||
void QgsVectorLayerProperties::on_pbnChangeSpatialRefSys_clicked()
|
||||
{
|
||||
|
@ -89,6 +89,11 @@ class QgsVectorLayerProperties : public QDialog, private Ui::QgsVectorLayerPrope
|
||||
/** Get metadata about the layer in nice formatted html */
|
||||
QString metadata();
|
||||
|
||||
/** Slot to update layer display name as original is edited
|
||||
* @note added in QGIS 1.9
|
||||
*/
|
||||
void on_mLayerOrigNameLineEdit_textEdited( const QString& text );
|
||||
|
||||
/** Set transparency based on slider position */
|
||||
void sliderTransparency_valueChanged( int theValue );
|
||||
|
||||
|
@ -47,17 +47,16 @@ QgsMapLayer::QgsMapLayer( QgsMapLayer::LayerType type,
|
||||
mTransparencyLevel( 255 ), // 0 is completely transparent
|
||||
mValid( false ), // assume the layer is invalid
|
||||
mDataSource( source ),
|
||||
mLayerOrigName( lyrname ), // store the original name
|
||||
mID( "" ),
|
||||
mLayerType( type )
|
||||
|
||||
{
|
||||
QgsDebugMsg( "lyrname is '" + lyrname + "'" );
|
||||
|
||||
mCRS = new QgsCoordinateReferenceSystem();
|
||||
|
||||
// Set the display name = internal name
|
||||
mLayerName = capitaliseLayerName( lyrname );
|
||||
QgsDebugMsg( "layerName is '" + mLayerName + "'" );
|
||||
QgsDebugMsg( "original name: '" + mLayerOrigName + "'" );
|
||||
mLayerName = capitaliseLayerName( mLayerOrigName );
|
||||
QgsDebugMsg( "display name: '" + mLayerName + "'" );
|
||||
|
||||
// Generate the unique ID of this layer
|
||||
QDateTime dt = QDateTime::currentDateTime();
|
||||
@ -77,8 +76,6 @@ QgsMapLayer::QgsMapLayer( QgsMapLayer::LayerType type,
|
||||
mpCacheImage = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
QgsMapLayer::~QgsMapLayer()
|
||||
{
|
||||
delete mCRS;
|
||||
@ -102,9 +99,11 @@ QString QgsMapLayer::id() const
|
||||
/** Write property of QString layerName. */
|
||||
void QgsMapLayer::setLayerName( const QString & name )
|
||||
{
|
||||
QgsDebugMsg( "new name is '" + name + "'" );
|
||||
QgsDebugMsg( "new original name: '" + name + "'" );
|
||||
QString newName = capitaliseLayerName( name );
|
||||
if ( newName == mLayerName ) return;
|
||||
QgsDebugMsg( "new display name: '" + name + "'" );
|
||||
if ( name == mLayerOrigName && newName == mLayerName ) return;
|
||||
mLayerOrigName = name; // store the new original name
|
||||
mLayerName = newName;
|
||||
emit layerNameChanged();
|
||||
}
|
||||
@ -432,7 +431,7 @@ bool QgsMapLayer::writeXML( QDomNode & layer_node, QDomDocument & document )
|
||||
|
||||
// layer name
|
||||
QDomElement layerName = document.createElement( "layername" );
|
||||
QDomText layerNameText = document.createTextNode( name() );
|
||||
QDomText layerNameText = document.createTextNode( originalName() );
|
||||
layerName.appendChild( layerNameText );
|
||||
|
||||
// layer title
|
||||
@ -608,12 +607,12 @@ void QgsMapLayer::setTransparency( unsigned int theInt )
|
||||
mTransparencyLevel = theInt;
|
||||
}
|
||||
|
||||
QString QgsMapLayer::capitaliseLayerName( const QString name )
|
||||
QString QgsMapLayer::capitaliseLayerName( const QString& name )
|
||||
{
|
||||
// Capitalise the first letter of the layer name if requested
|
||||
QSettings settings;
|
||||
bool capitaliseLayerName =
|
||||
settings.value( "qgis/capitaliseLayerName", QVariant( false ) ).toBool();
|
||||
settings.value( "/qgis/capitaliseLayerName", QVariant( false ) ).toBool();
|
||||
|
||||
QString layerName( name );
|
||||
|
||||
|
@ -83,6 +83,11 @@ class CORE_EXPORT QgsMapLayer : public QObject
|
||||
*/
|
||||
const QString & name() const;
|
||||
|
||||
/** Get the original name of the layer
|
||||
* @note added in 1.9
|
||||
*/
|
||||
const QString & originalName() const { return mLayerOrigName; }
|
||||
|
||||
void setTitle( const QString& title ) { mTitle = title; }
|
||||
const QString& title() const { return mTitle; }
|
||||
|
||||
@ -223,8 +228,8 @@ class CORE_EXPORT QgsMapLayer : public QObject
|
||||
@note emitSignal added in 1.4 */
|
||||
void setCrs( const QgsCoordinateReferenceSystem& srs, bool emitSignal = true );
|
||||
|
||||
/** A convenience function to capitalise the layer name */
|
||||
static QString capitaliseLayerName( const QString name );
|
||||
/** A convenience function to (un)capitalise the layer name */
|
||||
static QString capitaliseLayerName( const QString& name );
|
||||
|
||||
/** Retrieve the style URI for this layer
|
||||
* (either as a .qml file on disk or as a
|
||||
@ -428,6 +433,11 @@ class CORE_EXPORT QgsMapLayer : public QObject
|
||||
/** Name of the layer - used for display */
|
||||
QString mLayerName;
|
||||
|
||||
/** Original name of the layer
|
||||
* @note added in 1.9
|
||||
*/
|
||||
QString mLayerOrigName;
|
||||
|
||||
QString mTitle;
|
||||
|
||||
/**Description of the layer*/
|
||||
|
@ -1543,7 +1543,7 @@ QString QgsProject::layerIsEmbedded( const QString& id ) const
|
||||
return QString();
|
||||
}
|
||||
return it.value().first;
|
||||
};
|
||||
}
|
||||
|
||||
bool QgsProject::createEmbeddedLayer( const QString& layerId, const QString& projectFilePath, QList<QDomNode>& brokenNodes,
|
||||
QList< QPair< QgsVectorLayer*, QDomElement > >& vectorLayerList, bool saveFlag )
|
||||
|
@ -807,7 +807,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>611</width>
|
||||
<width>654</width>
|
||||
<height>808</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -1137,8 +1137,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>559</width>
|
||||
<height>417</height>
|
||||
<width>669</width>
|
||||
<height>490</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_27">
|
||||
@ -1456,7 +1456,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>615</width>
|
||||
<width>654</width>
|
||||
<height>681</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -1944,8 +1944,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>498</width>
|
||||
<height>332</height>
|
||||
<width>669</width>
|
||||
<height>490</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_25">
|
||||
@ -2074,25 +2074,97 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="capitaliseCheckBox">
|
||||
<property name="text">
|
||||
<string>Capitalise layer names</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbxLegendClassifiers">
|
||||
<property name="text">
|
||||
<string>Display classification attribute names</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbxCreateRasterLegendIcons">
|
||||
<property name="text">
|
||||
<string>Create raster icons</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="1" column="2">
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>12</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer_34">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>8</width>
|
||||
<height>1</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="capitaliseCheckBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Capitalise layer names</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QCheckBox" name="mLegendLayersBoldChkBx">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bold layer names</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="cbxLegendClassifiers">
|
||||
<property name="text">
|
||||
<string>Display classification attribute names</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="mLegendGroupsBoldChkBx">
|
||||
<property name="text">
|
||||
<string>Bold group names</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="cbxCreateRasterLegendIcons">
|
||||
<property name="text">
|
||||
<string>Create raster icons (may be slow)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="4">
|
||||
<widget class="QLabel" name="label_53">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Legend item styles</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbxAddNewLayersToCurrentGroup">
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>678</width>
|
||||
<height>537</height>
|
||||
<width>752</width>
|
||||
<height>599</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -607,12 +607,26 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="lblDisplayName">
|
||||
<property name="text">
|
||||
<string>Display name</string>
|
||||
<string>Layer name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="leDisplayName"/>
|
||||
<widget class="QLineEdit" name="mLayerOrigNameLineEd"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>displayed as</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="leDisplayName">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
@ -1146,7 +1160,7 @@ p, li { white-space: pre-wrap; }
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;">
|
||||
</style></head><body style=" font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Cantarell'; font-size:11pt;"><br /></span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
@ -1238,9 +1252,6 @@ p, li { white-space: pre-wrap; }
|
||||
<attribute name="headerStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="headerStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true">1</string>
|
||||
|
@ -66,7 +66,7 @@
|
||||
<item row="1" column="0">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>4</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
@ -297,8 +297,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>920</width>
|
||||
<height>756</height>
|
||||
<width>906</width>
|
||||
<height>720</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
@ -615,17 +615,7 @@ p, li { white-space: pre-wrap; }
|
||||
<string>Display</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_19">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="textLabel3">
|
||||
<property name="text">
|
||||
<string>Legend display text</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="txtDisplayName"/>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Map Tip display text</string>
|
||||
@ -751,6 +741,34 @@ p, li { white-space: pre-wrap; }
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel3">
|
||||
<property name="text">
|
||||
<string>Layer name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="mLayerOrigNameLineEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>displayed as</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="txtDisplayName">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabWidgetPage5">
|
||||
@ -778,8 +796,8 @@ p, li { white-space: pre-wrap; }
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>912</width>
|
||||
<height>748</height>
|
||||
<width>866</width>
|
||||
<height>688</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
@ -890,8 +908,8 @@ p, li { white-space: pre-wrap; }
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>912</width>
|
||||
<height>748</height>
|
||||
<width>866</width>
|
||||
<height>688</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_17">
|
||||
|
Loading…
x
Reference in New Issue
Block a user