Important: Please read the Qt Code of Conduct -

Qt Scene. How to draw new items at center of scene?

  • Hi i have function that remove all items from scene but when i'm trying to add new item to scene (after removing all items by using my function) every new item draws slightly to the right of the center. So can you suggest any advice how to draw new items right at center of scene?

  • Lifetime Qt Champion

    @almostz You should at least show how you're drawing after deleting...

  • @jsulm im drawing with

    void listWindow::newNode(int x)
    scene->addRect(x, 0, 90, 30, QPen(Qt::black), QBrush(Qt::white));
    scene->addRect(x, 30, 90, 30, QPen(Qt::black), QBrush(QColor(220,220,220)));
    scene->addRect(x, 60, 90, 30, QPen(Qt::black), QBrush(QColor(18,215,255)));

    and deleting with scene->clear() i think

Log in to reply