Planned maintenance: From Sunday 8th December 10:00 CET there will be changes to try and solve the caching issues that have been experienced. If anyone has a problem connecting after this period then please PM @AndyS or any of the moderators.
Casts for events
Is there a special method for downcasting
QEvents to more concrete types? I was thinking something like
qgraphicsitem_cast? Should I simply stick to
static_castmade safe by checking
QEvent::typeso I suppose that's the way to go
Qt uses reinterpret_cast and static_cast made safe by checking QEvent::type so I suppose that's the way to go
Yes, this is what I do usually. The point is there are multiple event types that map to the same class, for example
QHoverEvent. Meaning you have to check all possible types (i.e. a big switch) before doing the cast. But fair enough, if there isn't anything like
qobject_cast, there isn't.