edbee / edbee-lib

QWidget based Text Editor Component for Qt. Multi-caret, Textmate grammar and highlighting support.
Other
75 stars 26 forks source link

Mutable field #124

Open gamecreature opened 3 years ago

gamecreature commented 3 years ago

View components use mutable fields. Is this really required?

vadi2 commented 3 years ago

Which ones do you mean specifically?

gamecreature commented 3 years ago

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

vadi2 commented 3 years ago

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

gamecreature commented 3 years ago

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.