Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-44538

QTextBrowser toPlainText() output contains HEX chars in place of images

XMLWordPrintable

      Attached is code to reproduce the issue. When printed to QLabel etc. the chars are not visible, but when printed for example to file hex characters can be seen.

      #include <QFile>
      #include <QApplication>
      #include <QTextBrowser>
      #include <QTextStream>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          QTextBrowser *textBrowser = new QTextBrowser();
          textBrowser->setGeometry(QRect(50, 50, 531, 521));
          textBrowser->setSource(QUrl("qrc:/testHtml.html"));
      
          QFile f("output.txt");
          if(f.open(QIODevice::WriteOnly)) {
              QTextStream out(&f);
              out << textBrowser->toPlainText();
          }
          textBrowser->show();
          return a.exec();
      }
      

        1. output_windows.txt
          0.0 kB
          Alessandro Portale
        2. QTBUG-44538.zip
          4 kB
          Qt Support
        For Gerrit Dashboard: QTBUG-44538
        # Subject Branch Project Status CR V

            ritt.ks Konstantin Ritt
            qtcomsupport Qt Support
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes