Giter Site home page Giter Site logo

qhexview's Introduction

Hello World!

  • I'm a C++ Developer, hobbyist Reverse Engineer, Retrogamer and Linux user. I use Arch, btw™
  • I love to study everything close to hardware and doing software analysis (File Formats, Firmware, Binary Blobs, CPU instruction sets, etc).
  • Everything I do is shared here on GitHub.

Twitter Follow Reddit User Karma


Top Languages

Since 2017 I'm spending most of my free time working on REDasm, a cross platform disassembler.

Learn more about REDasm... REDasm is under heavy development, check the "master" branch activity if you are interested.
You can also follow REDasm on Twitter or join the group on Telegram (please be aware that crack requests are not allowed).
Some interesting repositories:
  • QHexView: A Qt5 hexadecimal widget.
  • WebPirate: WebKit based browser for SailfishOS.
  • SailorGram: A Telegram Client for SailfishOS.
  • Check also my other repos, you might find something interesting!




You can also support my work!


Donate using Liberapay

qhexview's People

Contributors

aerosoul94 avatar alexpux avatar audetto avatar clouds56 avatar cydrith avatar dax89 avatar dev-0x7c6 avatar dnewmarch avatar hasselmm avatar nepridumalnik avatar siveya avatar skarsnik avatar sykhro avatar triplewhy avatar zalewa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qhexview's Issues

QHexDocument m_baseaddress not used

Defined, initialized in constructor, get/set method, but not used at all in the code
If you need to show a memory range not starting at zero, it doesn't work.
Strange because of #2

Size of text rectangles not calculated correctly

image
As you can see from image the width of the texts are not correct.

I just try to set the document from a file.
QHexView *pcntwgt = dynamic_cast<QHexView >(centralWidget());
QHexDocument
document = QHexDocument::fromFile(fileName);
pcntwgt->setDocument(document);

Hex display width and comments

I was thinking about the width of the hex view, which is currently hardcoded to 16 in QHexCursor.h.

I was thinking how hard it would be to change it to something (semi) dynamic.
With the huge screen existing today, 16 bytes wide is very small.

Questions I had are:

  • where should it be stored?
  • QHexMetadata would need some adjustments because of

QHash<int, QHexLineMetadata> m_metadata;

In my code I have already written something that takes a "start and end" and converts it to multiple calls to metadata, so I was thinking that QHexMetadata could do the same.
Store in absolute values and convert to lines each time the width changes?

Or alternatively that the width can only be set once so there lines never change meaning?

What do you think?

Add dataChanged signal

Whenever I make modifications to binary data inside hex view I need it to emit a signal notifying that this data has been changed. A signal like this inside QHexView class would be ideal:

void dataChanged (QByteArray);

Currently the closest equivalent is documentChanged() signal of QHexDocument, but it is a bit cumbersome to use. It is triggered “spuriously” (for this particular case) by changes in metadata as well, like parts of widget being highlighted.

QHexView cannot build

I tried to use QHexView, including qhexview. pri, but found that it could not be compiled at all. Could you please provide a simple test to pass the demo?

5.0 branch and Qt5 cmake compatibility

Hi,

I am trying to build the 5.0 branch with Qt5 and the line

find_package(Qt6 COMPONENTS Widgets)

fails in cmake with

CMake Warning at source/frontends/qt/QHexView/CMakeLists.txt:5 (find_package):
[cmake]   By not providing "FindQt6.cmake" in CMAKE_MODULE_PATH this project has
[cmake]   asked CMake to find a package configuration file provided by "Qt6", but
[cmake]   CMake did not find one.
[cmake] 
[cmake]   Could not find a package configuration file provided by "Qt6" with any of
[cmake]   the following names:
[cmake] 
[cmake]     Qt6Config.cmake
[cmake]     qt6-config.cmake

But if I remove all the lines

find_package(Qt6 COMPONENTS Widgets)
if(NOT Qt6_FOUND)
find_package(Qt5 COMPONENTS Widgets REQUIRED)
endif()

