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

Qt-interest Archive, May 2008
QObject in QEvent?


Message 1 in thread

How do I tell whether a QObject is currently handling an event or not? I
assumed that QObject would have some basic test, but I can't find one.
Neither can I find a function in Q[Core]Application to say which object is
currently processing an event.

Is there any way to tell whether a given QObject (derivative) is in an event
handler without re-writing every event handler in every object type?

Keith
**Please do not reply to me, reply to the list.**


Message 2 in thread

Keith Esau wrote:
>How do I tell whether a QObject is currently handling an event or not? I
>assumed that QObject would have some basic test, but I can't find one.
>Neither can I find a function in Q[Core]Application to say which object
> is currently processing an event.
>
>Is there any way to tell whether a given QObject (derivative) is in an
> event handler without re-writing every event handler in every object
> type?

There's no way, unless you modify Qt itself (QObject::event).

Why do you want to know this?

-- 
 [ signature omitted ] 

Attachment: signature.asc
Description: This is a digitally signed message part.


Message 3 in thread

I am getting the following warnings on Mac (where I cannot debug) but not on
Windows (where I can debug):

    QObject: Do not delete object, 'unnamed', during its event handler!

I have a delete check in my objects and would like to add a check for it
happening in an event so I can find my bug.

Keith
**Please do not reply to me, reply to the list.**

On 05-02-2008 5:08 PM, "Thiago Macieira" wrote:

> Keith Esau wrote:
>> How do I tell whether a QObject is currently handling an event or not? I
>> assumed that QObject would have some basic test, but I can't find one.
>> Neither can I find a function in Q[Core]Application to say which object
>> is currently processing an event.
>> 
>> Is there any way to tell whether a given QObject (derivative) is in an
>> event handler without re-writing every event handler in every object
>> type?
> 
> There's no way, unless you modify Qt itself (QObject::event).
> 
> Why do you want to know this?


--
 [ signature omitted ] 

Message 4 in thread

BTW, I am using Qt 4.3.4 (latest stable version).

Keith
**Please do not reply to me, reply to the list.**


On 05-02-2008 6:11 PM, "Keith Esau" wrote:

> I am getting the following warnings on Mac (where I cannot debug) but not on
> Windows (where I can debug):
> 
>     QObject: Do not delete object, 'unnamed', during its event handler!
> 
> I have a delete check in my objects and would like to add a check for it
> happening in an event so I can find my bug.
> 
> Keith
> **Please do not reply to me, reply to the list.**
> 
> On 05-02-2008 5:08 PM, "Thiago Macieira" wrote:
> 
>> Keith Esau wrote:
>>> How do I tell whether a QObject is currently handling an event or not? I
>>> assumed that QObject would have some basic test, but I can't find one.
>>> Neither can I find a function in Q[Core]Application to say which object
>>> is currently processing an event.
>>> 
>>> Is there any way to tell whether a given QObject (derivative) is in an
>>> event handler without re-writing every event handler in every object
>>> type?
>> 
>> There's no way, unless you modify Qt itself (QObject::event).
>> 
>> Why do you want to know this?


--
 [ signature omitted ] 

Message 5 in thread

Keith Esau wrote:
>BTW, I am using Qt 4.3.4 (latest stable version).

No, you're not :-)

This warning was added in Qt 4.4.0, so you can't be getting it in 4.3.4.

And to find out where your bug is, put a breakpoint in that message 
(QObject::~QObject, at the end, src/corelib/kernel/qobject.cpp, more or 
less at line 870). When it hits, climb up one stack frame and you'll see 
where you deleted an object inside the event handler.

>On 05-02-2008 6:11 PM, "Keith Esau" wrote:
>> I am getting the following warnings on Mac (where I cannot debug) but
>> not on Windows (where I can debug):
>>
>>     QObject: Do not delete object, 'unnamed', during its event
>> handler!
>>
>> I have a delete check in my objects and would like to add a check for
>> it happening in an event so I can find my bug.

-- 
 [ signature omitted ] 

Attachment: signature.asc
Description: This is a digitally signed message part.