a rather general question, i hope it isn't too unrelated..
i have a class derived from QObject - i want to know when a dynamic property changes, so i added a signal
void dynamicPropertyChanged ( QByteArray name );
To copy to clipboard, switch view to plain text mode
that i emit whenever a dynamic property changed event is caught (mainly to inform client objects):
bool polly
::Element::event(QEvent *e
) {
if( e
->type
() == QEvent::DynamicPropertyChange ) {
e->accept();
emit dynamicPropertyChanged( static_cast<QDynamicPropertyChangeEvent*>(e)->propertyName() );
}
return true;
}
bool polly::Element::event(QEvent *e)
{
if( e->type() == QEvent::DynamicPropertyChange )
{
e->accept();
emit dynamicPropertyChanged( static_cast<QDynamicPropertyChangeEvent*>(e)->propertyName() );
}
return true;
}
To copy to clipboard, switch view to plain text mode
now, i have a class derived from the class that emits this signal, where i want to test the property to make sure its of the appropriate type/value.
my question is: should i do it by:
- overloading event in the derived class and respond there
- create a slot that tests the new value and connect it to the signal
?
Bookmarks