Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Examining on-screen widgets



  • I have frequently wanted to click around my Qt widgets app so see what my widget hierarchy looks like at runtime, and also view the widgets' properties etc. As close as possible to the "F12 Developer Tools" mode you can go into in all web browsers.

    In the last picture of the first post at https://forum.qt.io/topic/97513/strange-behavior-of-widgets-in-qvboxlayout, that user shows some kind of "Object Explorer" for his app. Just what I have been looking for. But....

    • What is he using? Is that Qt Creator? I am Python/PyQt, I do not use Qt Creator. If it's Qt Creator, presumably I won't be able to use it again my app?

    • I can see it shows widget name & class. Can user click on those nodes to find out more about the widget, like its size, color, even have it highlight the widget outline on the screen? Or is that the only information it can display?


  • Moderators

    That screenshot is from Qt Designer which is a WYSIWYG editor for .ui files, and it is built into Qt Creator.

    Try opening your .ui files with it, it may work. If you defined your UI in code, then you're out of luck.

    Perhaps some object inspection tool (KDAB's GammaRay for example) will help you - it will show you all objects and properties.

    Also, each QObject has a method called dumpObjectInfo() and dumpObjectTree() link - that might be cumbersome to use, but will get you the information you need, too.



  • @sierdzio

    • There are no .ui files in my Python/PyQt projects. Everything is done by creating widgets in code.
    • I would need the information "interactively" to be of any use.

    So looks like I'm out of luck...!


  • Lifetime Qt Champion

    Hi,

    You should take a look at KDAB's Gammaray.

    It allows you to take a deep dive into your application.



  • @SGaist
    As usual from you, a very interesting link! I'm not sure it does the same sort of thing as I had mind (visualizing layouts & widgets [EDIT hang on, https://doc.qt.io/GammaRay/gammaray-widget-inspector.html might be closest to what I had in mind]), and I won't get code navigation because Python, but I must give it a look. When I have a minute --- it looks quite complex/impressive!


Log in to reply