In SMTK 22.04, ValueItems were laid out horizontally if they were not extensible and were not discrete with children items, else they were laid out vertically. A bug in QtTableWidget which fails to sometimes calculate the proper cell height containing discrete ValueItems with active children items, forced a change in 22.05 that changed the layout to be horizontal. Unfortunately the change was hardwired instead of being something that the workflow designer could change.
In SMTK 22.06, this in being changed so that it can be controlled by an ItemView Configuration. However, we also would like to have some intelligent defaults in place to minimize the need for using ItemViews in common cases. This is the currently planned default logic:
if item is either extensible or isDiscrete and has children
set orientation to vertical
else
set orientation to horizontal
So by default, extensible items or items with children would be laid out vertically while fixed size items would be laid out horizontally. This would capture the original behavior of 22.04 but with the ability to change the orientation through the view configuration.
Further “Improvements”
We can extend this to cover another common use-case. Sometimes a discrete value item’s enumeration serves as the label for the item’s active child item as shown below:
In this case the string item is discrete whose values are Constant or Expression. The child item is either a double value for a constant or a string value for an expression. Here both child item’s labels have been set to " " to indicate the label is not needed.
We can modify the default logic to be the following:
if item isDecrete and number of children per value is <= 1 and if all children item labels == " "
set orientation to horizontal
else if item is either extensible or isDiscrete and has children
set orientation to vertical
else
set orientation to horizontal
Current Results
Here is the case of non-extensible Items and discrete items with no children items. The top image is the default which is horizontal and the bottom shows the effect of setting the layout direction to be vertical.
Here is the case of extensible items. Notice that the layout direction is ignored.
Finally, here is the case of a discrete item with children items. The top section shows the default behavior for a discrete item with more than one child item associated with a discrete value. The middle section shows the special case where each discrete value has at most 1 child item associated with it and all of the children items have their labels set to " ". The last section shows the effect of using the layout direction set to horizontal for a discrete item with 2 children associated with the discrete value.
What to name the configuration attribute?
The current name is Layout another possibility would be Orientation.