TextFormatMixin
Subclasses
⋔ Inheritance diagram
graph TD
1473245646080["gui.TextFormatMixin"]
140713234304496["builtins.object"]
140713234304496 --> 1473245646080
🛈 DocStrings
Source code in prettyqt\gui\textformat.py
| class TextFormatMixin:
def __getitem__(self, key: int):
return self.property(key)
def __setitem__(self, key: int, value):
self.setProperty(key, value)
def __contains__(self, key: int):
return self.hasProperty(key)
def __bool__(self):
return self.isValid()
def __repr__(self):
return get_repr(self, self.type())
def get_background(self) -> gui.Brush:
return gui.Brush(self.background())
def get_foreground(self) -> gui.Brush:
return gui.Brush(self.foreground())
def get_brush_property(self, property_id: int) -> gui.Brush:
return gui.Brush(self.brushProperty(property_id))
def get_color_property(self, property_id: int) -> gui.Color:
return gui.Color(self.colorProperty(property_id))
def get_pen_property(self, property_id: int) -> gui.Pen:
return gui.Pen(self.penProperty(property_id))
def set_layout_direction(
self, direction: constants.LayoutDirectionStr | constants.LayoutDirection
):
"""Set layout direction.
Args:
direction: layout direction
"""
self.setLayoutDirection(constants.LAYOUT_DIRECTION.get_enum_value(direction))
def get_layout_direction(self) -> constants.LayoutDirectionStr:
"""Get the current layout direction.
Returns:
layout direction
"""
return constants.LAYOUT_DIRECTION.inverse[self.layoutDirection()]
def select_full_width(self, value: bool = True):
prop = gui.QTextFormat.Property.FullWidthSelection
self.setProperty(prop, value) # type: ignore
|
get_layout_direction() -> constants.LayoutDirectionStr
Get the current layout direction.
Source code in prettyqt\gui\textformat.py
| def get_layout_direction(self) -> constants.LayoutDirectionStr:
"""Get the current layout direction.
Returns:
layout direction
"""
return constants.LAYOUT_DIRECTION.inverse[self.layoutDirection()]
|
set_layout_direction(direction: constants.LayoutDirectionStr | constants.LayoutDirection)
Set layout direction.
Parameters:
Name |
Type |
Description |
Default |
direction |
LayoutDirectionStr | LayoutDirection
|
|
required
|
Source code in prettyqt\gui\textformat.py
| def set_layout_direction(
self, direction: constants.LayoutDirectionStr | constants.LayoutDirection
):
"""Set layout direction.
Args:
direction: layout direction
"""
self.setLayoutDirection(constants.LAYOUT_DIRECTION.get_enum_value(direction))
|