Skip to content

ImageIOHandler

Qt Base Class: QImageIOHandler

Signature: QImageIOHandler(self) -> None

Base classes

Name Children Inherits
QImageIOHandler
PySide6.QtGui
QImageIOHandler(self) -> None

⋔ Inheritance diagram

graph TD
  1473245645104["gui.ImageIOHandler"]
  1473300113600["QtGui.QImageIOHandler"]
  1473291690208["Shiboken.Object"]
  140713234304496["builtins.object"]
  1473300113600 --> 1473245645104
  1473291690208 --> 1473300113600
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: mod

Defines the common image I/O interface for all image formats in Qt.

Source code in prettyqt\gui\imageiohandler.py
class ImageIOHandler(mod):
    """Defines the common image I/O interface for all image formats in Qt."""

    def __getitem__(self, key: ImageOptionStr | mod.ImageOption) -> datatypes.Variant:
        return self.get_option(key)

    def __setitem__(
        self, key: ImageOptionStr | mod.ImageOption, value: datatypes.Variant
    ):
        self.set_option(key, value)

    def get_format(self) -> str:
        return self.format().data().decode()

    def set_option(
        self, option: ImageOptionStr | mod.ImageOption, value: datatypes.Variant
    ):
        """Set option to given value.

        Args:
            option: option to use
            value: value to set
        """
        self.setOption(IMAGE_OPTION.get_enum_value(option), value)

    def get_option(self, option: ImageOptionStr | mod.ImageOption) -> datatypes.Variant:
        """Return the value assigned to option.

        Args:
            option: option to get

        Returns:
            option
        """
        return self.option(IMAGE_OPTION.get_enum_value(option))

    def supports_option(self, option: ImageOptionStr | mod.ImageOption) -> bool:
        """Return whether the image handler supports given option.

        Args:
            option: option to check

        Returns:
            option
        """
        return self.supportsOption(IMAGE_OPTION.get_enum_value(option))

get_option(option: ImageOptionStr | mod.ImageOption) -> datatypes.Variant

Return the value assigned to option.

Parameters:

Name Type Description Default
option ImageOptionStr | ImageOption

option to get

required
Source code in prettyqt\gui\imageiohandler.py
def get_option(self, option: ImageOptionStr | mod.ImageOption) -> datatypes.Variant:
    """Return the value assigned to option.

    Args:
        option: option to get

    Returns:
        option
    """
    return self.option(IMAGE_OPTION.get_enum_value(option))

set_option(option: ImageOptionStr | mod.ImageOption, value: datatypes.Variant)

Set option to given value.

Parameters:

Name Type Description Default
option ImageOptionStr | ImageOption

option to use

required
value Variant

value to set

required
Source code in prettyqt\gui\imageiohandler.py
def set_option(
    self, option: ImageOptionStr | mod.ImageOption, value: datatypes.Variant
):
    """Set option to given value.

    Args:
        option: option to use
        value: value to set
    """
    self.setOption(IMAGE_OPTION.get_enum_value(option), value)

supports_option(option: ImageOptionStr | mod.ImageOption) -> bool

Return whether the image handler supports given option.

Parameters:

Name Type Description Default
option ImageOptionStr | ImageOption

option to check

required
Source code in prettyqt\gui\imageiohandler.py
def supports_option(self, option: ImageOptionStr | mod.ImageOption) -> bool:
    """Return whether the image handler supports given option.

    Args:
        option: option to check

    Returns:
        option
    """
    return self.supportsOption(IMAGE_OPTION.get_enum_value(option))