[PyQt] Question about Sort/Filter behaviour
Hans-Peter Jansen
hpj at urpla.net
Tue Nov 30 23:47:56 GMT 2010
On Tuesday 30 November 2010, 04:02:48 James Polk wrote:
> Hi All,
> Before asking this question, I did side-by-side testing and
> confirmation of the sorting results in both the "Basic" and "Custom"
> examples... Even compared the C++ vs Python generated code, same
> results... I also checked this on Pete's newly posted custom
> example..
>
> The observation is this...it appears that typing text into the
> pattern line generates a behaviour that is *always* regExp
> behaviour...
>
> For example,...supposed I set
> filterColumn to "Date"
> filterSyntax to "Wildcard"
> and finally, in filterPattern, I type 1/* (with no quotes)
>
> I would expect to get a view returned with with all the January
> dates...but I get nothing...
> If I remove the slash (/), leaving 1*, I get everything, or better
> said I get the behaviour of regExp,....if you switch filterSyntax to
> "regular expression", you'll get the same results...
This is unfortunate: it appears, that Qt has issues with matching
date/datetime columns.
It relies on the fact, that the date column matching is always based on
the iso format of date/time: e.g. something like 2007-01-03T14:26:00.
> Another example...set
> filterColumn to "Date"
> Type "12:" (no quote) into filterPattern.
> Now keep switching filterSyntax from "regExp", "Wildcard", and
> "Fixed String", and every time you get the same output...
This behavior is consistent, and what I would expect.
> There are other examples I can provide too....
> There appears to be something odd going on here...at the very least,
> it doesn't appear to conform to Unix-like standard conventions of
> regularExpression and/or Wildcard interpretation...
> Is it just that the "Date" data is set up odd?
>
> I tried a similar example on the "Sender" column, but get same
> kind of results...
>
> Lastly,...I set
> filterColumn to "Subject"
> filterPattern to "Sports" (again , no quotes)
> sequencing thru filterSyntax,....going from regExp, to Wildcard,
> to Fixed String, I always get the same output...
> At least on "Fixed String", I would expect to get 1 returned record,
> but it's behaving like it's a regExp,...ignoring the "RE: etc" and
> the "AW: etc" non-matching cases...
No, that's fine. Even the fixed case does searching in contrast to
matching. If you need the matching behavior, you may emulate it with
RegExp and ^Sports.
> Does this strike anyone else as odd? or am I just going crazy?..lol
This leaves the date matching issue. Might be worth an enhancement
request to add a localeAwareMatch flag to the QAbstractProxyModel
class. Any takers?
Pete
More information about the PyQt
mailing list