[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyKDE] Strange QColor behavior when passing rgb in constructor.
From:       Phil Thompson <phil () riverbankcomputing ! co ! uk>
Date:       2005-03-10 17:57:30
Message-ID: 200503101757.30439.phil () riverbankcomputing ! co ! uk
[Download RAW message or body]

On Wednesday 09 March 2005 12:16 pm, Truls A. Tangstad wrote:
> I've been testing and debugging to find a problem in our code where
> plots just weren't drawn (or rather drawn in white on white
> background), which I finally tracked down to be the way I used QColor.
>
> I assumed that passing a combined rgb-value as an int to QColor()
> would create the right color according to [1], but I kept getting
> white, no matter what rgb value I set. What was even stranger was that
> the  QColor-methods red(), green() and blue() returned the correct
> value for the created QColor-instance.
>
> I found that the problem was the default value for the pixel-parameter
> (documented in [1] to be pixel=0xffffffff).  When setting the value to
> -1 or 0xffffffff explicitly, everything worked fine. When omitting it,
> the color displayed as white (might be specific to my system).
>
> Also, creating an empty QColor, then setting rgb with setRgb() works
> fine.
>
> I created a small example (attached) showing the problem, creating two
> QMainWindows that should be painted red, but for me displays as one
> white and one red. A C++ port of the code did not have the bug.
>
> My software versions are as follows (running debian unstable):
> python2.3-qt3       3.13-4
> libqt3c102-mt       3.3.3-8
> libqt3c102          3.3.3-8
>
> And yes.. I know this is really a minor issue, as I can easily work
> around it, but I hope that fixing the problem will keep others from
> spending as much time as I did to try to figure out why their code
> misbehaves.
>
> [1] - http://doc.trolltech.com/3.3/qcolor.html#QColor-4

They are both red for me.

Phil

_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic