[Qt-interest] How to forbid user to change the status of QCheckBox manually?
donglongchao
donglongchao at 163.com
Mon Jan 18 09:04:24 CET 2010
在2010-01-18 12:58:41,"Brad Hards" <bradh at frogmouth.net> 写道: >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.
You are right.Do you think QLabel is a better choice?I do not know if there is a better and more convince widget to show some status.
>1. An event filter
>2. A sequence of setCheckable( true); setCheckState( Qt::Checked); >setCheckable( false); might do it.
For these two methods ,I will try them later.
Thank you very much,Brad.
> >HTH.
> >Brad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100118/06c802f6/attachment.html
More information about the Qt-interest-old
mailing list