[PyQt] [PYQT]How to set my text data in qtextedit as html

Maziar Parsijani maziar.parsijani at gmail.com
Mon Sep 24 15:20:46 BST 2018


Hi,
I have a data in sqlte db now i want to retrieve my data and set it in
qtextedit.

> self.SearchResults = QtWidgets.QTextEdit(self)
>
> cur = conn.cursor()
> conn.text_factory = str
> qury = sth
> cur.execute(qury)
> self.all_rows = cur.fetchall()
>
> for row in self.all_rows:
>
> self.SearchResults.append('{0} )-A={2}'.format(b, row[0]))
>
> Now how could I add the rows as html code.LIKE BELOW?

> "<html><head><meta name=\"qrichtext\" content=\"1\" /><style
> type=\"text/css\">\n"
> "p, li { white-space: pre-wrap; }\n"
> "</style></head><body style=\" font-family:\'Amiri\'; font-size:9pt;
> font-weight:400; font-style:normal;\">\n"
> "<p align=\"right\" style=\" margin-top:0px; margin-bottom:0px;
> margin-left:0px; margin-right:0px; -qt-block-indent:0;
> text-indent:0px;\"><span style=\"
> font-family:\'Sans\';\">TEXT</span></p></body></html>"
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20180924/59c83bee/attachment.html>


More information about the PyQt mailing list