[Qt-interest] Disabling buttons without gray color

Matthias Rauter matthias.rauter at iteg.at
Sun Oct 30 21:06:26 CET 2011


If the icon is the only problem i would use QIcon::addFile(...) and set
the same icon for QIcon::Disabled as for QIcon::Normal. The rest of the
button will still appear disabled. Maybe a good compromise.

Matti

On Sun, 2011-10-30 at 20:17 +0100, Andre Somers wrote:
> Op 30-10-2011 19:48, Nicholas Shatokhin schreef:
> > I'm changing icons on buttons. So, when I disable button (I need that user
> > can't click it) icon become grayscale. I need that enabled buttons and
> > disabled looks similar. I need that disabled button looks like as enabled
> > but was unclickable.
> I have to agree with Gopalakrishna: it is not a good idea to make the 
> button appear as if it is enabled, while it is not. It is confusing for 
> the user, and will be frustrating in use. There are very good reasons 
> for the visual difference. Let the style (which is ideally the platform 
> style) determine how enabled and disabled controls appear.
> 
> Having said that: an alternative approach for the event filter solution 
> is to use your own proxy style. You can easily manipulate the style 
> option state flags to be always enabled. I think that solution is easier 
> than using event filters.
> 
> André
> 
> >
> > Sun, 30 Oct 2011 21:45:38 +0300 було написано Gopalakrishna Bhat
> > <gopalakbhat at gmail.com>:
> >
> >> Hi,
> >>
> >> It is always good to distinguish a disabled button from the one that is
> >> not
> >> because the user keep pressing the button and he will not know what
> >> happened to his actions.
> >>
> >> If you really do it as per your question way then you can install event
> >> filters QObject::installEventFilter and filter out the input events.
> >>
> >> On Mon, Oct 31, 2011 at 12:06 AM, Nicholas Shatokhin
> >> <n.shatokhin at gmail.com>wrote:
> >>
> >>> When I use method setDisable(true) of QPushButton or QTableView, field
> >>> become gray (icons on buttons lose their colors). But I don't need it. I
> >>> need disable button with full color icons. How can I do this?
> >>>
> >>> Best regards,
> >>> Nick.
> >>>
> >>> --
> >>> За використання революційного клієнта електронної пошти Opera:
> >>> http://www.opera.com/mail/
> >>> _______________________________________________
> >>> Qt-interest mailing list
> >>> Qt-interest at qt.nokia.com
> >>> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
> >>>
> >>
> >>
> >
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest





More information about the Qt-interest-old mailing list