Results 1 to 9 of 9

Thread: Progress Bar with double values

  1. #1
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Progress Bar with double values

    Hi,

    Is there any kind of Progress Bar that accepts "double" or "float" values ?

    Thanks,
    Òscar Llarch i Galán

  2. #2
    Join Date
    Aug 2006
    Location
    istanbul, turkey
    Posts
    42
    Thanks
    2
    Thanked 4 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Post Re: Progress Bar with double values

    Actually there isn't any. But of course you could inherit current QProgressBar to take double values. But you need to simulate changing double values to integers at the background. I mean assume that you want to setProgress to 13,12 so you could do this by using 13,12 as 1312 then apply it internally to setProgress(int) function. This sound wierd but it works.

  3. #3
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Progress Bar with double values

    Quote Originally Posted by ^NyAw^ View Post
    Hi,

    Is there any kind of Progress Bar that accepts "double" or "float" values ?

    Thanks,
    Yes .. subclass QProgressDialog or QButtonGroup and insert a new function Myvalue( Qreal x) && paint into label settext(xx)

    Or build your own Dialog... on designer...

  4. #4
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Progress Bar with double values

    Hi,

    Ok, thanks for your replies. Will try it.
    Òscar Llarch i Galán

  5. #5
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Progress Bar with double values

    Is there any kind of Progress Bar that accepts "double" or "float" values ?
    This makes no sense if you think about it, since floating point has no boundries, which means you can't know when to move the progress bar to the next value.
    I am sure if you will explain your task to us, we can show you how to do it with the normal progress bar.
    The most likely slution is just to mutiply the the float untill it becomes integer, simialr to what hayati suggested.

  6. #6
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Progress Bar with double values

    Hi,

    This makes no sense if you think about it
    Why not? I want to use the QProgressBar as a percent indicator. I have an integer counting "good" values and another counting "bad" values. I want to know which % are the good values respect the total values.

    So, I want to use the QProgressBar to represent it in a graphical way.
    Òscar Llarch i Galán

  7. #7
    Join Date
    Aug 2006
    Location
    istanbul, turkey
    Posts
    42
    Thanks
    2
    Thanked 4 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Exclamation Re: Progress Bar with double values

    yes ofcourse you may have,
    but as you said you want to use percentage.
    it doesn't make any change between %33,33 and %33 actually, but if it's requirement of course you should.
    in your case percentage could be boundary (upper and lower limits of numbers is certain).
    so you simply multiply the numbers with 100 then when you can display what you want to display either %33,33 or %33.
    but in this case you need to inherit.

  8. #8
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Progress Bar with double values

    Hi,

    Ok, thanks for your reply.

    I think that I will hide the text of progress bar and insert a QLabel that will display the value with floating point.

    Thanks,
    Last edited by ^NyAw^; 23rd March 2007 at 16:31.
    Òscar Llarch i Galán

  9. #9
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Progress Bar with double values

    Why not?
    Because there is no "next number" from 0.2 to 0.3. (for example)
    Unless you can say what it is.

    I want to use the QProgressBar as a percent indicator. I have an integer counting "good" values and another counting "bad" values. I want to know which % are the good values respect the total values.
    Then all you need is to decide on the percent resolution, and mutiply acourdigly.
    Then you have ints, and you can use the progress bar normaly.

Similar Threads

  1. RGB values greater than 8bit & QColor?
    By smacchia in forum Newbie
    Replies: 11
    Last Post: 21st March 2007, 15:40
  2. How To Incorporate Progress Bar In Program
    By deekayt in forum Qt Programming
    Replies: 8
    Last Post: 20th December 2006, 15:40
  3. MYSQL insert
    By allensr in forum Newbie
    Replies: 4
    Last Post: 14th August 2006, 17:55
  4. Progress Bar to be shown!!!
    By Kapil in forum Qt Programming
    Replies: 7
    Last Post: 23rd May 2006, 10:36
  5. Push button double click
    By curtisw in forum Qt Programming
    Replies: 3
    Last Post: 15th February 2006, 17:40

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.