Exemple #1
0
 def base64_from_icon_obj(self, icon_obj, width, height):
     """Convert icon object to base64 encoding."""
     image = QImage(icon_obj.pixmap(width, height).toImage())
     byte_array = QByteArray()
     buffer = QBuffer(byte_array)
     image.save(buffer, "PNG")
     return byte_array.toBase64().data().decode()
Exemple #2
0
def qbytearray_to_str(qbyte: QByteArray) -> str:
    """Convert a window state to a string.

    Used for restoring the state of the main window.

    Parameters
    ----------
    qbyte : QByteArray
        State array.
    """
    return QBYTE_FLAG + qbyte.toBase64().data().decode()