[Qt-interest] QgraphicsScene: best way to manage events
Christian Gagneraud
cgagneraud at techworks.ie
Thu Nov 25 12:58:26 CET 2010
On 11/25/2010 11:15 AM, Oliver.Knoll at comit.ch wrote:
> On 2010-11-25 Christian Christian Gagneraud wrote:
>
>> ... Anyway, this solution seems to work well and is simple
>
> It is easy, it works, it is straightforward... - that's why I've
> chosen that approach back then ;) (And yes, that was the time when
> I first learnt Qt, too ;)
>
> To be honest I just started to use QGraphicsScene/View right now
> myself (in some hobby project), and it already can do a lot for you:
> there are certainly other approaches how you handle mouse/keyboard
> events within QGraphicsScene. But I think the basic idea of
> "forwarding the events to the active tool by calling its methods
> directly" is not totally wrong ;)
BTW, it seems that it is the same approach used in KOffice:
http://www.koffice.org/developer/apidocs/libs-flake/classKoToolBase.html
Regards,
Chris
>
> One design question you might still need to solve is whether to
> inherits from the whole QGraphicsView, as to catch events "globally",
> or inherit each of your objects from QGraphicsItem and catch the
> events on a per item basis. The later approach would be more flexible,
> since the item itself could decide /not/ to call the active tool,
> depending on its own state (e.g. when it is disabled, being
> transformed/scaled in some other way etc.).
>
> Good luck,
> Oliver
> --
> Oliver Knoll
> Dipl. Informatik-Ing. ETH
> COMIT AG - ++41 79 520 95 22
>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
--
Christian Gagneraud,
Electronics and software engineer
TechWorks Marine Ltd
4a, Park Lane
Dun Laoghaire, Co Dublin
Ireland
Tel: + 353 1 2365990
Fax: + 353 1 2365992
Web: www.techworks.ie
More information about the Qt-interest-old
mailing list