Bug #3815
closedWTableView Item CheckBox TriState does not work
0%
Description
Hi,
I'm currently implementing a custom WAbstractItemModel which is used by a WTableView object. The model supports Item checkboxes with TriState flag set to true. However the Wt::PartiallyChecked state is not used at all. It toggles only between Wt::Unchecked and Wt::Checked!?
It seems to me that the checkbox of the WItemDelegate does not provide the Wt::PartiallyChecked state to the model using setData(CheckStateRole)?
Any idea whats going wrong here?
Attached is a simply test application.
Regards,
Stefan
Files
Updated by Koen Deforche almost 10 years ago
Hey,
A tristate checkbox will indeed toggle only between checked and unchecked. The partially checked state can only be set through the API. Asfaik this is consistent with what other APIs do, and seems useful in several occasions, but thus not for your use? What behavior are you looking for?
Koen
Updated by Koen Deforche almost 10 years ago
- Status changed from New to Feedback
- Assignee set to Koen Deforche
Updated by Alan Finley almost 10 years ago
Koen Deforche wrote:
Asfaik this is consistent with what other APIs do, and seems useful in several occasions, but thus not for your use?
In Qt you can override that behaviour via virtual method QAbstractButton::nextCheckState
Updated by Stefan Ruppert almost 10 years ago
Hi Koen,
Koen Deforche wrote:
A tristate checkbox will indeed toggle only between checked and unchecked. The partially checked state can only be set through the API. Asfaik this is consistent with what other APIs do, and seems useful in several occasions, but thus not for your use? What behavior are you looking for?
>
I have some configuration which can be marked as unused (unchecked), disabled (partially checked) or used (checked). Thus a TriState checkbox perfectly fits here. But the user should be able to select the states. A WAbstractButton::nextCheckState() function would be perfect with the following code:
Wt::CheckState WAbstractButton::nextCheckState()
{
switch(currentState)
{
case Wt::Unchecked:
return Wt::PartiallyChecked:
case Wt::PartiallayChecked:
return Wt::Checked:
case Wt::Checked:
return Wt::Unchecked:
}
}
Maybe add a new NextCheckStateRole which can implement this nextCheckState() functionalitiy?
Updated by Koen Deforche almost 10 years ago
Unfortunately, the reason for this seems to be that the native browser implementation of tri-state checkboxes (which is available and used in some browsers, namely the 'indeterminate' state), does not offer this ability. We would of course like to switch to the native support as it becomes available in more browsers.
But I believe the feature could still be implemented using some setting such as 'setCyclePartiallyChecked(true)' which would implement the correct cycling behavior in JavaScript. If you agree to that we can assign it as a feature request for 3.3.4 (or perhaps 3.3.5 because we can't keep on dragging our feet for a release!)
Updated by Stefan Ruppert almost 10 years ago
Hi Koen,
yes that is fine for me. Currently I have implemented this with checkboxes in 2 columns. But a working tristate checkbox is preferred from my side.
Regarding a 3.3.4 release: we are planning a new release of our software in april, is there a chance to have a stable 3.3.4 release? We currently use 3.3.2 and I want to jump to a official 3.3.4!
Updated by Koen Deforche almost 10 years ago
- Status changed from Feedback to New
Updated by Koen Deforche over 9 years ago
- Status changed from New to InProgress
- Assignee changed from Koen Deforche to Benoit Daccache
- Target version set to 3.3.5
Updated by Benoit Daccache over 9 years ago
- Status changed from InProgress to Resolved
Added method WCheckBox::setPartialStateSelectable(bool) which will allow the user to select indeterminate state. This is false by default;
Updated by Koen Deforche over 9 years ago
- Status changed from Resolved to Closed