Skip to content
forked from Dax89/QHexView

A versatile Hexadecimal widget for Qt5

License

Notifications You must be signed in to change notification settings

oetken/QHexView

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A versatile Hexadecimal widget for Qt5

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 96.8%
  • CMake 1.6%
  • QMake 1.6%