<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="content" component="post/content" itemprop="text"><p class="">i got my debug helper sorta working, but have a Q about how they work</p><p class="">how do i show a field within the class/struct as “the value” i want to see?</p><p class="">details: steps i took were this:</p>
<ul class="">
<li class="">go to folder that contains Qt Creator.app</li>
<li class="">right click "Qt Creator"->show package contents (obviously, right?)</li>
<li class="">go into Contents->Resources->debugger</li>
<li class="">edit the file "<a href="http://personaltypes.py" rel="nofollow" class="">personaltypes.py</a>"</li>
<li class="">at the bottom, enter the SIMPLEST POSSIBLE function, like this:</li>
</ul>
<pre class="markdown-highlight"><code class="python hljs"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">qdump__YOUR_CLASS</span><span class="hljs-params">(d, value)</span>:</span>
        d.putValue(<span class="hljs-string">"i see the light!"</span>)
        d.putNumChild(<span class="hljs-number">0</span>)
</code></pre>
<ul class="">
<li class="">substitute your actual class name, above, for "YOUR_CLASS"</li>
<li class="">now run</li>
<li class="">you SHOULD see "i see the light!" in the debugger, next to any var of type YOUR_CLASS</li>
</ul><p class="">so far so good?</p>
<ul class="">
<li class="">copy the file "<a href="http://personaltypes.py" rel="nofollow" class="">personaltypes.py</a>" into your own dev tree, wherever you want to keep your python code</li>
<li class="">revert the changes to the original one (so they do not conflict)</li>
<li class="">in Qt Creator 4.3, go to preferences->debuggers->gdb (note: in
 4.4 or later, go to "preferences->debuggers->locals & 
expressions")</li>
<li class="">in that panel, in "Extra Debugging Helpers", put the path to your version of the "<a href="http://personaltypes.py" rel="nofollow" class="">personaltypes.py</a>" script</li>
<li class="">run your app again.  you should still see "i see the light!".  if not, check your steps</li>
</ul><p class="">note that if ANYTHING unexpected is in your python file, it will fail
 silently, no message in the debug log. this is a large part of why i 
could not figure this whole thing out in the first place.</p><p class="">now that you have your script actually RUNNING, you can fiddle with it to make it do what you need.</p><p class="">so my last question is this:<br class="">
If I have a class:</p>
<pre class="markdown-highlight"><code class="bash hljs">class foo {
    <span class="hljs-built_in">type</span>1   var1;
    <span class="hljs-built_in">type</span>2   var2;
    <span class="hljs-built_in">type</span>3   var3;
};
</code></pre><p class="">and say var2 and var3 are implementation details and all i care about
 is just seeing var1 WITHOUT having to click the little "disclosure 
triangle" (twirly arrow), i thought i could just have my helper say 
this:</p>
<pre class="markdown-highlight"><code class="python hljs"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">qdump__foo</span><span class="hljs-params">(d, value)</span>:</span>
        d.putValue(value[<span class="hljs-string">"var1"</span>])
        d.putNumChild(<span class="hljs-number">0</span>)
</code></pre><p class="">but then all i get is TYPEINFO about "type1", i do not get the VALUE of type1.  what do i do to see the value?</p></div></body></html>