[Qt-interest] Disabled window palette

Darryl Campbell dutter at gmail.com
Fri Oct 29 03:20:07 CEST 2010


I answered my own question, You need to use the AlternateBase.

Thanks for looking :)

-Darryl

On Thu, Oct 28, 2010 at 8:35 PM, Darryl Campbell <dutter at gmail.com> wrote:

> I should have done this in the first place but here is the slot I use to
> make the window look disabled....it's quite simple. I have verified that the
> two colors (active and inactive) are in fact different but when I set the
> palette the color doesn't change on linux...on windows it works fine.
>
> void MyWindow::markDisabled()
> {
>
>     QPalette oldPalette = txtArea->palette();
>     QColor baseColor = oldPalette.color(QPalette::Inactive,
> QPalette::Base);
>     QColor textColor = oldPalette.color(QPalette::Inactive,
> QPalette::Text);
>
>     QPalette newPalette;
>     newPalette.setColor(QPalette::Active, QPalette::Base,baseColor);
>     newPalette.setColor(QPalette::Active, QPalette::Text,textColor);
>     txtArea->setPalette(newPalette);
>
> }
>
>
> -Darryl
>
>
>
> On Thu, Oct 28, 2010 at 10:35 AM, Darryl Campbell <dutter at gmail.com>wrote:
>
>> Hello,
>>     I have an application which is cross paltorm (windows and ubuntu). I
>> am using a  QMDIArea and the client has requested that disabled subwindows
>> remain accessible for things like reviewing the history of things they typed
>> in the window and cut/paste etc. To accomplish this I windows I simply set
>> everything but their textarea to be disabled and then to make the textarea
>> "look" disabled I set the palette group to use the inactive colors. This
>> works fine on windows, the mdisubwindow looks disabled, but on unbuntu the
>> palette change has no effect. Is there another way to do this? That doesn't
>> use the palette?
>>
>> -Darryl
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101028/82869d95/attachment.html 


More information about the Qt-interest-old mailing list