Skip to content

Add uppercase hex display option - #3682

Open
AkhandDubey wants to merge 1 commit into
rizinorg:devfrom
AkhandDubey:feature/uppercase-hex-display
Open

AkhandDubey wants to merge 1 commit into
rizinorg:devfrom
AkhandDubey:feature/uppercase-hex-display

Conversation

@AkhandDubey

Copy link
Copy Markdown

Your checklist for this pull request

  • I've read the guidelines for contributing to this repository.
  • I made sure to follow the project's coding style.
  • I've updated the documentation with the relevant information (if needed).
  • I've used AI tools to generate partially these code changes and I'm sure the changes are not copyrighted by somebody else.

Detailed description

This pull request adds an Uppercase Hex option to the HexWidget context menu.

Changes made

  • Added an "Uppercase hex" toggle to the HexWidget context menu.
  • The selected preference is saved using QSettings and persists across application restarts.
  • Hexadecimal addresses are displayed in uppercase when the option is enabled.
  • Hexadecimal item values are also displayed in uppercase.
  • The default setting is disabled, preserving the existing lowercase behavior.

AI disclosure: ChatGPT (GPT-6) was used to assist with generating and modifying parts of the code.

Test plan

Build and run Cutter, then:

  1. Open the Hexdump/HexWidget view.
  2. Right-click to open the context menu.
  3. Enable the "Uppercase hex" option.
  4. Verify that hexadecimal addresses are displayed using uppercase letters.
  5. Change the item format to hexadecimal and verify that values are displayed in uppercase.
  6. Disable the option and verify that lowercase formatting returns.
  7. Restart Cutter and verify that the selected preference is preserved.

Testing status: Build and runtime tests have not yet been performed locally.

Closing issues

Closes #3669

@AkhandDubey AkhandDubey reopened this Nov 22, 2026
Comment thread src/widgets/HexWidget.cpp
Comment on lines +136 to +145
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();
});

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/widgets/HexWidget.cpp
Comment on lines 1799 to +1804
if (showExAddr) {
addrString.prepend(hexPrefix);
}
if (uppercaseHex) {
addrString = addrString.toUpper();
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

Support for displaying hexadecimal numerals in uppercase

2 participants