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 5 on Mac Uses a Ton of CPU
Forum Updated to NodeBB v4.3 + New Features

Qt 5 on Mac Uses a Ton of CPU

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 941 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.
  • M Offline
    M Offline
    MichaelARice
    wrote on last edited by
    #1

    Environment:
    Mac 0S X 10.8.2
    Xcode 4.4.1 (although I do everything in QtCreator)
    i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

    So I built a small video display app on 4.8 and it works fine. When there's no video displaying, it uses about 0.3% of the CPU and during video display it uses about 7% CPU. However, when I build that same app using Qt 5.0, it uses about 80% of the CPU when the app is not doing anything and about 86% when displaying a video.

    The app displays video frames on a QLabel by calling setPixmap() on the QLabel. The problem appears to be that every call to setPixmap() triggers an update to the widget's backing store, which seems to trigger a paintEvent. So, it gets into an endless loop. If I don't call setPixmap() on the QLabel, it doesn't get into the loop... Of course, my video doesn't display either.

    Here's the stack trace:

    0 MainWindow::paintEvent mainwindow.cpp 84 0x1000050e0
    1 QWidget::event 0x100e35a0b
    2 QMainWindow::event 0x100f2636c
    3 QApplicationPrivate::notify_helper 0x100dfeebe
    4 QApplication::notify 0x100e002d0
    5 QCoreApplication::notifyInternal 0x10199d0ae
    6 QWidgetPrivate::drawWidget 0x100e3084f
    7 QWidgetBackingStore::sync 0x100e0a380
    8 QWidgetPrivate::syncBackingStore 0x100e285d7
    9 QWidget::event 0x100e3601b
    10 QMainWindow::event 0x100f2636c
    11 QApplicationPrivate::notify_helper 0x100dfeebe
    12 QApplication::notify 0x100e002d0
    13 QCoreApplicationPrivate::sendPostedEvents 0x10199dc84
    14 QWindowSystemInterface::sendWindowSystemEvents 0x1014086c1
    15 QCocoaEventDispatcherPrivate::processPostedEvents 0x102e20e25
    16 QCocoaEventDispatcherPrivate::postedEventsSourceCallback 0x102e2172b
    17 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION 0x7fff90ff6101
    18 __CFRunLoopDoSources0 0x7fff90ff5a25
    19 __CFRunLoopRun 0x7fff91018dc5
    20 CFRunLoopRunSpecific 0x7fff910186b2
    ... <More>

    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