diff --git a/qgis/src/qgisapp.cpp b/qgis/src/qgisapp.cpp index cb5708c9ed4..c51ad47d311 100644 --- a/qgis/src/qgisapp.cpp +++ b/qgis/src/qgisapp.cpp @@ -426,12 +426,21 @@ void QgisApp::layerProperties(QListViewItem * lvi) lyr = ((QgsLegendItem *) li)->layer(); } + QString currentName = lyr->name(); QgsLayerProperties *lp = new QgsLayerProperties(lyr); if (lp->exec()) { + mapCanvas->freeze(); + lyr->setlayerName(lp->displayName()); + if(currentName != lp->displayName()) + mapLegend->update(); + delete lp; qApp->processEvents(); + // apply changes + mapCanvas->freeze(false); mapCanvas->render2(); } + } void QgisApp::removeLayer() { @@ -452,3 +461,4 @@ void QgisApp::rightClickLegendMenu(QListViewItem * lvi, const QPoint & pt, int i if (lvi) popMenu->exec(pt); } + diff --git a/qgis/src/qgslayerproperties.cpp b/qgis/src/qgslayerproperties.cpp index 05c608f5fde..89f2c55a505 100644 --- a/qgis/src/qgslayerproperties.cpp +++ b/qgis/src/qgslayerproperties.cpp @@ -18,6 +18,9 @@ #include #include #include +#include +#include +#include #include "qgsmaplayer.h" #include "qgssymbol.h" #include "qgslayerproperties.h" @@ -25,6 +28,12 @@ QgsLayerProperties::QgsLayerProperties(QgsMapLayer * lyr):layer(lyr) { // populate the property sheet based on the layer properties + // general info + QString source = lyr->source(); + source = source.left(source.find("password")); + lblSource->setText(source); + txtDisplayName->setText(lyr->name()); + //symbology sym = layer->symbol(); btnSetColor->setPaletteBackgroundColor(sym->color()); @@ -38,7 +47,7 @@ QgsLayerProperties::~QgsLayerProperties() } void QgsLayerProperties::selectFillColor() { - + QColor fc = QColorDialog::getColor(sym->fillColor(), this); if (fc.isValid()) { @@ -55,3 +64,7 @@ void QgsLayerProperties::selectOutlineColor() sym->setColor(oc); } } + +QString QgsLayerProperties::displayName(){ + return txtDisplayName->text(); +} \ No newline at end of file diff --git a/qgis/src/qgslayerproperties.h b/qgis/src/qgslayerproperties.h index c676521c0f1..d3e23b5b853 100644 --- a/qgis/src/qgslayerproperties.h +++ b/qgis/src/qgslayerproperties.h @@ -20,6 +20,7 @@ #define QGSLAYERPROPERTIES_H class QgsMapLayer; class QgsSymbol; +class QString; #include "qgslayerpropertiesbase.h" @@ -38,6 +39,8 @@ public: void selectFillColor(); //! Function to display the color selector and choose the outline color void selectOutlineColor(); + //! Name to display in legend + QString displayName(); private: QgsMapLayer *layer; QgsSymbol *sym; diff --git a/qgis/src/qgsmaplayer.cpp b/qgis/src/qgsmaplayer.cpp index cd2e7cdf64d..42b67f865af 100644 --- a/qgis/src/qgsmaplayer.cpp +++ b/qgis/src/qgsmaplayer.cpp @@ -48,7 +48,9 @@ const QString QgsMapLayer::name() { return layerName; } - +QString QgsMapLayer::source(){ + return dataSource; + } const QgsRect QgsMapLayer::extent() { return layerExtent; diff --git a/qgis/src/qgsmaplayer.h b/qgis/src/qgsmaplayer.h index 8ae1f1523cd..7d46e685997 100644 --- a/qgis/src/qgsmaplayer.h +++ b/qgis/src/qgsmaplayer.h @@ -86,6 +86,8 @@ class QgsMapLayer:public QObject bool visible(); //! set visibility void setVisible(bool vis); + //! Returns the source for the layer + QString source(); /** Write property of int featureType. */ virtual void setFeatureType(const int &_newVal); /** Read property of int featureType. */