Qt QTooltip with image always landscape

246 Views Asked by At

I have a Qt c++ App but when I tried to add tooltip with image it shows correctly if image is landscape but if image is portrait then it will be rotated event the original file is portrait any help ! Thanks in advance.

QByteArray byteArray;
QBuffer buffer(&byteArray);
QPixmap pixmap(path);
pixmap.scaled(256,256,Qt::KeepAspectRatio,Qt::FastTransformation).toImage().save(&buffer,"PNG");
QString iconBase64 = QString::fromLatin1(byteArray.toBase64().data());
buffer.close();
return QString("<center>"
               "<b>%1</b><br/>"
               "<img src='data:image/png;base64, %2'><br/>"
               "<i>Shift + double click to open file.</i>"
               "</center>")
        .arg(name)
        .arg(QString(iconBase64));
0

There are 0 best solutions below