PDA

View Full Version : Progress Bar with double values



^NyAw^
22nd March 2007, 19:59
Hi,

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

Thanks,

hayati
22nd March 2007, 20:52
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.

patrik08
22nd March 2007, 20:56
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...

^NyAw^
22nd March 2007, 21:21
Hi,

Ok, thanks for your replies. Will try it.:)

high_flyer
23rd March 2007, 10:54
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.

^NyAw^
23rd March 2007, 16:04
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.

hayati
23rd March 2007, 16:20
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.

^NyAw^
23rd March 2007, 16:25
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,

high_flyer
23rd March 2007, 16:37
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.