<div dir="ltr"><h3 class="gmail-iw"><span name="Denis Rouzaud" class="gmail-gD">Hi Denis Rouzaud</span></h3><p>This question was for 19days ago.But you are correct the best method is html delegate and I did it but I couldn't fix that with my table and the table was changed but it worked nice.<br></p></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 20, 2018 at 12:28 PM, Denis Rouzaud <span dir="ltr"><<a href="mailto:denis.rouzaud@gmail.com" target="_blank">denis.rouzaud@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">This is not easily done.<div>You'd have to create a custom delegate using a QLabbel and use html in there.</div><div><br></div><div>I have been creating a search tool for tables and ending up highlighting the whole cell. </div><div>The effort and the risk of bad results is just not worth the effort IMHO.</div><div><br></div><div>Denis</div></div><br><div class="gmail_quote"><div><div class="h5"><div dir="ltr">Le mar. 31 juil. 2018 à 23:05, Maziar Parsijani <<a href="mailto:maziar.parsijani@gmail.com" target="_blank">maziar.parsijani@gmail.com</a>> a écrit :<br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div class="m_5955850977701824064m_1845155414697011962gmail-post-text">
<p>I use method1 to find some text in qtablewidget rows.</p><p>
method1 :</p>
<pre class="m_5955850977701824064m_1845155414697011962gmail-lang-py m_5955850977701824064m_1845155414697011962gmail-prettyprint m_5955850977701824064m_1845155414697011962gmail-prettyprinted"><code><span class="m_5955850977701824064m_1845155414697011962gmail-kwd">def</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln"> </span><span class="m_5955850977701824064m_1845155414697011962gmail-typ">FindItem</span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">(</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln">self</span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">):</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln">
items </span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">=</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln"> self</span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">.</span><span class="m_5955850977701824064m_1845155414697011962gmail-typ">SuraBRS</span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">.</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln">findItems</span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">(</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln">
self</span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">.</span><span class="m_5955850977701824064m_1845155414697011962gmail-typ">SearchTbox</span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">.</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln">text</span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">(),</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln"> </span><span class="m_5955850977701824064m_1845155414697011962gmail-typ">QtCore</span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">.</span><span class="m_5955850977701824064m_1845155414697011962gmail-typ">Qt</span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">.</span><span class="m_5955850977701824064m_1845155414697011962gmail-typ">MatchContains</span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">)</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln">
</span><span class="m_5955850977701824064m_1845155414697011962gmail-kwd">if</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln"> items</span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">:</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln">
results </span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">=</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln"> </span><span class="m_5955850977701824064m_1845155414697011962gmail-str">'\n'</span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">.</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln">join</span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">(</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln">
</span><span class="m_5955850977701824064m_1845155414697011962gmail-str">'row %d column %d'</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln"> </span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">%</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln"> </span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">(</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln">item</span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">.</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln">row</span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">()</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln"> </span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">+</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln"> </span><span class="m_5955850977701824064m_1845155414697011962gmail-lit">1</span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">,</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln"> item</span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">.</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln">column</span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">()</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln"> </span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">+</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln"> </span><span class="m_5955850977701824064m_1845155414697011962gmail-lit">1</span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">)</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln">
</span><span class="m_5955850977701824064m_1845155414697011962gmail-kwd">for</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln"> item </span><span class="m_5955850977701824064m_1845155414697011962gmail-kwd">in</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln"> items</span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">)</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln">
</span><span class="m_5955850977701824064m_1845155414697011962gmail-kwd">else</span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">:</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln">
results </span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">=</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln"> </span><span class="m_5955850977701824064m_1845155414697011962gmail-str">'Found Nothing'</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln">
</span><span class="m_5955850977701824064m_1845155414697011962gmail-kwd">print</span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">(</span><span class="m_5955850977701824064m_1845155414697011962gmail-pln">results</span><span class="m_5955850977701824064m_1845155414697011962gmail-pun">)</span></code></pre>
<p>Now I want to know how to highlight results or change their color.<strong>I want to select and highlight that text or character not all of the row or column</strong>.</p>
</div></div></div></div>
______________________________<wbr>_________________<br>
PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com" target="_blank">PyQt@riverbankcomputing.com</a><br>
<a href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" rel="noreferrer" target="_blank">https://www.<wbr>riverbankcomputing.com/<wbr>mailman/listinfo/pyqt</a></blockquote></div><span class="HOEnZb"><font color="#888888">-- <br><div dir="ltr" class="m_5955850977701824064gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">
<p class="m_5955850977701824064inbox-inbox-inbox-inbox-p1"><span style="color:rgb(0,0,0);font-family:Verdana,sans-serif;font-size:10pt">Denis Rouzaud</span><br style="color:rgb(0,0,0);font-family:Times;font-size:medium"><a href="mailto:denis@opengis.ch" style="font-family:Times;font-size:medium" target="_blank"><span style="color:rgb(0,0,0);font-family:Verdana,sans-serif;font-size:8pt">denis@opengis.ch</span> </a><br style="color:rgb(0,0,0);font-family:Times;font-size:medium"><span style="color:rgb(0,0,0);font-family:Verdana,sans-serif;font-size:8pt"><a>+41 76 370 21 22</a></span></p><p class="m_5955850977701824064inbox-inbox-inbox-inbox-p1"><span style="color:rgb(0,0,0);font-family:Verdana,sans-serif;font-size:8pt"><a><br></a></span></p></div></div>
</font></span></blockquote></div><br></div>