Hello guys!

I need to insert a QPixmap in a QTextDocument and all I tried didnt work.

If anyone could help me. Code below:

Qt Code:
  1. QPrinter impressora(QPrinter::HighResolution);
  2. QTextDocument document;
  3. document.setHtml(html);
  4. if(matriz == true)
  5. {
  6. QPainter painter;
  7.  
  8. QPalette palette;
  9.  
  10. QRect rectpag = impressora.pageRect();
  11.  
  12. palette.setColor(backgroundRole(), QColor(255, 255, 255));
  13. this->ui->tab_3->setPalette(palette);
  14. this->ui->tab_3->setAutoFillBackground(true);
  15.  
  16. QPixmap pm = this->ui->tab_3->grab();
  17. pm = pm.transformed(QTransform().rotate(270));
  18. QSize tamanho = pm.size();
  19.  
  20. tamanho.scale(rectpag.size(), Qt::KeepAspectRatio);
  21.  
  22. painter.drawPixmap(Qt::AlignCenter, Qt::AlignHCenter, tamanho.width(), tamanho.height(), pm);
  23.  
  24. document.drawContents(&painter);
  25. this->ui->tab_3->setAutoFillBackground(false);
  26. }
  27. document.print(&impressora);
To copy to clipboard, switch view to plain text mode 

Thanks a lot.