3

is it possible to change the color of a selected feature in qgis 1.8? To highlight a feature I use:

vlayer.setSelectedFeatures(selectedList)
box = vlayer.boundingBoxOfSelected()
qgis.utils.iface.mapCanvas().setExtent(box)
qgis.utils.iface.mapCanvas().refresh()

But the selected featue is colored yellow. Is it possible to define for example a red color for this feature?

3

For reference, if you use QGIS >= v.2.4, you can set the selection color from the QGIS Python console in this way:

from PyQt4.QtGui import QColor
iface.mapCanvas().setSelectionColor( QColor("red") )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.