mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
fixes to layer property editor
git-svn-id: http://svn.osgeo.org/qgis/trunk@167 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
35acd1dcf8
commit
146496b3b3
@ -191,7 +191,9 @@ void QgisApp::about()
|
||||
abt->setURLs(urls);
|
||||
QString watsNew = "Version ";
|
||||
watsNew += qgisVersion;
|
||||
watsNew += "\n*During repaint, the data store is only accessed if map state or extent has changed";
|
||||
watsNew += "\n*During repaint, the data store is only accessed if map state or extent has changed\n"
|
||||
"*Changes to layer properites aren't effective until the Layer Properties dialog is closed\n"
|
||||
"*Cancelling the Layer Propeties dialog cancels changes";
|
||||
|
||||
abt->setWhatsNew(watsNew);
|
||||
abt->exec();
|
||||
@ -552,6 +554,8 @@ void QgisApp::layerProperties(QListViewItem * lvi)
|
||||
QString currentName = lyr->name();
|
||||
QgsLayerProperties *lp = new QgsLayerProperties(lyr);
|
||||
if (lp->exec()) {
|
||||
// update the symbol
|
||||
lyr->setSymbol(lp->getSymbol());
|
||||
mapCanvas->freeze();
|
||||
lyr->setlayerName(lp->displayName());
|
||||
if (currentName != lp->displayName())
|
||||
|
@ -36,6 +36,7 @@ QgsLayerProperties::QgsLayerProperties(QgsMapLayer * lyr):layer(lyr)
|
||||
txtDisplayName->setText(lyr->name());
|
||||
//symbology
|
||||
sym = layer->symbol();
|
||||
newSym = *sym;
|
||||
|
||||
btnSetColor->setPaletteBackgroundColor(sym->color());
|
||||
|
||||
@ -50,20 +51,20 @@ QgsLayerProperties::~QgsLayerProperties()
|
||||
void QgsLayerProperties::selectFillColor()
|
||||
{
|
||||
|
||||
QColor fc = QColorDialog::getColor(sym->fillColor(), this);
|
||||
QColor fc = QColorDialog::getColor(newSym.fillColor(), this);
|
||||
if (fc.isValid()) {
|
||||
|
||||
btnSetFillColor->setPaletteBackgroundColor(fc);
|
||||
sym->setFillColor(fc);
|
||||
newSym.setFillColor(fc);
|
||||
}
|
||||
}
|
||||
void QgsLayerProperties::selectOutlineColor()
|
||||
{
|
||||
QColor oc = QColorDialog::getColor(sym->color(), this);
|
||||
QColor oc = QColorDialog::getColor(newSym.color(), this);
|
||||
if (oc.isValid()) {
|
||||
|
||||
btnSetColor->setPaletteBackgroundColor(oc);
|
||||
sym->setColor(oc);
|
||||
newSym.setColor(oc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,5 +75,8 @@ QString QgsLayerProperties::displayName()
|
||||
|
||||
void QgsLayerProperties::setLineWidth(int w)
|
||||
{
|
||||
sym->setLineWidth(w);
|
||||
newSym.setLineWidth(w);
|
||||
}
|
||||
QgsSymbol * QgsLayerProperties::getSymbol(){
|
||||
return new QgsSymbol(newSym);
|
||||
}
|
||||
|
@ -42,9 +42,11 @@ public:
|
||||
//! Name to display in legend
|
||||
QString displayName();
|
||||
void setLineWidth(int w);
|
||||
QgsSymbol * getSymbol();
|
||||
private:
|
||||
QgsMapLayer *layer;
|
||||
QgsSymbol *sym;
|
||||
QgsSymbol newSym;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -22,11 +22,15 @@ QgsSymbol::QgsSymbol(QColor c):m_color(c)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QgsSymbol::QgsSymbol(const QgsSymbol &sym){
|
||||
m_color = sym.color();
|
||||
m_fillColor = sym.fillColor();
|
||||
m_lineWidth = sym.lineWidth();
|
||||
}
|
||||
QgsSymbol::~QgsSymbol()
|
||||
{
|
||||
}
|
||||
QColor QgsSymbol::color()
|
||||
QColor QgsSymbol::color() const
|
||||
{
|
||||
return m_color;
|
||||
}
|
||||
@ -36,7 +40,7 @@ void QgsSymbol::setColor(QColor c)
|
||||
m_color = c;
|
||||
}
|
||||
|
||||
QColor QgsSymbol::fillColor()
|
||||
QColor QgsSymbol::fillColor() const
|
||||
{
|
||||
return m_fillColor;
|
||||
}
|
||||
@ -46,7 +50,7 @@ void QgsSymbol::setFillColor(QColor c)
|
||||
m_fillColor = c;
|
||||
}
|
||||
|
||||
int QgsSymbol::lineWidth()
|
||||
int QgsSymbol::lineWidth() const
|
||||
{
|
||||
return m_lineWidth;
|
||||
}
|
||||
@ -55,3 +59,13 @@ void QgsSymbol::setLineWidth(int w)
|
||||
{
|
||||
m_lineWidth = w;
|
||||
}
|
||||
|
||||
QgsSymbol & QgsSymbol::operator=(const QgsSymbol &r1){
|
||||
|
||||
if(&r1 != this){
|
||||
m_color = r1.color();
|
||||
m_fillColor = r1.fillColor();
|
||||
m_lineWidth = r1.lineWidth();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
@ -28,14 +28,15 @@ class QgsSymbol{
|
||||
public:
|
||||
//! Constructor
|
||||
QgsSymbol(QColor c = QColor(0,0,0));
|
||||
QgsSymbol(const QgsSymbol &sym);
|
||||
//! Set the color
|
||||
void setColor(QColor c);
|
||||
//! Get the current color
|
||||
QColor color();
|
||||
QColor color() const;
|
||||
//! Get the fill color
|
||||
QColor fillColor();
|
||||
QColor fillColor() const;
|
||||
void setFillColor(QColor c);
|
||||
int lineWidth();
|
||||
int lineWidth() const;
|
||||
void setLineWidth(int w);
|
||||
//! Destructor
|
||||
~QgsSymbol();
|
||||
|
Loading…
x
Reference in New Issue
Block a user