I would like to add an on-map drawing function in my stand alone app, so I used
QgsRubberBand to make it. I made a tool that emits points and then draw the
QgsRubberBand. The problem is I don't find any solution to style it (applying a qml file would be perfect).
Here is the code I use to draw my QgsRubberBand:
def update_largage_eau_canadaire(self, model): points = model.largage_eau_canadaire #points is an array of QgsPoint if len(points) > - 1: if self.largage_c_rubber_ is None: self.largage_c_rubber_ = QgsRubberBand(self.canvas_, False) self.largage_c_rubber_.setToGeometry(QgsGeometry. fromPolyline(points), None) self.largage_c_rubber_.setColor(QColor(255, 0, 0, 255)) self.largage_c_rubber_.setWidth(2)
Here is the result: