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. Multiple updates on widget

Multiple updates on widget

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 629 Views 2 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.
  • R Offline
    R Offline
    ritesh
    wrote on last edited by
    #1

    Hello All
    I am using a QT Application in which there is a QScrollview Widget which gets regular notifications to update itself.
    Will QT amalgamate these items and make a single call to paintevent?
    Order of events may be:
    update()
    eventA
    eventB
    update()
    eventC

    Will the paintevent function will be called 2 times or only once?

    Regards
    Ritesh

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      It depends on number of factors. One of them is if Qt gets a chance to get back to event loop in between and if there are any other events pending. Qt has a mechanism of event compression but it applies in limited number of scenarios.
      In general you should not assume one way or the other.
      If you feel you're updating too often you can try to control it. One way is not to call update directly but some intermediate function that would check how much time passed from last update (e.g. with QElapsedTimer) and call update if needed. A similar effect you can achieve by blocking widget's ability to update for periods of time by using setUpdatesEnabled(false) on it.

      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