Thanx, I have got I workingI understand everything now, except one thing: what does the next sentence do:
Qt Code:
To copy to clipboard, switch view to plain text mode
Thanx again to all of you
Thanx, I have got I workingI understand everything now, except one thing: what does the next sentence do:
Qt Code:
To copy to clipboard, switch view to plain text mode
Thanx again to all of you
This sentence calls the default implementation of this method.
Really useful, you don't have to handle all the possible events : just reimplement the one you are interested in, and let the default code handle the others ;-)
Everything works very fine but now I have another (new) problem:
When clicked on a rectangle, the main program should be able to know where there has been clicked. Is it possible to send a signal to the Scene from within eg: Item's mouseEvent???
Well, items are not QObject, so you can't use signals / slots, unless you made a subclass which inherit QObject
You can always have access to the scene pointer with scene() (only if you stored your item in the scene).
QGraphicsMouseEvent has useful methods to obtain position : pos() -> item coordinates, scenePos() -> scene coordinates.
If an item ignores an event, it will propagate to the scene and can be handled there. I don't know if it is exactly what you want... Maybe it'll be easier to call some method of the scene in item's mouse event handler instead?
Bookmarks