3

We've got an app with a complex hierarchy of widgets and I want to be able to browse this hierarchy, view and edit properties (such as size) in a similar manner to Spy++. It doesn't need to be running in an external app, if there is a widget that can display this information. So the question is, does such a mythical beast exist?

the_mandrill
  • 29,792
  • 6
  • 64
  • 93

3 Answers3

3

you can use Gammaray for spy Widget and signal slot and timers and resource and etc. Gammaray is very powerfull tool for spy Qt Application

khani_mahdi
  • 166
  • 9
3

The usual approach is to build such a beast in-house, using the introspection APIs, and walking the QWidget parent-child hierarchy. It's pretty easy to build a basic one; if you want to build a full property editor it's considerably more work. There's probably code you can re-use to reduce the work - possibly even the property inspector code from Designer, though it might be overkill. I've never gone as far as full GUI, due to time constraints - I've simply dumped the hierarchy and some fixed properties to stdout as text or XML.

I suppose it would be plausible to make a reusable GUI component out of this, that could be dropped into an arbitrary app, would look for top-level widgets, and allow everything to be inspected, if you have the time and inclination.

James Turner
  • 2,425
  • 2
  • 19
  • 24
  • I figured that was probably the case. Shame really as it would be quite a useful component, and probably not that difficult to do given the power of the `QAbstractItemModel` concept. – the_mandrill Oct 28 '10 at 20:21
0

Not a browser, but useful in debugging...

void QObject::dumpObjectTree() const

Dumps a tree of children to the debug output.

Anonymouse
  • 935
  • 9
  • 20