2

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));
eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Amr Osman
  • 119
  • 2
  • 10
  • It works for me correctly, what do you call an image a landscape or portrait ?, and how do you change from one to another? – eyllanesc Jul 10 '18 at 23:28

0 Answers0