then everything works correctly as it is my application to find Qt5. I think this is the case since the source files are in the INTERFACE section, so they are complied as part of my lib, not this lib (???)

It is the case that since this is not the "main" cmake file, it should leave it to something else to find the right Qt things?
Imagine I have both Qt5 and Qt6 and I want to use Qt5, this library will instead find Qt6 first?

QHexView 5.0 Development

QHexView 5.0 is now under development! The widget is almost rewritten from scratch in order to keep its codebase as simple as possible.
I'm interested to listen all feedbacks here in order to create the best release as possible (if anyone is interested, of course!).

The current widget's appearance is this one:
QHexView

Changes:

  • QHexView doesn't use hardcoded colors anymore, but it relies on QPalette
  • It's possible to customize (almost entirely) the widget with the new QHexOptions class
  • It's possible to create columns with groups 1, 2, 4, 8, etc bytes
  • Replaced the blinking cursor with a fixed one
  • Configurable scroll speed (through QHexOptions)

Known Bugs/Missing Features:

  • Mouse input can be improved
  • Selection highlighting can be improved
  • Horizontal scroll is not implemented

Wants:

  • Qt 5.6 support (someone asked for it)
  • Keep C++11 as minimum target
  • Windows support (I work in a Linux environment, but I can test it on WIndows too)
  • Restore highlighting support
  • Restore comments/notes support
  • More?

Branch Link: https://github.com/Dax89/QHexView/tree/5.0

Sample code

//The second argument is a QHexOption
QHexDocument* doc = QHexDocument::fromFile<QMemoryBuffer>("/home/davide/Programmazione/Cavia.exe", { }, this);
doc->setGroupLength(2); // Default is 1, see options here: https://github.com/Dax89/QHexView/blob/5.0/document/qhexoptions.h
ui->hexView->setDocument(doc);

@audetto @T-640 @neomissing @aerosoul94

If you are not interested, feel free to ignore this notification/email!

Qt6 compatibility (5.0 branch)

Hi,

Seems that the 5.0 branch is not compatible with Qt6. I would suggest to keep the legacy version (master) compatible with Qt5 and start the 5.0 branch with a full Qt6 compatiblity.

What do you think?

(for the moment, I removed the StringRefs but there are still multiple warnings regarding QVariant deprecated types).

Non-blinking cursor

Sometimes cursor blinking may be distracting, let alone two cursors from hex and ASCII areas doing that, could you add something like QHexView::setCursorBlinking (bool blink) to change the way it behaves?

Render artefacts on top right of Hex Table

Screenshot from 2021-01-10 14-08-50

I have just updated after a long time and realised there are some artefacts on the top right of the Hex panel.
That area is sometimes white sometimes with hex values.

I am still trying to figure out if there is anything specific that triggers it.

Unsymmetric page-up vs page-down

These 2 lines

https://github.com/Dax89/QHexView/blob/master/qhexview.cpp#L471
https://github.com/Dax89/QHexView/blob/master/qhexview.cpp#L486

do not feel right.
PgDn seems to move the position by half the number of visible rows and PgUp by 3 times.

I think the issue is with "this->firstVisibleLine()" vs "cur->currentLine()",
If you use the latter it works properly.

And if you think about it, there is no symmetry between ArrowUp/Down vs PageUp/Down.
The only difference should be the amount, not the reference point: 1 in the former and this->visibleLines() in the latter.

Fractional QFont width on a Pi

On a Pi 400 with default software I get a Monospaced QFont which has an integer point size, but a fractional pixel size = 9.59375.

This means that all operations where the width of one cell is multiplied by N, accumulate an error and after 16 or 32 (* 3) characters, when I select a char the rounding is such that it selects something 2 or 3 characters before.

The solution is possible and would imply using QFontMetricsF and qreal, plus some rounding. Makes code a bit more complicated, but...

Do you have any opinion?

