[Qt-interest] Invalid background rendering

K. Frank kfrank29.c at gmail.com
Mon Apr 12 17:05:01 CEST 2010


Hello -

Okay, I tried out your new test.  (Same build process and versions as before.)

When I comment out the line

   proxy->setCacheMode(QGraphicsItem::DeviceCoordinateCache);

I suppose that the program works "properly."  (Again, I don't know enough to
know what to expect.)

Specifically, upon startup, that background of the widget is black, and the
background of the two buttons is a darkish green.  When I mouse over the
buttons the text ("Button 1" and "Button 2") changes from white to yellow
(and reverts back to white when the mouse moves off the button).

It seems that no matter what I do (mouse-over, click, resize, etc.), the colors
stay the same (except for the text changing to yellow), that is, the background
of the widget remains black, and the background of the buttons remains green.

In the unmodified version, in which the setCacheMode line is active, I see
behavior similar to that of your first example:

Upon startup the widget background is black, and the button background
is darkish green.  When I move the mouse over a button, that button's text
turns yellow, and that button's background  becomes a slightly lighter green.
When I move the mouse back off the button, the text reverts to white, and the
button's background becomes lighter still.  There is a border of a few pixels
on the sides of the buttons, on the bottom of the lower button, and between
the buttons, but not on the top of the upper button, that remains dark green,
even as the background of the buttons is becoming lighter.

As I repeatedly mouse over the buttons, the backgrounds becoming progressively
lighter -- I see perhaps rather more than half a dozen shades of
green.  It seems
that the background lightens as the mouse enters the button, and then lightens
again as the mouse leaves.

Various things cause the button background to revert back to its original dark
green -- sometimes switching focus to another window and back, sometimes
resizing the window, and sometimes just mousing over the button repeatedly.
I haven't found anything that consistently resets the background color
-- it seems
like passage of time might be part of it.

I have know idea what is going on (or what is supposed to be happening), but
this is the behavior I get on my system.


Best.


K. Frank


On Mon, Apr 12, 2010 at 4:31 AM, Tr3wory <tr3w at freemail.hu> wrote:
> Thank you for the help.
>
> As it turned out I made a mistake: I omitted the
> Qt::WA_TranslucentBackground attribute.
> With this attribute, the example is working properly.
>
> But my original program did not, because it's a little different, it
> use QGraphicsView and item caching.
>
> I created an another example. Can you test it?
>
> And please check it with, and without the
> "proxy->setCacheMode(QGraphicsItem::DeviceCoordinateCache);" line.
>
> Thanks for the help.
>
> tr3w
>
> On Mon, Apr 12, 2010 at 12:29 AM, K. Frank <kfrank29.c at gmail.com> wrote:
>> Hello -
>>
>> I believe I see the behavior you are describing.  (I don't know enough about
>> how the transparent stuff is supposed to work to have an opinion as to
>> whether it's a bug.)
>>
>> Specifically, after I start the program I see two white text fields on a darkish
>> green background ("Button 1" and "Button 2").  If I change focus away from
>> the WidgetBug app, the green background becomes slightly lighter and more
>> pastel.  If I hover the mouse over either of the buttons, the color of just that
>> button becomes still a little lighter, and the text turns yellow.  Moving the
>> mouse off of that button causes that button's green color to lighten still a
>> little more, and the text turns back to white.  (I can repeat this process with
>> the other button.)  Resizing the app to a larger size causes the background,
>> including the area around the buttons, to revert back to the original dark green
>> color it had when the app first started.
>> ...
>> I unzipped your WidgetBug.zip file, ran qmake, and then mingw32-make.  I built
>> this with 32-bit mingw on 64-bit windows 7.  My versions are reported
>> as follows:
>>
>>   C:\...>qmake --version
>>   QMake version 2.01a
>>   Using Qt version 4.6.1 in C:/...
>>
>>   C:\...>mingw32-make --version
>>   GNU Make 3.81
>>   ...
>>   This program built for i386-pc-mingw32
>>
>>   C:\...>g++ --version
>>   g++ (TDM-2 mingw32) 4.4.1
>> ...
>>
>> K. Frank
>>
>> On Sun, Apr 11, 2010 at 1:42 PM, Tr3wory <tr3w at freemail.hu> wrote:
>>> Hi!
>>>
>>> I have a widget with transparent background.
>>> ...




More information about the Qt-interest-old mailing list