Introduction to Qt/QML (Part 53) - QSortFilterProxyModel

preview_player
Показать описание
In this video, we will talk about QSortFilterProxyModel, a proxy model class that sorts and filters a given source model. Well, its name says it all, doesn't it? QSortFilterProxyModel is a concrete class and can either be used as-is, or subclassed in order to fine tune some of its behaviors.

About the host:
This video is presented by Jesper Pedersen, who started with Qt back when Qt was widgets only and the version was 1.44, which gives him 21 years of experience with Qt. Since 2000 he has taught almost 100 Qt classes, ranging from Qt Widgets to QML. Heck, Jesper even taught a few classes on QTopia Core — Trolltech's initial attempt at creating a phone stack. Today Jesper holds a fancy business title, but that doesn't prevent him from coding both in his job and in his spare time.

About KDAB:

KDAB experts regularly take time out to deliver KDAB’s world class training, in-house or at open enrollment courses around the world. We are the market leaders for training in Qt, OpenGL, and C++.

Рекомендации по теме
Комментарии
Автор

Thing is, this seems really easy when you watch the video, but when you go and try to implement it yourself... Suddenly its "Wait a minute... Where do I get this parameter from?" This video helped me quite a lot to figuring those hurdles out. Especially the examples.

I was having trouble figuring out how the `filterAcceptsRow` method should know on what role to filter on without it being hardcoded like in the example at 6:35 . Luckly earlier in the video `filterRole() ` and `setFilterRole(int role)` are mentioned. All you need to do to set the filter role dynamically is to set the filter role at some point before the filtering is done. I did it after the class declartion. And instead of in the example at 6:35 you can use `filterRole()`. It even has a notifier signal on change. Very helpful indeed. Thank you again for the video!

TheWolverine
welcome to shbcf.ru