Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5937877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:36:16+00:00 2026-05-22T15:36:16+00:00

I have a class which displays waveform data of audiofiles in a QWidget (see

  • 0

I have a class which displays waveform data of audiofiles in a QWidget (see screenshot of the widget below, back then i still used a gradient, which caused poor performance).

The audio data is painted in the paintEvent directly on the widget using multiple calls to QPainter::drawLine (the minimum amount of calls to QWidget::drawLine is equivalent to the width of the widget => at least one line for each x coordinate).
While the approach works quite well on Windows (a paintEvent in fullscreen takes around ~4ms), the performance is 4-5 times worse when the program is run under MacOS.

The performance of the painting is important for fluid scrolling of the displayed data.

So my question is, does anyone know a faster alternative to QPainter.drawLine to paint lines (platform dependant solutions might be ok, as long as they can be used in a paintEvent), or is there a way to speed up scrolling, some kind of buffering etc ?

old screenshot of the widget (still used gradients, which caused poor performance)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T15:36:17+00:00Added an answer on May 22, 2026 at 3:36 pm

    The current version (4.7.x) of Qt uses Core Graphics backend for painting. It can be slow at times as you found out. On Windows, it uses a software renderer which has really good performances.

    My suggestion is to not paint on the passed painter directly in your paint event. Instead, create a QImage the same size as your widget paint area and paint on it. This will use the software renderer which is much faster. Then plot the QImage onto the painter when needed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a php page which displays class schedule data for each user from
I have a .NET PropertyGrid control which displays properties of some class. I want
I have a simple MFC program which displays the progressbar..I used the below code
I have created a class which builds a Crystal report and displays it in
I have a view which displays a model eg: public class MyModel() { public
I have a JPanel which displays an image. In a separate class, I'm reading
I have a simple program which displays a collection on a data grid. When
I have a following code which displays a 'delete' link: <%= link_to :class =>
I currently have a page defined which displays some data in rows. At the
I have the following situation I have one swt class which displays a simple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.