Hi

On Wed, Feb 5, 2014 at 2:56 PM, hubbatov <[email protected]> wrote:
> Hi! I can`t change selection color using Qt in my app. Can anybody help with
> it?
> QgsMapCanvas::mapRenderer()->rendererContext()->setSelectionColor(QColor)
> not works :(

The renderer context you are accessing is the one that was used
previously for map rendering - for next redraw it will be overwritten.
In general you should not change anything in that context (it would be
better if the context would not be exposed).

The selection color is stored in QgsProject settings, the following
snippet shows how the selection color is read:

  QgsProject* prj = QgsProject::instance();
  int myRed = prj->readNumEntry( "Gui", "/SelectionColorRedPart", 255 );
  int myGreen = prj->readNumEntry( "Gui", "/SelectionColorGreenPart", 255 );
  int myBlue = prj->readNumEntry( "Gui", "/SelectionColorBluePart", 0 );
  int myAlpha = prj->readNumEntry( "Gui", "/SelectionColorAlphaPart", 255 );

... a similar code with "writeEntry" methods will change the selection color.


Regards
Martin
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to