<div dir="ltr"><p>I use method1 to find some text in qtablewidget rows.</p><p>
method1 :</p>
<pre class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-lang-py gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-prettyprint gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-prettyprinted"><code><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-kwd">def</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln"> </span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-typ">FindItem</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">(</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln">self</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">):</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln">
items </span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">=</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln"> self</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">.</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-typ">SuraBRS</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">.</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln">findItems</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">(</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln">
self</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">.</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-typ">SearchTbox</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">.</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln">text</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">(),</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln"> </span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-typ">QtCore</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">.</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-typ">Qt</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">.</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-typ">MatchContains</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">)</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln">
</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-kwd">if</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln"> items</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">:</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln">
results </span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">=</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln"> </span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-str">'\n'</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">.</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln">join</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">(</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln">
</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-str">'row %d column %d'</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln"> </span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">%</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln"> </span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">(</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln">item</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">.</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln">row</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">()</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln"> </span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">+</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln"> </span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-lit">1</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">,</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln"> item</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">.</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln">column</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">()</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln"> </span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">+</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln"> </span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-lit">1</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">)</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln">
</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-kwd">for</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln"> item </span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-kwd">in</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln"> items</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">)</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln">
</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-kwd">else</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">:</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln">
results </span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">=</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln"> </span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-str">'Found Nothing'</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln">
</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-kwd">print</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pun">(</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-pln">results</span><span class="gmail-m_7908336738339821918gmail-m_8126486469596728402gmail-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>.for example :</p><p>the row contents is "hello world"</p>I want to highlight(search) "o" in that row. </div>