China Naming Network - Ziwei Dou Shu - Is there any way in Qt to make the QPushButton object invalid but not grayed out?
Is there any way in Qt to make the QPushButton object invalid but not grayed out?
This can be achieved by adding a disabled file when setting the icon. The specific demonstration code is as follows:
QIcon icon;
icon . addfile(qstring literal(":/resources/log in . SVG "));
icon . addfile(qstring literal(":/resources/log in _ Disabled . SVG "),QSize(),QIcon::Disabled);
auto button = new q button(tr(" log in "));
Button-> SetIcon (icon);
Button-> set enabled(false);
The mode displayed at this time is the image of login_disabled.svg