[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Need help for little math problem
From: |
Michael Goffioul |
Subject: |
Re: Need help for little math problem |
Date: |
Thu, 22 Sep 2011 17:04:42 +0100 |
On Thu, Sep 22, 2011 at 4:35 PM, John W. Eaton <address@hidden> wrote:
> What about using 0 for minimun, std::numeric_limits<int>::max() for
> maximum, and the compute singleStep as
>
> round (uicontrol::sliderstep / (uicontrol::max - uicontrol:min) * maximum)
>
> ? Wouldn't that give you the best resolution? I suppose you could
> set pageStep to be something like min (singleStep, 5 to 10% of range) so
> that a slider has a maximum of 10 to 20 "pages" and a page is never
> less than a "singleStep".
Actually, uicontrol::sliderstep is a 2-value vector containing the minorstep
and the majorstep value (corresponds to singleStep and pageStep in the
Qt world). But otherwise, your suggestion looks appealing, I'll give it a try.
Anyway, after re-reading uicontrol properties documentation about sliderstep,
I realized that sliderstep values are actually percentage of the total range
(don't know how I missed that...). This may provide some simplifications of
the problem.
Michael.