Skip to content

Commit 26833c5

Browse files
author
timlinux
committed
Fix for ticket #1148 "GRASS Edit: can't modify Dynamic color"
git-svn-id: http://svn.osgeo.org/qgis/trunk@8758 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent fa83596 commit 26833c5

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

src/plugins/grass/qgsgrassedit.cpp

+21-4
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ QgsGrassEdit::QgsGrassEdit ( QgisInterface *iface, QgsMapLayer* layer, bool newM
142142
//TODO dynamic_cast ?
143143
mProvider = (QgsGrassProvider *) mLayer->getDataProvider();
144144

145+
145146
init();
146147

147148
}
@@ -207,6 +208,12 @@ void QgsGrassEdit::init()
207208
return;
208209
}
209210

211+
212+
mRubberBandLine = new QgsRubberBand(mCanvas);
213+
mRubberBandIcon = new QgsVertexMarker(mCanvas);
214+
mRubberBandLine->setZValue(20);
215+
mRubberBandIcon->setZValue(20);
216+
210217
connect ( mCanvas, SIGNAL(keyPressed(QKeyEvent *)), this, SLOT(keyPress(QKeyEvent *)) );
211218

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

388395
for ( int i = 0; i < SYMB_COUNT; i++ ) {
389396
bool ok;
397+
398+
390399
bool displ = settings.readBoolEntry (
391400
spath + "display/" + QString::number(i),
392401
true, &ok );
@@ -400,6 +409,11 @@ void QgsGrassEdit::init()
400409
if ( ok ) {
401410
QColor color( colorName );
402411
mSymb[i].setColor( color );
412+
// Use the 'dynamic' color for mRubberBand
413+
if ( i == SYMB_DYNAMIC )
414+
{
415+
mRubberBandLine->setColor(QColor(colorName));
416+
}
403417
}
404418
mSymb[i].setWidth( mLineWidth );
405419
}
@@ -415,6 +429,7 @@ void QgsGrassEdit::init()
415429
symbologyList->clear();
416430
symbologyList->setSorting(-1);
417431

432+
418433
for ( int i = SYMB_COUNT-1; i >= 0; i-- ) {
419434
if ( i == SYMB_NODE_0 ) continue;
420435

@@ -492,10 +507,7 @@ void QgsGrassEdit::init()
492507

493508
mPixmap = &mCanvasEdit->pixmap();
494509

495-
mRubberBandLine = new QgsRubberBand(mCanvas);
496-
mRubberBandIcon = new QgsVertexMarker(mCanvas);
497-
mRubberBandLine->setZValue(20);
498-
mRubberBandIcon->setZValue(20);
510+
499511

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

0 commit comments

Comments
 (0)