Incorrect cursor selection rendering in ASCII area

When the last byte at the end of a line of the hex area is selected, the corresponding character in ASCII area is not. Take a look at this screenshot, the last zero in ASCII area is not highlighted, but is supposed to be:

Selection issue 1

The culprit is QHexRenderer::applySelection. 1 is subtracted in two places, resulting in this behaviour.

void QHexRenderer::applySelection(QTextCursor &textcursor, quint64 line, int factor) const
{
QHexCursor* cursor = m_document->cursor();
if(!cursor->isLineSelected(line)) return;
const QHexPosition& startsel = cursor->selectionStart();
const QHexPosition& endsel = cursor->selectionEnd();
if(startsel.line == endsel.line)
{
textcursor.setPosition(startsel.column * factor);
textcursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, ((endsel.column - startsel.column + 1) * factor) - 1);
}
else
{
if(line == startsel.line) textcursor.setPosition(startsel.column * factor);
else textcursor.setPosition(0);
if(line == endsel.line) textcursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, ((endsel.column + 1) * factor) - 1);
else textcursor.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor);
}
QPalette palette = qApp->palette();
QTextCharFormat charformat;
charformat.setBackground(palette.color(QPalette::Highlight));
charformat.setForeground(palette.color(QPalette::HighlightedText));
textcursor.setCharFormat(charformat);
}

I experimented by removing these “-1” parts and it fixed the issue, but introduced a new one. Now in hex area a redundant piece is selected (notice how selection is extended past the last number 30 compared to the previous screenshot):

Selection issue 2

Fixed-width layout for QHexEdit?

Hi there,

I've been fiddling with this widget for a few hours now, and I'm finding it exceptionally difficult to get the layout to behave the way I'd like it to.

A widget like this should really be fixed-width, but it's not, so I'm trying to make it so. However, because the width is set programmatically, and inside QHexEdit there's another QHexEditPrivate so all the size()/sizeHint() commands report the size of the window and not the minimum size their layout, so I'm pretty stumped.

I'm trying to create a viewer that has a fixed width (the width of the text) and a variable height that I can drop into another application. Is there an easy way I can achieve this?

Thanks in advance,

clearHighlight() does not work anymore

I recently updated my git repo, and clearHighlight() (formerly resetRangeColor()) no longer seems to do what I expect it to.

I basically do

clearHighlight();
highlightBackground(...);

continuously. clearHighlight() seems to do nothing, and after a while, everything is highlighted. The foreground version works the same way.

Horizontal scroll bar issues

I found these 2 issues when using the horizontal scrollbar

  1. the scrollbar moves the content, but does not paint the area which was not originally already visible

  2. if I resize the window when the h scrollbar is not at the leftmost point, the hex area is repainted as if the h scrollbar was on the leftmost point. So, by moving the h scrollbar more to the left, I can display areas on the left of the address, which do not really exist.

QHexview displays the extension

At present, Qhexview displays a number by default at 8bit. Is it possible to support 16bit display a number and 32bit display a number? May I ask which interface can be modified to achieve this,
16bit
32bit

Configurable mouse wheel scroll speed

I've noticed that for smaller files, the scroll speed is much slower than most other hex editors. Scrolling with the mouse scrolls only 1 row at a time. Other hex editors seem to use a constant scroll speed such as 3 or 5 rows. I feel it would be useful to have a faster scroll speed to be able to quickly scroll through a file while inspecting it.

Renderer does not work well with widget’s width

Hello!

If Widget’s width is larger than renderer’s painting area it simply paints white after the ASCII column. This does not look good. Renderer should paint over the entire widget’s area. I see two possible solutions:

  1. Stretch and automatically increase font as widget grows larger;

  2. Set fixed width on widget, give control over how it resizes to renderer instead. Widget’s size could then be set programmatically by some external event, say font change, for example. Something like this could be called each time widget needs to resize: hex_view->setMaximumWidth (m_renderer->documentWidth())

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.