Skip to content

RhiWidgetMixin

Sub classes

Name Children Inherits
RhiWidget
prettyqt.widgets.rhiwidget
Widget for rendering 3D graphics via the Qt Rendering Hardware Interface.

    Base classes

    Name Children Inherits
    WidgetMixin
    prettyqt.widgets.widget
    object
    builtins
    The base class of the class hierarchy.
    • type
    • async_generator
    • bytearray_iterator
    • bytearray
    • bytes_iterator
    • bytes
    • builtin_function_or_method
    • callable_iterator
    • PyCapsule
    • cell
    • classmethod_descriptor
    • ...

      ⋔ Inheritance diagram

      graph TD
        1064262194["widgets.RhiWidgetMixin"]
        829357528["widgets.WidgetMixin"]
        3227531497["core.ObjectMixin"]
        2751680898["builtins.object"]
        625385617["gui.PaintDeviceMixin"]
        829357528 --> 1064262194
        3227531497 --> 829357528
        2751680898 --> 3227531497
        625385617 --> 829357528
        2751680898 --> 625385617
        2751680898 --> 829357528
        2751680898 --> 1064262194

      🛈 DocStrings

      Bases: WidgetMixin, _RhiWidgetBase

      Source code in prettyqt/widgets/rhiwidget.py
      class RhiWidgetMixin(widgets.WidgetMixin, _RhiWidgetBase):
          def _get_map(self):
              maps = super()._get_map()
              maps |= {"colorBufferFormat": TEXTURE_FORMAT}
              return maps
      
          def set_api(self, api: ApiStr | mod.Api):
              """Set the graphics API to use.
      
              Args:
                  api: graphics API
              """
              self.setApi(API.get_enum_value(api))
      
          def get_api(self) -> ApiStr:
              """Return current graphics API.
      
              Returns:
                  graphics API
              """
              return API.inverse[self.api()]
      
          def set_color_buffer_format(self, fmt: TextureFormatStr | mod.TextureFormat):
              """Set the texture format for the color buffer.
      
              Args:
                  fmt: texture format
              """
              self.setColorBufferFormat(TEXTURE_FORMAT.get_enum_value(fmt))
      
          def get_color_buffer_format(self) -> TextureFormatStr:
              """Return current color buffer texture format.
      
              Returns:
                  texture format
              """
              return TEXTURE_FORMAT.inverse[self.colorBufferFormat()]
      
          def set_fixed_color_buffer_size(self, size: datatypes.SizeType):
              """Set fixed color buffer size."""
              self.setFixedColorBufferSize(datatypes.to_size(size))
      
          def get_fixed_color_buffer_size(self) -> core.Size:
              """Return fixed color buffer size."""
              return core.Size(self.fixedColorBufferSize())
      

      get_api() -> ApiStr

      Return current graphics API.

      Source code in prettyqt/widgets/rhiwidget.py
      def get_api(self) -> ApiStr:
          """Return current graphics API.
      
          Returns:
              graphics API
          """
          return API.inverse[self.api()]
      

      get_color_buffer_format() -> TextureFormatStr

      Return current color buffer texture format.

      Source code in prettyqt/widgets/rhiwidget.py
      def get_color_buffer_format(self) -> TextureFormatStr:
          """Return current color buffer texture format.
      
          Returns:
              texture format
          """
          return TEXTURE_FORMAT.inverse[self.colorBufferFormat()]
      

      get_fixed_color_buffer_size() -> core.Size

      Return fixed color buffer size.

      Source code in prettyqt/widgets/rhiwidget.py
      def get_fixed_color_buffer_size(self) -> core.Size:
          """Return fixed color buffer size."""
          return core.Size(self.fixedColorBufferSize())
      

      set_api(api: ApiStr | mod.Api)

      Set the graphics API to use.

      Parameters:

      Name Type Description Default
      api ApiStr | Api

      graphics API

      required
      Source code in prettyqt/widgets/rhiwidget.py
      def set_api(self, api: ApiStr | mod.Api):
          """Set the graphics API to use.
      
          Args:
              api: graphics API
          """
          self.setApi(API.get_enum_value(api))
      

      set_color_buffer_format(fmt: TextureFormatStr | mod.TextureFormat)

      Set the texture format for the color buffer.

      Parameters:

      Name Type Description Default
      fmt TextureFormatStr | TextureFormat

      texture format

      required
      Source code in prettyqt/widgets/rhiwidget.py
      def set_color_buffer_format(self, fmt: TextureFormatStr | mod.TextureFormat):
          """Set the texture format for the color buffer.
      
          Args:
              fmt: texture format
          """
          self.setColorBufferFormat(TEXTURE_FORMAT.get_enum_value(fmt))
      

      set_fixed_color_buffer_size(size: datatypes.SizeType)

      Set fixed color buffer size.

      Source code in prettyqt/widgets/rhiwidget.py
      def set_fixed_color_buffer_size(self, size: datatypes.SizeType):
          """Set fixed color buffer size."""
          self.setFixedColorBufferSize(datatypes.to_size(size))
      

      :fa-brands-github: Show source on GitHub