Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QTextEdit::toHtml() does not return the html title tag



  • I have a html code in a textEdit in which I am inserting a image with a title. When I call toHtml() it does not show the title, only the img src. Anyone have any ideas as to why this is happening?

    @
    QTextEdit *sth = new QTextEdit();
    sth->setAcceptRichText(true);
    sth->insertHtml("<img title = "wtv" src = "url to image" >");
    qDebug() << sth->toHtml(); // this shows only <img src = "url to image" >
    @



  • The simple answer is that QTextDocument is not a html editor.
    The html it supports is only sufficient to display its internal data similarly enough to be useful.



  • but as long as it renders the html title tag shouldn't it be returned when using toHtml? I mean what else would be the point to display the title then?


Log in to reply