title: Are there any useful tools for diagnosing Qt layout and spacing problems?
body: <p><em>See also related question:</em> <a href="https://stackoverflow.com/questions/232267/how-do-you-debug-qt-layout-problems">How do you debug Qt layout problems</a></p>
  
  <p>I've got some complex widget hierarchies that I'm trying to lay out, and I run into the usual problems of things being closer together or further apart than I expect.  I've found a very useful technique is to create a stylesheet with a list of different background and border colours for widgets at different points in the hierarchy.  I've also added a <code>QFileSystemWatcher</code> to reload the stylesheet every time it's saved which allows rapid changes without needing to rebuild.</p>
  
  <p>However, I keep thinking that there must be a better way.  Looking at tools such as Firefox's web developer toolbar which will do things like mark borders or show the hierarchy of controls.  Are there any tools or libraries that will do this for Qt apps?  </p>
  
  <h2>UPDATE 5 May 2016</h2>
  
  <p>I've found one of the easiest and most informative ways of diagnosing spacing problems is to dump the widget hierarchy in terms of the QLayouts. I've created some sample code that embeds information about size hints, spacer items, padding and content margins: <a href="https://gist.github.com/pjwhams/6ebc040db3ab55615eafd831e184e39c" rel="noreferrer">https://gist.github.com/pjwhams/6ebc040db3ab55615eafd831e184e39c</a></p>
  
  <p>Another tool: <a href="https://github.com/robertknight/Qt-Inspector" rel="noreferrer">https://github.com/robertknight/Qt-Inspector</a></p>