+ Reply to Thread
Results 1 to 4 of 4

Thread: QProgressbar text format

  1. #1
    Join Date
    Apr 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QProgressbar text format

    Hi all, I want to set the format of QProgressBar to double. How to do this . Documentation says setFormat can be used to do this.

    But I don't know exactly how to do this. Any help will be greatly appreciated.

    I am a python guy, if someone can tell me in python, it will be more useful.

    Thanks,

    Jothy

  2. #2
    Join Date
    Jul 2008
    Posts
    221
    Thanks
    5
    Thanked 27 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProgressbar text format

    Hi, the setFormat() method only changes the way the progress is displayed. It does not change the class internally so it will still use int as datatype.

    Ginsengelf

  3. #3
    Join Date
    Apr 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProgressbar text format

    Then, how to change this?

    Thanks,

    Jothy

  4. #4
    Join Date
    Jul 2010
    Posts
    38
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProgressbar text format

    I think one solution can be take the value in the multiple of 10 or 100, for example:

    if you want to give value as 45.46 then set the range for QProgressBar to (0 to 10000) and then multiply value 45.46 with 100 and then give it to set value.

    Qt Code:
    1. pbar.setRange(0, 10000);
    2. pbar.setValue(4546);
    To copy to clipboard, switch view to plain text mode 

+ Reply to Thread

Similar Threads

  1. QCalendarWidget and text format
    By ouekah in forum Newbie
    Replies: 5
    Last Post: 8th October 2013, 11:19
  2. QPlainTextEdit text format question
    By vieraci in forum Qt Programming
    Replies: 0
    Last Post: 4th November 2009, 12:19
  3. QTextEdit current cursor text format
    By afail in forum Qt Programming
    Replies: 0
    Last Post: 13th April 2009, 14:24
  4. Handling mac text format files - support?
    By bnilsson in forum Qt Programming
    Replies: 0
    Last Post: 29th March 2008, 12:10
  5. Rich Text Format
    By Kapil in forum Newbie
    Replies: 1
    Last Post: 4th October 2006, 10:53

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