Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QGraphicsPathItem display error after migration (Qt-4.8.6 -> Qt-5.5.1)
Forum Update on Monday, May 27th 2025

QGraphicsPathItem display error after migration (Qt-4.8.6 -> Qt-5.5.1)

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 611 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    e822104
    wrote on last edited by e822104
    #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 :

    1. After I add my item, my windows display :
      0_1486385767000_QtForumImage4.png
    2. When I select my item :
      0_1486385895756_QtForumImage5.png
    3. When I deplace it :
      0_1486385962440_QtForumImage6.png

    1.With Qt5.5.1 :

    1. After I add my item, my windows display :
      0_1486386004651_QtForumImage1.png
    2. When I select my item :
      0_1486386020710_QtForumImage2.png
    3. When I deplace it :
      0_1486386026352_QtForumImage3.png
    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

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Image upload is broken. We cannot see them. Please use external site and paste links here :)

      E 1 Reply Last reply
      0
      • mrjjM mrjj

        Hi
        Image upload is broken. We cannot see them. Please use external site and paste links here :)

        E Offline
        E Offline
        e822104
        wrote on last edited by
        #3

        @mrjj
        Problem solved. I will loader my picture After and explain how I solved my problem.
        Thanks you

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved