[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: [PyQt] [PYQT]How to set my text data in qtextedit as html
From: Maziar Parsijani <maziar.parsijani () gmail ! com>
Date: 2018-09-24 14:32:46
Message-ID: CAPD04aP9k1KJO3yvhO5rVfxY0k7g7xUnSe9fk5cmuwAucEY7mg () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
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>"
>
[Attachment #5 (text/html)]
<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div \
dir="ltr"><div>Hi,<br></div>I have a data in sqlte db now i want to retrieve my data and set it \
in qtextedit.<br><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><pre \
style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"DejaVu Sans \
Mono";font-size:9.1pt"><span style="color:rgb(148,85,141)">self</span>.SearchResults = \
QtWidgets.QTextEdit(<span style="color:rgb(148,85,141)">self</span>) \
<br></pre></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><pre \
style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"DejaVu Sans \
Mono";font-size:9.1pt">cur = conn.cursor()<br>conn.text_factory = <span \
style="color:rgb(0,0,128)">str<br></span>qury = <span \
style="color:rgb(0,128,128);font-weight:bold">sth</span><br>cur.execute(qury)<br><span \
style="color:rgb(148,85,141)">self</span>.all_rows = cur.fetchall()<span \
style="color:rgb(0,0,128);font-weight:bold"></span><span \
style="color:rgb(0,0,128);font-weight:bold"></span></pre></blockquote><div></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><pre \
style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"DejaVu Sans \
Mono";font-size:9.1pt"><span style="color:rgb(0,0,128);font-weight:bold">for </span>row \
<span style="color:rgb(0,0,128);font-weight:bold">in </span><span \
style="color:rgb(148,85,141)">self</span>.all_rows:</pre></blockquote><div></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><pre \
style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"DejaVu Sans \
Mono";font-size:9.1pt"><span style="color:rgb(148,85,141)"></span><span \
style="color:rgb(148,85,141)">self</span>.SearchResults.append(<span \
style="color:rgb(0,128,128);font-weight:bold">'{0} )-</span><span \
style="color:rgb(0,128,128);font-weight:bold">A={2}</span><span \
style="color:rgb(0,128,128);font-weight:bold">'</span>.format(b, row[<span \
style="color:rgb(0,0,255)">0</span>]))</pre></blockquote><div>Now how could I add the rows as \
html code.LIKE BELOW?<br><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex">"<html><head><meta \
name=\"qrichtext\" content=\"1\" /><style \
type=\"text/css\">\n"<br>"p, li { white-space: pre-wrap; \
}\n"<br>"</style></head><body style=\" \
font-family:\'Amiri\'; font-size:9pt; font-weight:400; \
font-style:normal;\">\n"<br>"<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>"<br></blockquote><div> \
</div></div><div> </div><div> </div></div></div></div></div></div></div>
[Attachment #6 (text/plain)]
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic