Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mutable field #124

Open
gamecreature opened this issue Apr 5, 2021 · 4 comments
Open

Mutable field #124

gamecreature opened this issue Apr 5, 2021 · 4 comments

Comments

@gamecreature
Copy link
Member

View components use mutable fields. Is this really required?

@vadi2
Copy link
Contributor

vadi2 commented Apr 5, 2021

Which ones do you mean specifically?

@gamecreature
Copy link
Member Author

mutable int width_;
mutable int lastLineCount_;

@vadi2
Copy link
Contributor

vadi2 commented Apr 5, 2021

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

@gamecreature
Copy link
Member Author

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

int TextMarginComponent::widthHint() const

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants