Use text metrics to set a proper space for labels.
And remove unused plotter width.
Details
- Reviewers
jgrulich ngraham - Group Reviewers
VDG Plasma - Commits
- R116:986341a3fae8: [Applet]Fix traffic monitor labels width
Change default font styles and family.
Change small font size.
Space available must follow the font.
Diff Detail
- Repository
- R116 Plasma Network Management Applet
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
applet/contents/ui/TrafficMonitor.qml | ||
---|---|---|
107 ↗ | (On Diff #76797) | what is this number about? |
Is it?
applet/contents/ui/TrafficMonitor.qml | ||
---|---|---|
107 ↗ | (On Diff #76797) | Biggest number it can display? |
If you need to measure the width of text, then you're doing it the right way.
However this problem wouldn't be happening in the first place if this UI used Layouts, which handle this kind of case more elegantly so you don't need to manually set margins and measure the width of items.
So I say feel free to land this now since it's a correct bugfix and the current code is obviously wrong. And I think we should move towards porting to Layouts in another patch. I can do that if you're sick of plasma-nm. :)
I don't plan to make more patches, for now. But if the problem would not exist with Layouts, I would prefer to do it than make quick bugfixes.
But can't see how the Layouts would help with that. Everything can be done without Layouts too AFAIK, just more messy.
I want to keep the plotter dimensions constant. It would not be nice to change width constantly.
Yeah, if you want to keep the plotter dimensions constant, then there's no way around measuring the width of the labels.
Regarding not opening any new patches, I hope you didn't have a bad experience in KDE that's left a bad taste in your mouth. If anything's gone wrong, don't hesitate to let me know and I'll do what I can.