Unsolved QGraphicsPathItem display error after migration (Qt-4.8.6 -> Qt-5.5.1)
-
Hello,
I have an other problem after my migration.
When I move my item, I don't move the item group.1.With Qt4.8.6 :
- After I add my item, my windows display :
- When I select my item :
- When I deplace it :
1.With Qt5.5.1 :
- After I add my item, my windows display :
- When I select my item :
- When I deplace it :
ItemGroup::ItemGroup(QGraphicsItem* parent, QGraphicsScene* scene, const SimItem* item, QPointF position): #if (QT_VERSION >= QT_VERSION_5) QGraphicsItem(parent), #else QGraphicsItem(parent, scene), #endif _item(item) { QPainterPath p; p.addRoundedRect(position.x(), position.y(), 100, 30, 5, 5); setPath(p); setPen(QPen(_border)); setBrush(QPen(_font)); setFlags(QGraphicsItem::ItemIsMovable); setFlags(QGraphicsItem::ItemIsSelectable); _my_scene = scene; createOthersItems(); setPos(position); } ItemGroup::createOthersItems() { for (int index = 0; index < _items->childCount(); ++index) { Item* child = _items->getChild(index); addItem(child); } } ItemGroup::addItem(const SimItem* item) { if ((item == NULL) || (_my_scene == NULL)) { return NULL; } QFont font = _my_scene->font(); Port* port = new Port(this, _my_scene, item); _my_scene->addItem(port); port->setBlock(this); port->setName("port name"); font.setBold(true); _ports.push_back(port); QFontMetrics fm(font); QPainterPath p; p.addRoundedRect (...) setPath(p); setPos(...); } Port::Port(QGraphicsItem* parent, QGraphicsScene* scene, const SimItem* item): QGraphicsItem(parent), _item(item) { _label = new QGraphicTextItem(this); ... _my_scene = scene; }
I know that the origine of my problem is the inheritit of QGraphicsPathItem, but howa correct it ??
If someone can help me. I would be very grateful.
e822104
- After I add my item, my windows display :
-
Hi
Image upload is broken. We cannot see them. Please use external site and paste links here :) -
@mrjj
Problem solved. I will loader my picture After and explain how I solved my problem.
Thanks you