Depends on D19389.
QVariant() evaluates to false, and not all models implement this role to return true by default. Hence the check for an explicit false.
The alternative would be to patch all the models.
so model.enabled you want it to resolve to true? This will be hard to read to anyone who isn't you.
How about model.hasOwnProperty("enabled") && model.enabled? Or typeof model.enabled === "undefined" || model.enabled
range-for gives you values already, no need for values()
Just capture entry into the lambda
static_cast, also everywhere else
This means we now show all logout options and only disable them if not supported?
For the record (so someone doesn't copy this idea), model.hasOwnProperty() wouldn't work to catch unimplemented roles in a model.
I'll do another approach you might like better.
Personally I tend to prefer just readable, explicit code for simple cases.
Now the timing of my comment becomes awkward :/
you increment this on every refresh, only decrement once in the destructor
refresh is potentially called multiple times in the object's lifespan
refresh is called from the constructor so we may as well do it all there