def fill(xml: QXmlStreamWriter, brush: QBrush, tag: str = "fill"): xml.writeStartElement(tag) if brush.gradient( ) is not None and brush.gradient().type() != QGradient.NoGradient: grad = brush.gradient() if grad.type() != QGradient.LinearGradient: xml.writeAttribute("gradient-rotation", "diagonal") else: if grad.start().x() == grad.finalStop().x(): xml.writeAttribute("gradient-rotation", "vertical") elif grad.start().y() == grad.finalStop().y(): xml.writeAttribute("gradient-rotation", "horizontal") else: xml.writeAttribute("gradient-rotation", "diagonal") xml.writeAttribute("color", grad.stops()[0][1].name()) xml.writeAttribute("gradient-color", grad.stops()[1][1].name()) else: xml.writeAttribute("color", brush.color().name()) xml.writeEndElement() #fecha fill