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. Qt Scene. How to draw new items at center of scene?
Qt 6.11 is out! See what's new in the release blog

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 1.1k Views 1 Watching
  • 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.
  • A Offline
    A Offline
    almostz
    wrote on last edited by
    #1

    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?

    jsulmJ 1 Reply Last reply
    0
    • A almostz

      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?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

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

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A Offline
        A Offline
        almostz
        wrote on last edited by almostz
        #3

        @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

        1 Reply Last reply
        0

        • Login

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