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. app using "excessive" CPU
Forum Updated to NodeBB v4.3 + New Features

app using "excessive" CPU

Scheduled Pinned Locked Moved Solved General and Desktop
42 Posts 10 Posters 7.2k Views 4 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.
  • mzimmersM mzimmers

    @Bonnie you nailed it. I moved the load to the c'tor, and everything works much better now.

    A couple of notes:

    1. I turned on my event filter, and it's no longer spewing zillions of events, so I guess my keyPress idea would have worked (if Windows wasn't so lame).
    2. I tried making my painter a member variable and initializing it in the c'tor, but that didn't work. Any idea why?

    Thanks to everyone who looked at this.

    B Offline
    B Offline
    Bonnie
    wrote on last edited by
    #41

    @mzimmers
    You can only create and use a painter of a widget in its paintEvent.

    1 Reply Last reply
    5
    • mzimmersM mzimmers

      @Bonnie you nailed it. I moved the load to the c'tor, and everything works much better now.

      A couple of notes:

      1. I turned on my event filter, and it's no longer spewing zillions of events, so I guess my keyPress idea would have worked (if Windows wasn't so lame).
      2. I tried making my painter a member variable and initializing it in the c'tor, but that didn't work. Any idea why?

      Thanks to everyone who looked at this.

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

      @mzimmers To add to @Bonnie it is actually explained in the documentation https://doc.qt.io/qt-5/qpainter.html :
      "Warning: When the paintdevice is a widget, QPainter can only be used inside a paintEvent() function or in a function called by paintEvent()."

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

      1 Reply Last reply
      3

      • Login

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