<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Why VerticalHeaderItem cause crit.error]]></title><description><![CDATA[<p dir="auto">When i add any action to my VertHItem - in runtime it cause crit error and the program stop working. I've included QHeaderView, certain Item indeed exist, but i simply can't set text for it:</p>
<pre><code>if(tabWidGuide.verticalHeaderItem(0)-&gt;text()=="1") tabWidGuide.verticalHeaderItem(0)-&gt;setBackground(Qt::red);
</code></pre>
<p dir="auto">That code assures that item at '0' exist and it's label is 1, which is true, it 1 by default in my app.</p>
<p dir="auto">P.S. here is it in <a href="http://doc.qt.io/qt-5/qtablewidget.html#verticalHeaderItem" target="_blank" rel="noopener noreferrer nofollow ugc">documentation</a></p>
]]></description><link>https://forum.qt.io/topic/96370/why-verticalheaderitem-cause-crit-error</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Jul 2026 13:19:31 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/96370.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 06 Nov 2018 21:27:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Why VerticalHeaderItem cause crit.error on Wed, 07 Nov 2018 20:41:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/engelard">@<bdi>Engelard</bdi></a> said in <a href="/post/491816">Why VerticalHeaderItem cause crit.error</a>:</p>
<blockquote>
<p dir="auto">i assume that it set by default,</p>
</blockquote>
<p dir="auto">It isn't.</p>
]]></description><link>https://forum.qt.io/post/491818</link><guid isPermaLink="true">https://forum.qt.io/post/491818</guid><dc:creator><![CDATA[aha_1980]]></dc:creator><pubDate>Wed, 07 Nov 2018 20:41:48 GMT</pubDate></item><item><title><![CDATA[Reply to Why VerticalHeaderItem cause crit.error on Wed, 07 Nov 2018 20:38:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/aha_1980">@<bdi>aha_1980</bdi></a> i didn't set anything, i assume that it set by default, so why would i set it..</p>
]]></description><link>https://forum.qt.io/post/491816</link><guid isPermaLink="true">https://forum.qt.io/post/491816</guid><dc:creator><![CDATA[Engelard]]></dc:creator><pubDate>Wed, 07 Nov 2018 20:38:25 GMT</pubDate></item><item><title><![CDATA[Reply to Why VerticalHeaderItem cause crit.error on Wed, 07 Nov 2018 17:58:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/engelard">@<bdi>Engelard</bdi></a></p>
<blockquote>
<p dir="auto">Why it exist in the app, and it returning like it does'nt?</p>
</blockquote>
<ul>
<li>How do you set it?</li>
<li>Do you set it <em>before</em> your read it back?</li>
</ul>
]]></description><link>https://forum.qt.io/post/491794</link><guid isPermaLink="true">https://forum.qt.io/post/491794</guid><dc:creator><![CDATA[aha_1980]]></dc:creator><pubDate>Wed, 07 Nov 2018 17:58:15 GMT</pubDate></item><item><title><![CDATA[Reply to Why VerticalHeaderItem cause crit.error on Wed, 07 Nov 2018 15:04:36 GMT]]></title><description><![CDATA[<p dir="auto">Tnx for all advices for checking item, now it shows that header does'nt exist. BUT. Why it exist in the app, and it returning like it does'nt?</p>
]]></description><link>https://forum.qt.io/post/491780</link><guid isPermaLink="true">https://forum.qt.io/post/491780</guid><dc:creator><![CDATA[Engelard]]></dc:creator><pubDate>Wed, 07 Nov 2018 15:04:36 GMT</pubDate></item><item><title><![CDATA[Reply to Why VerticalHeaderItem cause crit.error on Wed, 07 Nov 2018 09:35:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> , <a class="plugin-mentions-user plugin-mentions-a" href="/user/aha_1980">@<bdi>aha_1980</bdi></a><br />
I agree with your advice.  However, I took the OP at his word when his question states</p>
<blockquote>
<p dir="auto">[I am] certain Item indeed exist</p>
</blockquote>
<p dir="auto">I shall be interested to see whether he comes back and says that pointer was NULL after all, maybe I'm too trusting...!</p>
]]></description><link>https://forum.qt.io/post/491730</link><guid isPermaLink="true">https://forum.qt.io/post/491730</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Wed, 07 Nov 2018 09:35:17 GMT</pubDate></item><item><title><![CDATA[Reply to Why VerticalHeaderItem cause crit.error on Wed, 07 Nov 2018 07:15:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/engelard">@<bdi>Engelard</bdi></a></p>
<p dir="auto">And that's exactly the difference between pointers and references you have to understand.</p>
<p dir="auto">Pointers have to be checked against nullptr before de-referencing, references can <em>always</em> be used.</p>
]]></description><link>https://forum.qt.io/post/491698</link><guid isPermaLink="true">https://forum.qt.io/post/491698</guid><dc:creator><![CDATA[aha_1980]]></dc:creator><pubDate>Wed, 07 Nov 2018 07:15:08 GMT</pubDate></item><item><title><![CDATA[Reply to Why VerticalHeaderItem cause crit.error on Wed, 07 Nov 2018 06:05:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/engelard">@<bdi>Engelard</bdi></a> said in <a href="/post/491644">Why VerticalHeaderItem cause crit.error</a>:</p>
<blockquote>
<p dir="auto">if(tabWidGuide.verticalHeaderItem(0)-&gt;text()=="1") tabWidGuide.verticalHeaderItem(0)-&gt;setBackground(Qt::red);</p>
</blockquote>
<p dir="auto">To add to <a class="plugin-mentions-user plugin-mentions-a" href="/user/mrjj">@<bdi>mrjj</bdi></a> : you should ALWAYS check pointers before dereferencing them!</p>
<pre><code>if(tabWidGuide.verticalHeaderItem(0) &amp;&amp; tabWidGuide.verticalHeaderItem(0)-&gt;text()=="1") tabWidGuide.verticalHeaderItem(0)-&gt;setBackground(Qt::red);
</code></pre>
]]></description><link>https://forum.qt.io/post/491689</link><guid isPermaLink="true">https://forum.qt.io/post/491689</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Wed, 07 Nov 2018 06:05:58 GMT</pubDate></item><item><title><![CDATA[Reply to Why VerticalHeaderItem cause crit.error on Tue, 06 Nov 2018 21:29:38 GMT]]></title><description><![CDATA[<p dir="auto">Hi<br />
You should check its not NULL<br />
try<br />
qDebug() &lt;&lt; "item = " &lt;&lt; tabWidGuide.verticalHeaderItem(0);</p>
]]></description><link>https://forum.qt.io/post/491646</link><guid isPermaLink="true">https://forum.qt.io/post/491646</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Tue, 06 Nov 2018 21:29:38 GMT</pubDate></item></channel></rss>