Unsolved QByteArray to Gif
-
QByteArray ba = mygif
QBuffer * data = new QBuffer(&ba);
QMovie *gif = new QMovie(data);
ui->mylabel->setMovie(gif);
gif->start();
I tried this but the program crashes -
@Melia said in QByteArray to Gif:
I tried this but the program crashes
Because
QByteArray ba
goes out of scope. Use QBuffer::setData() for example. -
Worked! How can I do with QMovie border radius
-
@Melia said in QByteArray to Gif:
How can I do with QMovie border radius
What do you mean? What border radius?
-
I want to make a gif avatar.
-
@Melia Sorry, I don't know what exactly you mean. Please explain clearly.
-
@Melia
QMovie's don't have a border or radius per se. If it's an animated GIF you would need to take the GIF frames' size to get measurements, if that's what you have in mind? -
It will be both gif and round -
@Melia Can't you create a Gif with transparency? I mean, the part outside of that round central part can be simply transparent.
-
Gifs will be random. I thought something like but how can I do it? -
Hi,
One way to do it would be to subclass QLabel and reimplement the paintEvent method, there you start by letting the original do its work and then apply an overlay on it.
-
How can I do it? I do not know
-
As I wrote, subclass QLabel, re-implement paintEvent, call the base classe implementation and then do your own painting.