QQConditionRange: Range query for QQuery
Even though QQConditionRange can be used in the context of building any QQuery, its main motivation is its use with the QDataGrid, to allow for range filters.
So let's take the simple datagrid from the example of
"Adding Filters to Your QDataGrid", and make
the filter on Id column allow ranges. We would like to allow the user to use ranges such as
7:10 in
the filter box. To accomplish this, all we need to do is to replace
QQ:Equal by
QQConditionRange
when setting the
Filter property of the column. Try it out on the data grid below. Note that the filter
still accepts simple values and treats them as before - it finds the exact matches. We can also do one-sided
ranges, such as
7: (which means everything greater or equal than 7) or
:10 (which means
everything less or equal than 10). When setting up the
QQConditionRange filter you can control if the
boundaries of the filter are inclusive or exclusive. You can also control if the values should be trimmed
after they are split.