-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Qt/CodeViewWidget: Make columns resizable by the user and set sensible defaults. #8665
Conversation
51e178b
to
00587e7
Compare
00587e7
to
81d62ae
Compare
Hmm, the logic looked fine to me but in practice this appears to set column widths to values that are slightly too low. For instance the last two characters of addresses are not shown and replaced with ellipses instead... |
That's curious. Here's how it looks to me (without having touched the columns), which I'd call wide enough: https://user-images.githubusercontent.com/4522237/76804509-baa40980-67dc-11ea-8261-45002c84fd33.png Could it be that we're measuring with a different font than what we end up drawing with, somehow? |
Hmm, probably not, since |
Alright, I tried a few different fonts and I can definitely reproduce this here on Windows too. Some fonts and font point sizes work fine, others end up too narrow. Maybe there's some column margins that need to be considered too? Definitely odd that it works fine with some fonts then though. (Also I can't figure out what the default font was so I can't go back to it now, it was not the one selected by default. Oh well.) |
Well, in that case, do we want to add a small number to the value given by QFontMetrics? I think it's better for columns to be slightly too wide than too narrow, since the latter makes values unreadable without manual resizing. It does sound a bit hacky, but I can't think of a better way to fix the issue. |
81d62ae
to
e8dfb8f
Compare
Yeah I can't figure out anything better either. Small extra it is. |
These were fixed-size and auto-calculated every time you scrolled up or down, making them jump wildly when you're in the vicinity of long symbol names or
rlwinm
instructions. With this they don't, and you can resize them at will.A minor issue is that Qt is pretty awful at eliding strings in table cells, which means if you have a branch target to a long symbol, even if there's enough space for 90% of the symbol name, it will cut off the entire symbol. This kinda sucks but I can't find a way to work around it without completely reimplementing the text painting logic, so I guess I'll live with it.