Skip to content

PieSlice

Qt Base Class: QPieSlice

Signature: QPieSlice(self, label: str, value: float, parent: Optional[PySide6.QtCore.QObject] = None) -> None QPieSlice(self, parent: Optional[PySide6.QtCore.QObject] = None) -> None

Base classes

Name Children Inherits
ObjectMixin
prettyqt.core.object
QPieSlice
PySide6.QtCharts
QPieSlice(self, label: str, value: float, parent: Optional[PySide6.QtCore.QObject] \= None) -> None

⋔ Inheritance diagram

graph TD
  1473367653696["charts.PieSlice"]
  1473299815024["core.ObjectMixin"]
  140713234304496["builtins.object"]
  1473367586352["QtCharts.QPieSlice"]
  1473288842240["QtCore.QObject"]
  1473291690208["Shiboken.Object"]
  1473299815024 --> 1473367653696
  140713234304496 --> 1473299815024
  1473367586352 --> 1473367653696
  1473288842240 --> 1473367586352
  1473291690208 --> 1473288842240
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: ObjectMixin, QPieSlice

Source code in prettyqt\charts\pieslice.py
class PieSlice(core.ObjectMixin, QtCharts.QPieSlice):
    def __repr__(self):
        return get_repr(self, self.label(), self.value())

    def set_label_position(
        self, position: LabelPositionStr | QtCharts.QPieSlice.LabelPosition
    ):
        """Set the label position.

        Args:
            position: label position
        """
        self.setLabelPosition(LABEL_POSITION.get_enum_value(position))

    def get_label_position(self) -> LabelPositionStr:
        """Return current label position.

        Returns:
            label position
        """
        return LABEL_POSITION.inverse[self.labelPosition()]

    def get_label_font(self) -> gui.Font:
        return gui.Font(self.labelFont())

    def get_label_brush(self) -> gui.Brush:
        return gui.Brush(self.labelBrush())

    def get_label_color(self) -> gui.Color:
        return gui.Color(self.labelColor())

    def get_pen(self) -> gui.Pen:
        return gui.Pen(self.pen())

    def get_brush(self) -> gui.Brush:
        return gui.Brush(self.brush())

    def get_color(self) -> gui.Color:
        return gui.Color(self.color())

    def get_border_color(self) -> gui.Color:
        return gui.Color(self.borderColor())

get_label_position() -> LabelPositionStr

Return current label position.

Source code in prettyqt\charts\pieslice.py
def get_label_position(self) -> LabelPositionStr:
    """Return current label position.

    Returns:
        label position
    """
    return LABEL_POSITION.inverse[self.labelPosition()]

set_label_position(position: LabelPositionStr | QtCharts.QPieSlice.LabelPosition)

Set the label position.

Parameters:

Name Type Description Default
position LabelPositionStr | LabelPosition

label position

required
Source code in prettyqt\charts\pieslice.py
def set_label_position(
    self, position: LabelPositionStr | QtCharts.QPieSlice.LabelPosition
):
    """Set the label position.

    Args:
        position: label position
    """
    self.setLabelPosition(LABEL_POSITION.get_enum_value(position))

⌗ Property table

Qt Property Type Doc
objectName QString
label QString
value double
labelVisible bool
labelPosition QPieSlice::LabelPosition
exploded bool
pen QPen
borderColor QColor
borderWidth int
brush QBrush
color QColor
labelBrush QBrush
labelColor QColor
labelFont QFont
labelArmLengthFactor double
explodeDistanceFactor double
percentage double
startAngle double
angleSpan double