Skip to content
A versatile Hexadecimal widget for Qt5
Branch: master
Clone or download
Latest commit 4524ca3 May 4, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
document C++11 standardization May 4, 2019
screenshots QHexEdit -> QHexView, new implementation Dec 21, 2018
CMakeLists.txt QHexEdit -> QHexView, new implementation Dec 21, 2018
LICENSE Updated License Text Jan 27, 2014
QHexView.pri Fix for build Feb 26, 2019
README.md Update README.md Jan 28, 2019
qhexview.cpp C++11 standardization May 4, 2019
qhexview.h C++11 standardization May 4, 2019

README.md

QHexView

QHexView is a hexadecimal widget for Qt5


Features

  • Customizable data backend (see more below).
  • Document/View based.
  • Unlimited Undo/Redo.
  • Fully Customizable.
  • Fast rendering.
  • Easy to Use.

Buffer Backends

These are the available buffer backends:

  • QMemoryBuffer: A simple, flat memory array.
  • QMemoryRefBuffer: QHexView just display the referenced data, editing is disabled.

It's also possible to create new data backends from scratch.

Usage

The data is managed by QHexView through QHexDocument class.
You can load a generic QIODevice using the method fromDevice() of QHexDocument class with various buffer backends.
Helper methods are provided in order to load a QFile a In-Memory buffer in QHexView:

// Load data from In-Memory Buffer...
QHexDocument* document = QHexDocument::fromMemory<QMemoryBuffer>(bytearray);
// ...from a generic I/O device...
QHexDocument* document = QHexDocument::fromDevice<QMemoryBuffer>(iodevice);
/* ...or from File */
QHexDocument* document = QHexDocument::fromFile<QMemoryBuffer>("data.bin");

QHexView* hexview = new QHexView();
hexview->setDocument(document);                  // Associate QHexEditData with this QHexEdit

// Document editing
QByteArray data = document->read(24, 78);        // Read 78 bytes starting to offset 24
document->insert(4, "Hello QHexEdit");           // Insert a string to offset 4 
document->remove(6, 10);                         // Delete bytes from offset 6 to offset 10 
document->replace(30, "New Data");               // Replace bytes from offset 30 with the string "New Data"

// Metatadata management
QHexMetadata* hexmetadata = document->metadata();

hexmetadata->background(6, 0, 10, Qt::Red);      // Highlight background to line 6, from 0 to 10 
hexmetadata->foreground(8, 0, 15, Qt::darkBLue); // Highlight foreground to line 8, from 0 to 15
hexmetadata->comment(16, "I'm a comment!");      // Add a comment to line 16
hexmetadata->clear();                            // Reset styling

License

QHexEdit is released under MIT license

You can’t perform that action at this time.