(posting this to rg-devel because Silvan is also interested)

Vladimir Savic wrote:

On Thu, 07 Jul 2005 06:08:15 -0000, Guillaume Laurent <[EMAIL PROTECTED]> wrote:

On Thursday 07 July 2005 02:35, D. Michael McIntyre wrote:


!     h += 180 % 360;


That's not needed. From the QColor doc : "If you pass a too-big hue value, Qt forces it into range. Hue 360 or 720 is treated as 0; hue 540 is treated as
180".


I'm learning c++ for about week and a half. :) As newcomer I'm trying to understand what is writen here. Priority of operators says:
1) % returns 180
2) h becomes h+180 (which can easy exceed range 0-360)
(3) then QColor automaticaly does what Silvan wanted!?

Am I wrong?

Actually you're quite right, I completely missed the priority error (that's what you get for posting right after waking up). So indeed, what Silvan's code does is 'h += 180', because '180%360' evaluates to '180'. I guess that he intended to do
h += 180
h = h % 360
but this last line is already done internally by QColor.

--
Guillaume
http://telegraph-road.org



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Rosegarden-devel mailing list
[email protected] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Reply via email to