So, I try to fill QByteArray with data (and then save it to database). I use QFileDialog to obtain picture, QPixmap to paint it in a grid, and it works fine, but QByteArray, that is intended to be stored in db through sqlalchemy is empty after QPixmap::save().
Beside, signals, connected to bytesWritten and readyRead doesn’t fire too. Pixmap is ok, grid contains a valid image after setData.
ba = QtCore.QByteArray()
buffer = QtCore.QBuffer(ba)
buffer.bytesWritten.connect(self.b)
buffer.readyRead.connect(self.c)
buffer.open(QtCore.QIODevice.WriteOnly)
pixmap.save(buffer)
buffer.close()
ba = buffer.data()
So, what am I doing wrong?
I think you need to specify the image file format when calling pixmap.save(), smth like this:
hope this helps, regards