Skip to content

ConicalGradient

Qt Base Class: QConicalGradient

Signature: QConicalGradient(self) -> None QConicalGradient(self, QConicalGradient: PySide6.QtGui.QConicalGradient) -> None QConicalGradient(self, center: Union[PySide6.QtCore.QPointF, PySide6.QtCore.QPoint, PySide6.QtGui.QPainterPath.Element], startAngle: float) -> None QConicalGradient(self, cx: float, cy: float, startAngle: float) -> None

Base classes

Name Children Inherits
GradientMixin
prettyqt.gui.gradient
QConicalGradient
PySide6.QtGui
QConicalGradient(self) -> None

⋔ Inheritance diagram

graph TD
  1473245605088["gui.ConicalGradient"]
  1473245598256["gui.GradientMixin"]
  140713234304496["builtins.object"]
  1473300170208["QtGui.QConicalGradient"]
  1473300122384["QtGui.QGradient"]
  1473291690208["Shiboken.Object"]
  1473245598256 --> 1473245605088
  140713234304496 --> 1473245598256
  1473300170208 --> 1473245605088
  1473300122384 --> 1473300170208
  1473291690208 --> 1473300122384
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: GradientMixin, QConicalGradient

Used in combination with QBrush to specify a conical gradient brush.

Source code in prettyqt\gui\conicalgradient.py
class ConicalGradient(gui.GradientMixin, gui.QConicalGradient):
    """Used in combination with QBrush to specify a conical gradient brush."""

    def __repr__(self):
        return get_repr(self, self.get_center(), self.angle())

    def get_center(self) -> core.PointF:
        return core.PointF(self.center())

    def get_css(self) -> str:
        """Convert gradient to a CSS string. Can be used for stylesheets."""
        center = self.center()
        cx, cy = center.x(), center.y()
        stops = self.stops()
        stops = "\n".join(f"    stop: {stop:f} {color.name()}" for stop, color in stops)
        spread = self.get_spread()
        return (
            "qconicalgradient(\n"
            f"    cx: {cx}, cy: {cy}, angle: {self.angle()}, spread:{spread},\n"
            f"{stops})"
        )

get_css() -> str

Convert gradient to a CSS string. Can be used for stylesheets.

Source code in prettyqt\gui\conicalgradient.py
def get_css(self) -> str:
    """Convert gradient to a CSS string. Can be used for stylesheets."""
    center = self.center()
    cx, cy = center.x(), center.y()
    stops = self.stops()
    stops = "\n".join(f"    stop: {stop:f} {color.name()}" for stop, color in stops)
    spread = self.get_spread()
    return (
        "qconicalgradient(\n"
        f"    cx: {cx}, cy: {cy}, angle: {self.angle()}, spread:{spread},\n"
        f"{stops})"
    )