[Qt-interest] A design problem

lists4pghanghas lists4pghanghas at gmail.com
Sun May 2 21:57:30 CEST 2010


Hi

I am having some design problems with my qt development. not to mention 
I am new to Qt and OOP development. Here is one of them:
When I do implement subclasses for my particular use. I find it hard to 
decide where to handle qt keypress events. Say I have a small gui 
component that will need some drawable elements as its children and 
sometimes the parent child hierarchy can go deeper. Now I am faced with 
the task of choosing where to handle the key events, All in the ultimate 
parent or with every element(leaving unhandled key event for its parent) 
thus making them focusable (as a prerequisite) and everybody signals 
there change in state or anything due to keys by emitting a signal, and 
then that signal can be propagated upwards if required. But the second 
approach sometime leads to chaining of signals if only the ultimate 
parent is exposed to the rest of the application. eg child's signal 
connected to its parents slot or signal, then parents signal connected 
to its parents signal or slot ultimately reaching a stage where its 
available to rest of the application as a whole.

Thanks
PSG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100503/dbe23180/attachment.html 


More information about the Qt-interest-old mailing list