c++ - Can I get all instances of some class in Qt? -


i have implemented qabstractitemmodel , qsortfilterproxymodel source model. have 1 itemmodel instance , several filtermodel instances. in each filtermodel have variable value of calculated based on filtered data itemmodel. when itemmodel recreated (all items removed , new ones inserted back) value of variable should set default (or recalculated after filtering done).

the problem don't have list of pointers filtermodel instances iterate them. sure can create such static list in constructor. moc did instead of me , saved such list inside of qmetaobject of class?

your filter proxy implementation broken. proxies informed of each , every change model - that's why models qobjects , emit change signals! there's nothing preventing changing "some variable" appropriate, when source model indicates has changed.

you need think of "some variable" depending on data (and structure!) source model. every time source model indicates changes dependent data or structure, proxy must recompute value - or @ least set flag value might recomputed lazily when needed.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -