[Qt-interest] How to forbid user to change the status of QCheckBox manually?
Brad Hards
bradh at frogmouth.net
Mon Jan 18 05:58:41 CET 2010
On Monday 18 January 2010 13:09:57 donglongchao wrote:
> I want to use some QCheckBoxs to show some status of my app.So I do not
> want the user to change it's status(chosen or not),but only my app itself
> can change it according to some value. When I set the property "checkable"
> to be FALSE,I even can not change the status by my app.When I set it to be
> TRUE,the user can change it by hand too. So I want to know if there is
> some way to meet my requirement ,that is only the app itself can change
> the status of QCheckBox.Any suggestion will be appreciated. TIA.
A couple of ideas:
0. Don't use a QCheckBox. Its conceptually broken - the UI is saying "you can
check this" but you're not meaning that.
1. An event filter
2. A sequence of setCheckable( true); setCheckState( Qt::Checked);
setCheckable( false); might do it.
HTH.
Brad
More information about the Qt-interest-old
mailing list