[Qt-interest] How to forbid user to change the status of QCheckBox manually?
Thiago Macieira
thiago at kde.org
Mon Jan 18 08:58:14 CET 2010
Em Segunda-feira 18. Janeiro 2010, às 05.58.41, Brad Hards escreveu:
> 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.
Try also disabling the widget.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Senior Product Manager - Nokia, Qt Development Frameworks
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100118/681cf702/attachment.bin
More information about the Qt-interest-old
mailing list