Repository navigation
Add uppercase hex display option - #3682
AkhandDubey wants to merge 1 commit into
Conversation
| uppercaseHex = QSettings().value("hex/uppercase", false).toBool(); | ||
| actionUppercaseHex = new QAction(tr("Uppercase hex"), this); | ||
| actionUppercaseHex->setCheckable(true); | ||
| actionUppercaseHex->setChecked(uppercaseHex); | ||
| connect(actionUppercaseHex, &QAction::toggled, this, [this](bool enabled) { | ||
| uppercaseHex = enabled; | ||
| QSettings().setValue("hex/uppercase", enabled); | ||
| updateViewport(); | ||
| }); | ||
|
|
There was a problem hiding this comment.
Reading the value only in the constructor means that other hex widgets (if a user has multiple opened) will go out of sync once this option is changed by the user. Other hex widgets will never know about this change. While opening new hex widgets after changing this option 'will' show the correct value.
Since it's a matter of preference meaning a person is unlikely to have one hexwidget show uppercase bytes while other shows lowercase so I would vote for moving it into Preferences->Interface. As it's only a single option for now it should be fine there, later if hexdump requires more options it can be moved under Edit->Disassembly where "Graph" exists.
| if (showExAddr) { | ||
| addrString.prepend(hexPrefix); | ||
| } | ||
| if (uppercaseHex) { | ||
| addrString = addrString.toUpper(); | ||
| } |
There was a problem hiding this comment.
should be converted to uppercase before prepending "0x" to keep it consistent with other views
it should be: 0xAB12
not: 0XAB12
same goes for the bytes area (in renderItem())
Your checklist for this pull request
Detailed description
This pull request adds an Uppercase Hex option to the HexWidget context menu.
Changes made
AI disclosure: ChatGPT (GPT-6) was used to assist with generating and modifying parts of the code.
Test plan
Build and run Cutter, then:
Testing status: Build and runtime tests have not yet been performed locally.
Closing issues
Closes #3669