edbee-lib icon indicating copy to clipboard operation
edbee-lib copied to clipboard

Mutable field

Open gamecreature opened this issue 3 years ago • 4 comments

View components use mutable fields. Is this really required?

gamecreature avatar Apr 05 '21 13:04 gamecreature

Which ones do you mean specifically?

vadi2 avatar Apr 05 '21 13:04 vadi2

https://github.com/edbee/edbee-lib/blob/fce89540c784eceb58d9c4845dfe361b4ee8c15d/edbee-lib/edbee/views/components/textmargincomponent.h#L104-L105

gamecreature avatar Apr 05 '21 17:04 gamecreature

Ah. I'd stay away from such a mechanic in my own code.

vadi2 avatar Apr 05 '21 18:04 vadi2

Well it's used for caching the width in the withHint() const call ... (Which interface is defined by QWidget so it cannot be changed)

https://github.com/edbee/edbee-lib/blob/fce89540c784eceb58d9c4845dfe361b4ee8c15d/edbee-lib/edbee/views/components/textmargincomponent.cpp#L170

Guess it isn't a big issue since width_ is a private member.

gamecreature avatar Apr 06 '21 17:04 gamecreature