Hi All,
Is it possible to to have a custom QCanvasItem which can act as a widget as well?
For e.g. it can generate signals like 'clicked'.
~ A newbie
Hi All,
Is it possible to to have a custom QCanvasItem which can act as a widget as well?
For e.g. it can generate signals like 'clicked'.
~ A newbie
With a little work you can make QCanvasItem emit clicked() signal. First you have to make QCanvasView detect mouse clicks. The rest is easy.
Thanks Jacek.
As I could understand from your response, I am capturing mouse clicks on the QCanvasItem. This I am using to generate a new QCanvas/view which shows details (some more diagrams) for the object represented by QCanvasItem.
Is this a right appoach?
No, QCanvasItem can't capture mouse clicks --- only QCanvasView can do that. You just have to forward the information about mouse click from the canvas view to the canvas or canvas item.
In order to allow canvas items to emit signals you have to turn them into QObjects. If you have a lot of such items, it might not be the best approach. So instead you can consider emitting the signal from the canvas or canvas view.
sanjay (11th July 2008)
Bookmarks