Skip to content

Commit

Permalink
Fix for ticket #1148 "GRASS Edit: can't modify Dynamic color"
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@8758 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Jul 11, 2008
1 parent fa83596 commit 26833c5
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions src/plugins/grass/qgsgrassedit.cpp
Expand Up @@ -142,6 +142,7 @@ QgsGrassEdit::QgsGrassEdit ( QgisInterface *iface, QgsMapLayer* layer, bool newM
//TODO dynamic_cast ?
mProvider = (QgsGrassProvider *) mLayer->getDataProvider();


init();

}
Expand Down Expand Up @@ -207,6 +208,12 @@ void QgsGrassEdit::init()
return;
}


mRubberBandLine = new QgsRubberBand(mCanvas);
mRubberBandIcon = new QgsVertexMarker(mCanvas);
mRubberBandLine->setZValue(20);
mRubberBandIcon->setZValue(20);

connect ( mCanvas, SIGNAL(keyPressed(QKeyEvent *)), this, SLOT(keyPress(QKeyEvent *)) );

QString myIconPath = QgsApplication::themePath() + "/grass/";
Expand Down Expand Up @@ -387,6 +394,8 @@ void QgsGrassEdit::init()

for ( int i = 0; i < SYMB_COUNT; i++ ) {
bool ok;


bool displ = settings.readBoolEntry (
spath + "display/" + QString::number(i),
true, &ok );
Expand All @@ -400,6 +409,11 @@ void QgsGrassEdit::init()
if ( ok ) {
QColor color( colorName );
mSymb[i].setColor( color );
// Use the 'dynamic' color for mRubberBand
if ( i == SYMB_DYNAMIC )
{
mRubberBandLine->setColor(QColor(colorName));
}
}
mSymb[i].setWidth( mLineWidth );
}
Expand All @@ -415,6 +429,7 @@ void QgsGrassEdit::init()
symbologyList->clear();
symbologyList->setSorting(-1);


for ( int i = SYMB_COUNT-1; i >= 0; i-- ) {
if ( i == SYMB_NODE_0 ) continue;

Expand Down Expand Up @@ -492,10 +507,7 @@ void QgsGrassEdit::init()

mPixmap = &mCanvasEdit->pixmap();

mRubberBandLine = new QgsRubberBand(mCanvas);
mRubberBandIcon = new QgsVertexMarker(mCanvas);
mRubberBandLine->setZValue(20);
mRubberBandIcon->setZValue(20);


// Init GUI values
mCatModeBox->insertItem( tr("Next not used"), CAT_MODE_NEXT );
Expand Down Expand Up @@ -729,6 +741,11 @@ void QgsGrassEdit::changeSymbology(Q3ListViewItem * item, const QPoint & pnt, in
// TODO use a name instead of index
sn.sprintf( "/GRASS/edit/symb/color/%d", index );
settings.writeEntry ( sn, mSymb[index].color().name() );
// Use the 'dynamic' color for mRubberBand
if ( index == SYMB_DYNAMIC )
{
mRubberBandLine->setColor(color);
}
}
}

Expand Down

0 comments on commit 26833c5

Please sign in to comment.