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

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -