This one is a pickle. I'm trying to save my window/other elements to json format so that I can have multiple data stored in 1 place for my window/etc
I know that QByteArray has these functions: std::string QByteArray::toStdString() const and QByteArray QByteArray::fromStdString(const std::string &str)
Which should allow me to do it but so far I can't get it to work in Python. Some info about I found here (C) > Correct way to losslessly convert to and from std::string and QByteArray
I tried doing something like this:
print(self.saveGeometry())
bar = self.saveGeometry()
print(bytes(str(bar).encode()))
to convert QByteArray to bytearray that then I could save as string but I'm getting
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd9 in position 1: invalid continuation byte
Can any1 suggest how can I use either the native QT5 5.4+ function to save QByteArray to QByteArray.toStdString to json then load json > to QByteArray.fromStdString > to geometry or other method ?
Thanks!