[Qt-components] Proposed CheckBox API change
Alberto Mardegan
mardy at users.sourceforge.net
Tue Jan 29 06:41:25 CET 2013
Hi,
On 01/28/2013 09:31 PM, Mitch Curtis wrote:
> The components team in Oslo are currently discussing the addition of a third
> state to CheckBox: "partially checked". The purpose of this state can be seen
> in the Qt installer [1] and the Windows file permissions dialog [2][3], for
> example. This state generally indicates that there are multiple related
> checkboxes whose state affects whether or not it is checked.
+1
> We have proposed the name "checkedState" for the property, which is an enum
> property, as seen below. A boolean property will also need to be added to
> determine whether the third state is available. We propose that this is named
> "partiallyCheckedEnabled":
I'd vote for something like "allowPartialCheck" or any name which
doesn't contain a sequence of two past principles ("checked" -
"enabled") next to each other, as that results somehow confusing.
As to the API itself:
> /*!
> This property indicates the current checked state of the checkbox.
>
> When \l partiallyCheckedEnabled is \c false, this state will be equivalent
> to \l checked; that is, when this property is \c Qt.Checked, \l checked
> will be \c true, and when it is \c Qt.Unchecked, \l checked will be
> \c false.
>
> When \l partiallyCheckedEnabled is \c true, \c Qt.PartiallyChecked will
> be available, and \l checked will be the same value that it was when
> \c Qt.PartiallyChecked was set.
> */
> property enum checkedState
The last paragraph is confusing; does it mean that once
"partiallyCheckedEnabled" is set to true, the "checked" property will
stop working (i.e., its value will never change)?
While I'm usually a fan of enums, in this particular case I think it
might be simpler to introduce a new boolean, "partiallyChecked"; then:
1) "checked == false" means that the checkbox is clear
2) "checked == true" means that the checkbox is at least partially checked;
2a) "checked == true && partiallyChecked == false": fully checked
2b) "checked == true && partiallyChecked == true": partially checked
Ciao,
Alberto
More information about the Qt-components
mailing list