Results 1 to 3 of 3

Thread: QProgressBar with custom text

  1. #1
    Join Date
    Feb 2011
    Posts
    16
    Qt products
    Qt5
    Platforms
    Windows

    Default QProgressBar with custom text

    Hi,

    how can I use custom text on a QProgressBar?

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,969
    Thanks
    277
    Thanked 808 Times in 797 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: QProgressBar with custom text

    Looks to me like you will have to derive your own widget from QProgressBar and override paintEvent() so it will draw your text. Wouldn't it be easier just to put a QLabel next to the standard progress bar and connect to the progress bar's valueChanged() signal so you can change the text on the label?

  3. #3
    Join Date
    May 2007
    Posts
    131
    Thanks
    17
    Thanked 4 Times in 2 Posts

    Default Re: QProgressBar with custom text

    To write a custom text into a progress bar you can use the format string. If you write in some text instead of %p% for percentage the text will be displayed.

    see format() or setFormat().

Similar Threads

  1. Custom Delegate and Text Wrap
    By enlightened_j in forum Newbie
    Replies: 2
    Last Post: 17th September 2010, 06:21
  2. QProgressbar text format
    By jothy in forum Qt Programming
    Replies: 3
    Last Post: 4th August 2010, 18:02
  3. QTreeView Custom column with an icon, and 2 lines of text
    By mromanuk in forum Qt Programming
    Replies: 2
    Last Post: 5th July 2010, 18:37
  4. how to show text and custom editor in QTableWidgetItem
    By brook2lost in forum Qt Programming
    Replies: 4
    Last Post: 7th June 2010, 08:15
  5. Custom ListWidget(QCheckBox + Icon + Text)
    By nrabara in forum Newbie
    Replies: 6
    Last Post: 13th May 2010, 06:35

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.