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

Qt/CodeViewWidget: Make columns resizable by the user and set sensible defaults. #8665

Merged
merged 1 commit into from
Mar 19, 2020

Conversation

AdmiralCurtiss
Copy link
Contributor

@AdmiralCurtiss AdmiralCurtiss commented Mar 7, 2020

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.

@leoetlino
Copy link
Member

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...

@AdmiralCurtiss
Copy link
Contributor Author

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?

@leoetlino
Copy link
Member

Hmm, probably not, since fm uses the debug font, right? Maybe QFontMetrics doesn't work as well on Linux.

@AdmiralCurtiss
Copy link
Contributor Author

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.)

@leoetlino
Copy link
Member

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.

@AdmiralCurtiss
Copy link
Contributor Author

Yeah I can't figure out anything better either. Small extra it is.

@leoetlino leoetlino changed the title Qt/CodeViewWidget: Make columns resizable by the user and set sensible defaults. Qt/CodeViewWidget: Make columns resizable by the user and set sensible defaults. Mar 19, 2020
@leoetlino leoetlino merged commit 53c34d9 into dolphin-emu:master Mar 19, 2020
@AdmiralCurtiss AdmiralCurtiss deleted the debugger_columns branch March 19, 2020 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants