WingHexExplorer2/3rdparty/QHexView
寂静的羽夏 1be1f7322f fix: 修复和增强编辑器相关问题; 2025-05-09 12:18:17 +08:00
..
QHexEdit2 fix: 修复代码填充无法填充注册函数;完善代码协议声明; 2025-02-03 18:03:22 +08:00
document fix: 修复和增强编辑器相关问题; 2025-05-09 12:18:17 +08:00
CMakeLists.txt fix: 重构查找对话框;搜索字节支持'?'通配符; 2025-02-24 21:15:15 +08:00
LICENSE fix: 修复编译错误和更新 2024-09-04 10:16:13 +08:00
QHexView.pri fix: 修复编译错误和更新 2024-09-04 10:16:13 +08:00
README.md fix: 修复编译错误和更新 2024-09-04 10:16:13 +08:00
qhexview.cpp fix: 修复和增强编辑器相关问题; 2025-05-09 12:18:17 +08:00
qhexview.h fix: 重构查找对话框;搜索字节支持'?'通配符; 2025-02-24 21:15:15 +08:00

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