[Qt-interest] Drawing A Disabled QLabel Without Graying It

Nathan Carter nathancarter5 at gmail.com
Tue Apr 14 04:07:15 CEST 2009


On Apr 13, 2009, at 9:54 PM, Karol Krizka wrote:

> On Mon, Apr 13, 2009 at 6:43 PM, Nathan Carter <nathancarter5 at gmail.com 
> > wrote:
>>
>> Can you consider using a QStackedWidget?  Just put the widget on one
>> pane, and put that pane on top when you want the widget "enabled";  
>> put
>> the image on the other pane, and put that pane on top when you want
>> the widget "disabled".
>>
> The problem is not switching between the image and the custom widget,
> although your suggestion does seem to be clear than what I am doing
> right now. Even if I were to replace the parent widget (which wrappers
> the custom widget) with a QStackedWidget, to disable the custom widget
> I would have to disable the QStackedWidget, since I want the entire
> process to be transparent.

No, you don't have to disable the stacked widget.  When you move to  
another sheet in the stacked widget, your button is inaccessible.  You  
don't have to disable it if no one can see it or click on it.

Unless you're saying that you want the image to be there all the time,  
whether it's enabled or disabled...is that what you mean?  If so, then  
I guess my suggestion won't work (unless you put on the other sheet  
something that looks like a button but isn't).  But I just reread your  
initial message and I don't think this is what you were saying.

(If I'm wrong, and that is what you want to do, you might reconsider  
it.  It is quite unexpected UI behavior to show someone a button that  
invites them to click, but then won't let them do it.  Unless it's a  
very good reason, a typical UI is the best.  It stays transparent/ 
obvious so the user can get to what they want to accomplish without  
thinking about how.)

Nathan




More information about the Qt-interest-old mailing list