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

  • SEARCH
  • Home
  • 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 8984455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:06:38+00:00 2026-06-15T21:06:38+00:00

How can one obtain the following effect for text in a QProgressBar from Qt?

  • 0

How can one obtain the following effect for text in a QProgressBar from Qt? :

Progress bar text with different colors around the front of the progress bar

The ideea is that I must have a brighter color in the left part of the progress bar.

  • 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-06-15T21:06:39+00:00Added an answer on June 15, 2026 at 9:06 pm

    I would do the custom drawing as follows:

    1. Derive your own progress bar class from QLabel.

    2. Overwrite the paintEvent() function.

    3. In paintEvent(), start drawing with a QPainter:

      • draw the secondary background rectangle
      • draw the text in the secondary color with drawText()
      • draw the first background rectangle (overdrawing first part of text)
      • draw the text in the first color within a rectangle matching the first background rectangle: http://qt-project.org/doc/qt-4.8/qpainter.html#drawText-11

    You should end up with what you want to achieve. Due to Qt’s default double buffering you should observe no flicker.

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

Sidebar

Related Questions

I found out that in gnuplot one can obtain multiple curves / datasets from
How can one obtain the panel that is used within a TreeView ? I've
I have the following code from apache's svn. As you can see this is
There are two ways, that I can think of, to obtain similar results from
Can one call a method from another model in a model in CodeIgniter? I
When using class java.util.Random, how can one get the value obtained from calling the
I have the following code . In order to obtain readability of the html
I have a sql statement that brings back the following rows: I would like
I have a bash script that uses bash's read builtin to obtain a username
My question can be asked in two different aspects: one is from data structure

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.