QGraphicsScene hover*Events to all item under mouse cursor.
-
@SGaist Please excuse me if I misunderstand something. But as I understand it, you want me to make children as the parent of the DiagramItem? That is:
From this:
DiagramItem
|_SizeGripItem
|_"future item"To this:
SizeGripItem
|_DiagramItem"future item"
|_DiagramItemBut is that really to have more than one parent? Sorry for not showing the hierarchy initially.
-
I meant to stack them differently, so future on top of size grip on top of main item.
Are you grouping them ?
-
@SGaist No, I'm not grouping them, just parenting. Here is the code of how item is created. ArrowManager is "future item". Just temporary name.
DiagramItem *DiagramScene::createDiagramItem(int diagramType) { DiagramItem* diagramItem = new DiagramItem(DiagramItem::DiagramType(diagramType)); SizeGripItem* sizeGripItem = new SizeGripItem(new PathResizer, diagramItem); new ArrowManager(diagramItem); connect(sizeGripItem, &SizeGripItem::resizeBeenMade, diagramItem, &DiagramItem::updateTextItemPosition); connect(diagramItem, &DiagramItem::itemPositionChanged, this, &DiagramScene::drawLevelLineWithItemOnSameAxis); connect(diagramItem, &DiagramItem::itemReleased, this, &DiagramScene::deleteAllLevelLines); return diagramItem; }
-
Out of curiosity, why are you making three different items for what seems to be only one in the end ?
-
-
Can you share a minimal compilable example ?
That will allow to better understand your implementation and what is happening.
-
@SGaist Of course, but it will take some time. How is it convenient for you to provide the code? Should I leave the pieces of code here in this way:
DiagramItem.h
// DiagramItem definition code // ...
DiagramItem.cpp
// DiagramItem implementation code // ...
etc
// ...
or in some other way?
Thank you so much for your support!
-
Either that or if you have a GitLab/GitHub/BitBucket/Other repo.
-
@SGaist
Out of curiosity, why are you making three different items for what seems to be only one in the end ?I realized that my mistake was that I was creating separate elements when only one is created in the end. Having redone this, everything worked as it should. Thank you!