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. Force QGraphicsItem to update immediately / wait for update event

Force QGraphicsItem to update immediately / wait for update event

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 796 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.
  • NiagarerN Offline
    NiagarerN Offline
    Niagarer
    wrote on last edited by
    #1

    Hi,
    in my application, the geometries of some contents of a QGraphicsItem only get set correctly when the item updates and the paint event is being called for the first time. I need to force that because I need the correct geometry at some point when initializing the item. However, QGraphicsitem::update() only causes a scheduling of the required update and the paint event gets triggered too late.
    How can I force an immediate update or some kind of final geometry computation in a QGraphicsItem? Is there a nice way to do that without using while loops to wait or something like that?

    1 Reply Last reply
    0
    • O Offline
      O Offline
      ollarch
      wrote on last edited by
      #2

      Hi,

      Maybe calling "repaint()" on the Graphics View is what you need.

      NiagarerN 1 Reply Last reply
      0
      • O ollarch

        Hi,

        Maybe calling "repaint()" on the Graphics View is what you need.

        NiagarerN Offline
        NiagarerN Offline
        Niagarer
        wrote on last edited by
        #3

        @ollarch nope, unfortunately not, same result as using QGraphicsItem::update directly

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Niagarer said in Force QGraphicsItem to update immediately / wait for update event:

          How can I force an immediate update or some kind of final geometry computation in a QGraphicsItem?

          You can't since even Qt can't. The update request must be handled through the window manager.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          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