[Interest] QSortFilterProxyModel

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Tue Feb 19 17:55:40 CET 2019


Il 19/02/19 16:48, Christopher Probst ha scritto:
> Thank you Nils. My question may have have been incomplete. I am looking 
> to filter the model through a regular expression on data contained in 
> the header. I am not sure the method you suggested is the appropriate 
> one. But it will certainly help.
> 
> Something that would ideally look like void  setFilterKeyColumn(int 
> column), where I have a column number that represents the vertical header.

I'm not 100% sure I understood what you need, but here's an idea.

<HACK ALERT>

Make your model return the header data you want to filter upon as some 
"hidden" role of come column. Then put a QSFPM on top, filtering on that 
column and that hidden role.

If you can't modify the source model, place a QIdentityProxyModel in the 
middle with a custom data() override.

HTH,
-- 
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4007 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190219/fdf5edb1/attachment.bin>


More information about the Interest mailing list