Skip to content

ENH: Expanded Expression Support

Value Item Definitions now represent their expression information as a Component Item Definition. This provides more flexibility when specifying which types of attributes can be assigned to Value Items as expressions. You can now how multiple acceptable conditions which include regular expressions as well as property constraints on both the attribute and its definitions. In addition, you can now include rejection conditions.

The older mechanism of specifying the expression constraint as a string representing the attribute definition type is still supported. Both the JSON and XML file formats have been updated to support this new functionality. Here is an example of how to specify expression information in XML using this more flexible approach:

.. code-block:: xml

    <Double Name="testDoubleItem" Label="testDoubleItem" NumberOfRequiredValues="1">
      <CategoryExpression InheritanceMode="And" />
      <ExpressionInfomation Name="expression" NumberOfRequiredValues="1">
        <Accepts>
          <Resource Name="smtk::attribute::Resource" Filter="attribute[type='doubleItemTestExpression']" />
        </Accepts>
        <Rejects />
      </ExpressionInfomation>
    </Double>

Also includes the ability to extract information from an attribute query string. `smtk::attribute::Resource::extractGrammarInfo`` provides the ability to examine an attribute query string and extract information from it. Currently this information includes:

  • Type Information - that can either refer to an attribute definition type name or a regular expression that will be applied to type names.
  • Indication if the query contains property constraints.

Also included the ability to suppress expression creation in qtInputItem widgets. qtInputsItem now supports the DisableExpressionCreation attribute option in its ItemView. When set to true, this will remove the ability to create an expression via the expression combo box.

Edited by Robert M. O'Bara

Merge request reports

Loading