On 2008-11-10 14:26:09 +0100, Trenton Schulz <[EMAIL PROTECTED]> said:

> 
> On Oct 30, 2008, at 23:24 , Jeremy Friesner wrote:
> 
>> Hi all,
>> 
>> I've been testing my codebase under OS/X Leopard (10.5.5, Intel) and
>> Qt4.5.0-tp1 to see if I can find any fresh bugs... my code works fine
>> when built against Qt4.4.2, FWIW.
>> 
>> One thing I've found is that if I use QWindowsStyle and set up a
>> custom palette, my window's colors don't show up correctly until I
>> resize the window.  I haven't been able to reproduce this problem
>> exactly outside of my program, but here is something I think is  related:
>> 
>> 1) Edit the file $QTDIR/examples/script/calculator/main.cpp, inserting
>> the following lines directly after the declaration of the QApplication
>> object on line 57:
>> 
>> {
>>    app.setStyle(new QWindowsStyle);
>>    QPalette p = QPlastiqueStyle().standardPalette();
>>    p.setColor(QPalette::Active, QPalette::Window, Qt::blue);
>>    app.setPalette(p);
>> }
>> 
>> 2) Compile and run the program (you'll need to add the necessary
>> #include lines too, of course)
>> 
>> 3) At this point, I would expect to see a Calculator GUI, with widgets
>> shown in the WindowsXP style, with a blue background.
>> 
>> However, if I run the program like this:
>> 
>>    open calculator.app
>> 
>> then I only see the window flash blue for a second, and then it
>> reverts to the default WindowsXP colors.  That is wrong, I think.
>> 
>> On the other hand, if I run the program like this:
>> 
>>    ./calculator.app/Contents/MacOS/calculator
>> 
>> then the window opens with the correct colors (blue background), but
>> reverts to the default WindowsXP colors as soon as it is clicked on.
>> This is also wrong.
>> 
>> It should start up blue, and stay blue.
> 
> This is because of "desktop settings aware." We constantly check what  
> the settings are and enforce them on specific widgets, if you do  
> something interesting with the palette and expect it to inherit, you  
> will see "flashes" like this.
> 
> You can try calling QApplication::setDesktopSettingsAware(false); at  
> the beginning of your application and see if that solves your problem.
> 
> It might work better to set the palette explicitly on the widgets you  
> wish to have this palette and not expect them to inherit from the  
> application.
> 
> The same applies for QApplication::setFont().
> 
> Hope this helps,

We actually have looked at changing the behavior of this recently to 
match more what people expect (i.e., setting a local font should have 
an effect locally). Hopefully this will do the trick for what you plan 
on doing.

-- Trenton

_______________________________________________
Qt4-preview-feedback mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt4-preview-feedback

Reply via email to