Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, July 2007
Standalone Object Inspector for Qt 4?


Message 1 in thread

In the Qt solutions catalog, there is an Object Inspector[1] that can
connect to a running Qt application and tell you various things about it. Is
there a similar tool for Qt 4? I know that Qt Designer has something called
an "object inspector", but I don't believe that can be used with a running
application.
[1]
http://trolltech.com/products/qt/addon/solutions/catalog/3/Tools/qtobjectinspector/

Thanks,
Tom

Message 2 in thread

Tom Panning wrote:
> In the Qt solutions catalog, there is an Object Inspector[1] that can 
> connect to a running Qt application and tell you various things about 
> it. Is there a similar tool for Qt 4? I know that Qt Designer has 
> something called an "object inspector", but I don't believe that can 
> be used with a running application.
> [1] 
> http://trolltech.com/products/qt/addon/solutions/catalog/3/Tools/qtobjectinspector/
>
>

It's actually trivial to write your own with Qt's QAbstractItemModel.  
It's easy since QObject is natively a doubly linked tree. You get 
parent() and children(). You can use this in your model implementation 
to view a QObject as a tree without caching any data.  If I get some 
time today I might post an example of this. It's quite easy.

--Justin
begin:vcard
begin:vcard
fn:Justin Noel
n:Noel;Justin
org:ICS;Engineering
adr:;;54B Middlesex Trpk;Bedford;MA;01730;USA
email;internet:justin@xxxxxxx
title:Sr. Consulting Engineer / Certified Qt Instructor
tel;work:(617) 621-0060
url:http://www.ics.com
version:2.1
end:vcard


Message 3 in thread

Justin Noel wrote:
> Tom Panning wrote:
>> In the Qt solutions catalog, there is an Object Inspector[1] that can 
>> connect to a running Qt application and tell you various things about 
>> it. Is there a similar tool for Qt 4? I know that Qt Designer has 
>> something called an "object inspector", but I don't believe that can 
>> be used with a running application.
>> [1] 
>> http://trolltech.com/products/qt/addon/solutions/catalog/3/Tools/qtobjectinspector/ 
>>
>>
>>
>
> It's actually trivial to write your own with Qt's QAbstractItemModel.  
> It's easy since QObject is natively a doubly linked tree. You get 
> parent() and children(). You can use this in your model implementation 
> to view a QObject as a tree without caching any data.  If I get some 
> time today I might post an example of this. It's quite easy.
>
> --Justin

Oh wait. I was thinking object inspector window from Designer there... A 
stand-alone debugger style application is going to be much more 
difficult. ;)

--Justin
begin:vcard
begin:vcard
fn:Justin Noel
n:Noel;Justin
org:ICS;Engineering
adr:;;54B Middlesex Trpk;Bedford;MA;01730;USA
email;internet:justin@xxxxxxx
title:Sr. Consulting Engineer / Certified Qt Instructor
tel;work:(617) 621-0060
url:http://www.ics.com
version:2.1
end:vcard


Message 4 in thread

On 7/10/07, Justin Noel <justin@xxxxxxx> wrote:
>
> Justin Noel wrote:
> > Tom Panning wrote:
> >> In the Qt solutions catalog, there is an Object Inspector[1] that can
> >> connect to a running Qt application and tell you various things about
> >> it. Is there a similar tool for Qt 4? I know that Qt Designer has
> >> something called an "object inspector", but I don't believe that can
> >> be used with a running application.
> >> [1]
> >>
> http://trolltech.com/products/qt/addon/solutions/catalog/3/Tools/qtobjectinspector/
> >>
> >>
> >>
> >
> > It's actually trivial to write your own with Qt's QAbstractItemModel.
> > It's easy since QObject is natively a doubly linked tree. You get
> > parent() and children(). You can use this in your model implementation
> > to view a QObject as a tree without caching any data.  If I get some
> > time today I might post an example of this. It's quite easy.
> >
> > --Justin
>
> Oh wait. I was thinking object inspector window from Designer there... A
> stand-alone debugger style application is going to be much more
> difficult. ;)


Yeah, I had already done what you described (and made it so that I could set
the object properties using the Qt Property Browser solution), but I haven't
added the ability to track signals and slots. Also, my object tree and
property browser don't update in real time. While I could probably do all
this, there's no point in reinventing the wheel. Since Trolltech has already
done all this for Qt 3, it seems logical that there would be a similar tool
for Qt 4.

Thanks for your reply,
Tom

Message 5 in thread

On 7/10/07, Tom Panning <lurchvt@xxxxxxxxx> wrote:
Since Trolltech has already
> done all this for Qt 3, it seems logical that there would be a similar tool
> for Qt 4.

One issue I recall from considering how to port KSpy (which is a
similar tool) is that there is no (public) way to access the root
QObjects in Qt 4. You can only access the root widgets.

Cheers

Rich.

--
 [ signature omitted ]