simsys / qhexedit2 Goto Github PK
View Code? Open in Web Editor NEWBinary Editor for Qt
Binary Editor for Qt
It would be great to include the following get/set functions also in the definition of Q_PROPERTY, so they become designable in QT Designer when using the QHexEditor as a QT plugin:
/*! Switch the address area on or off.
\param addressArea true (show it), false (hide it).
*/
void setAddressArea(bool addressArea);
/*! Set the minimum width of the address area.
\param addressWidth Width in characters.
*/
void setAddressWidth(int addressWidth);
/*! Switch the ascii area on or off.
\param asciiArea true (show it), false (hide it).
*/
void setAsciiArea(bool asciiArea);
/*! Switch the highlighting feature on or of.
\param mode true (show it), false (hide it).
*/
void setHighlighting(bool mode);
Kind regards
Hauke
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
mac lepord
Please provide any additional information below.
What to do if i want to open 100MB file here ??
do i need to break the file in small size chunks?.
Original issue reported on code.google.com by [email protected]
on 21 Mar 2013 at 10:38
i found a some bug in qhexedit. this bug you can see also with your example app in your head commit.
howto reproduce:
this works not only on the last position and also with alt and ctrl keys.
i tried to find a bug, but til now without success.
http://qt-project.org/doc/qt-4.8/qfile.html#map
Original issue reported on code.google.com by [email protected]
on 13 Mar 2012 at 7:25
Adjust the viewport that the current cursor position is allways visible
The usual way to install a application under windows is to download an binary package, an installer, and execute it. If we have no binary installer available, the QHexEdit App is just not available for users.
What steps will reproduce the problem?
1. Call setReadOnly(true) on the widget
What is the expected output? What do you see instead?
I'd expect the cursor not to be shown, but it is :)
What version of the product are you using? On what operating system?
Latest
Please provide any additional information below.
I made the following change to fix this, in
QHexEditPrivate::paintEvent(QPaintEvent *event) :
// paint cursor
if (_blink && !_readOnly)
{
...
}
Thanks!
Original issue reported on code.google.com by [email protected]
on 5 Nov 2011 at 1:12
What steps will reproduce the problem?
1. Try selecting the last item.
Is anyone else having this issue?
Added patch which fixed it for me.
Also added a little extra. If you select HEX values, you will also see your
selection in the ASCII part.
Original issue reported on code.google.com by [email protected]
on 31 May 2013 at 3:50
Attachments:
Thanks for you great job. I am learning your code. And why do you use virtual void setFont(const QFont &font);
defined in qhexedit.h
? It is really weird for me, I understand that QWidget has a function with the same name, and QAbstractScrollArea derived from QWidget, so you just override it? But why virtual
?
It would be nice to be able to edit also the ascii #text in the right area, not only the plain hex values.
since pre C99 defined, not compilable under MSVC 2013.
See i.e. https://sourceware.org/bugzilla/show_bug.cgi?id=5461#c1
Use LLONG_MAX from <limits.h> / instead.
When changing the size of the address area the changes aren't shown in editor
widget after accepting the options.
The reason is a missing "adjust()" in function
"QHexEditPrivate::setAddressWidth()" in qhexedit_p.cpp. The whole function
should look like this:
==8<==
void QHexEditPrivate::setAddressWidth(int addressWidth)
{
_xData.setAddressWidth(addressWidth);
adjust();
setCursorPos(_cursorPosition);
}
==8<==
Thanks for this great Widget!!!
Original issue reported on code.google.com by [email protected]
on 5 Oct 2012 at 11:47
We should have at least translations for french and spannish users
1. Line 302 "QHexEdit" instead of "SDI"
2. Line 287 Insert Timout 2000
3. Line 283 Set MinimumWidth to 90
Original issue reported on code.google.com by [email protected]
on 30 Jan 2012 at 3:52
v0.7.3 was not compiling with gcc 3.4.2 on MINGW - yes I know it's a very old gcc version - but that's what I am on and the fix was simple - wrap 64-bit literals with Q_INT64_C()
Another issue I faced was that sometimes the Widget after creation would be set to readonly and I was unable to edit contents. My code never touches the readOnly property. Looking at the qhexedit.cpp, I see that _readOnly is never explicitly initialized - so I guess this could happen?
Here's a patch for both issues -
diff --git a/extra/qhexedit2/src/chunks.cpp b/extra/qhexedit2/src/chunks.cpp
--- a/extra/qhexedit2/src/chunks.cpp
+++ b/extra/qhexedit2/src/chunks.cpp
@@ -6,7 +6,7 @@
#define BUFFER_SIZE 0x10000
#define CHUNK_SIZE 0x1000
-#define READ_CHUNK_MASK 0xfffffffffffff000
+#define READ_CHUNK_MASK Q_INT64_C(0xfffffffffffff000)
// ***************************************** Constructors and file settings
diff --git a/extra/qhexedit2/src/qhexedit.cpp b/extra/qhexedit2/src/qhexedit.cpp
--- a/extra/qhexedit2/src/qhexedit.cpp
+++ b/extra/qhexedit2/src/qhexedit.cpp
@@ -98,7 +98,7 @@ int QHexEdit::addressWidth()
{
qint64 size = _chunks->size();
int n = 1;
- if (size > 0x100000000){ n += 8; size /= 0x100000000;}
+ if (size > Q_INT64_C(0x100000000)){ n += 8; size /= Q_INT64_C(0x100000000);}
if (size > 0x10000){ n += 4; size /= 0x10000;}
if (size > 0x100){ n += 2; size /= 0x100;}
if (size > 0x10){ n += 1; size /= 0x10;}
@@ -858,6 +858,7 @@ void QHexEdit::init()
setCursorPosition(0);
verticalScrollBar()->setValue(0);
_modified = false;
+ _readOnly = false;
}
void QHexEdit::adjust()
Thanks for the awesome hex editor, but I have so many messages and those messages have so many bytes. How can I display those many messages and their corresponding bytes in your hex editor.
For Ex:
Msg_1
0000| 12 54 65 48 78 | //Ascii Area
...........................................
Msg_2
0000| 54 65 98 45 87 | //Ascii Area
...........................................
Please help me in this regard.
When using the QHexEdit widget without calling:
setAddressArea(true);
setAsciiArea(true);
setHighlighting(true);
setOverwriteMode(false);
setReadOnly(false);
setAddressWidth(8);
the cursor jumps back to the first column sometimes when in inserting mode and pressing "2" several times.
When these functions are called, the behaviour was ok.
It looks like some internal variables are not initialized correctly within the constructor but only if these functions are called.
Tested with QT5.5, Linux Ubuntu 14.04.
What steps will reproduce the problem?
1. Call setData()
2. You focus has been stolen!
What is the expected output? What do you see instead?
I'd like to keep the focus, when using a spinbox for array size management it
forces me to click at spinbox after every character I enter.
What version of the product are you using? On what operating system?
0.5.4 Linux/Windows/OSX
Please provide any additional information below.
I fixed it by commenting setFocus(); (qhexedit_p.cpp:52) But I think a better
way would be to make it optional.
Original issue reported on code.google.com by [email protected]
on 5 Oct 2011 at 10:22
Dynamic changing chars in line count (now hardcoded).
Original issue reported on code.google.com by [email protected]
on 21 Jan 2012 at 4:58
Since all setters for main class fields are closely interconnected, calling anyone of them while some other fields haven't yet been initialized leads to conditionals relying on uninitialized values (you can check this with valgrind).
To circumvent this I had just to add to the QHexEdit constructor the following lines:
_addressArea = true;
_addressWidth = 4;
_asciiArea = true;
_overwriteMode = true;
_highlighting = true;
_readOnly = false;
_cursorPosition = 0;
_lastEventSize = 0;
Not sure if it is the correct solution, however.
Out of range, when select range at end of file and trying to change value
You must do checking of dataSize, before replacing chars.
my fix
At least on linux.
Is it this on purpose?
gcc accepts these but VC++ does not with default settings.
Enabling these keywords for MSVC 2013 as suggested in http://stackoverflow.com/questions/555505/c-alternative-tokens/555524#555524 fails since then we get compiler errors in winnt.h.
So best option would be to replace these "keywords" with their counterparts "&&" and "||" in the code of QHexEdit.
I am newbie to use PyQT5.6 and SIP-4.18, python3.5.(OS is Windows8.1)
I am currently trying to import “QHexEdit” in my python project.
But I cannot import the “QHexEdit” because of linking problem.
I was trying to solve this adding “Additional Library Directories” of VS2015
but not working.
Build process and library path setup screen of was attached.
Build error summary is shown as below lines.
running install
running build
running build_ext
sipqhexeditQHexEdit.cpp
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Python35\libs /LIBPATH:C:\Python35\PCbuild\amd64 “/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64” “/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64” “/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64” “/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64” “/LIBPATH:C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64” Qt5Core.lib Qt5Gui.lib Qt5Widget.lib qhexedit.lib /EXPORT:PyInit_qhexedit build\temp.win-amd64-3.5\Release\build\temp.win-amd64-3.5\Release\sipqhexeditcmodule.obj build\temp.win-amd64-3.5\Release\build\temp.win-amd64-3.5\Release\sipqhexeditQHexEdit.obj /OUT:build\lib.win-amd64-3.5\qhexedit.cp35-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.5\Release\build\temp.win-amd64-3.5\Release\qhexedit.cp35-win_amd64.lib
LINK : fatal error LNK1181: cannot open input file ‘Qt5Core.lib’
error: command ‘C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe’ failed with exit status 1181
Hi,
I want to say thank you for great job, for save my time :), this is widget I need
I just use your source in my project and when debug I discover one leak memory issue
QHexEdit::QHexEdit(QWidget *parent) : QAbstractScrollArea(parent)
{
.....
_chunks = new Chunks();
....
}
Chunks::Chunks()
{
QBuffer *buf = new QBuffer();
...
}
I have fixed it and attached here,
Please check
Thank you again for your great job
fix_mem_leak.zip
See this pull request
#27
in ascii edit mode and german keyboard can't emit chars like "{", "[", "]", "}" etc. generated together with Alt-Gr key.
keyPressEvent in part of input ascii have to allow modifiers?
reproduce:
For packaging downstream in distributions it is important that the library version is updated when the API changes, otherwise dependent packages aren't rebuilt and can misbehave in various ways - even just refuse to start with a segfault.
The latest version 0.8.0 includes incompatible changes. Could you please update the library version accordingly?
There are incompatible changes in the latest version without a soname bump, see compatibility report.
reproduce:
First off, thanks so much for coding this. It has saved me a bunch of time and I still couldn't come close to having all the features and documentation of yours 😄
I noticed one small bug however. If you place your cursor at the end of the data and press backspace to delete the byte, the cursor moves back 1 spot in front of the new last byte. Happens for both overwrite mode and insert mode.
In the else section of the backspace event handler, I made these changes...
else
{
_bPosCurrent -= 1;
if (_overwriteMode)
{
if(dataAt(_bPosCurrent+1, 1) == QByteArray::fromHex("00"))
replace(_bPosCurrent, char(0));
else
{
replace(_bPosCurrent+1, char(0));
_bPosCurrent+=1;
}
}
else
remove(_bPosCurrent, 1);
if(_chunks->size() != _bPosCurrent)
_bPosCurrent -= 1;
setCursorPosition(2 * _bPosCurrent);
resetSelection(2 * _bPosCurrent);
}
While it's still not exactly what probably should be done, this seemed to fix it for now.
Is it possible to use this with PySide?
Thanks!
Please bump the library version (see [1]) when the ABI changes, as it did between 0.6.6 and 0.7.0, see [2], which was produced with abi_compliance_checker
.
[1] http://doc.qt.io/qt-4.8/qmake-variable-reference.html#version
[2] https://smani.fedorapeople.org/tmp/compat_report.html
The Ostinato project (http://ostinato.org) uses qhexedit2 to let users enter
packet contents as a hexdump.
We have received a request to support copy-paste with this widget
(http://groups.google.com/group/ostinato/browse_thread/thread/c65f2933238cf5b3)
and hence are raising this enhancement request
Original issue reported on code.google.com by [email protected]
on 26 Apr 2011 at 3:36
What steps will reproduce the problem?
1. Do insert mode
2. Enter a lot of data
3. Resize the window height so it is smaller then the data
What is the expected output? What do you see instead?
The vertical scrollbar should show, it actually does nothing.
What version of the product are you using? On what operating system?
Latest commit, MSVC2010, Windows8.1, Qt 4.8.5 x86
Please provide any additional information below.
Adding the following line in "QHexEditPrivate::QHexEditPrivate(QScrollArea
*parent) : QWidget(parent)" fixes it:
connect(this, SIGNAL(dataChanged()), this, SLOT(adjust())); //adjust scrollbar
when inserting data
Greetings
Original issue reported on code.google.com by [email protected]
on 4 Jul 2014 at 11:17
QHexEdit would not compile with Qt 5.
I created a patch that compiles with Qt 5.2 and with Qt 4.8.
Tested on OS X 10.9 (Mavericks)
Note about Qt 4.8:
Qt 4.8 is not supported on OS X 10.9. I still managed to compile. And I could
even run the example application. But it responded very slow when I was
selecting bytes in the hex view.
Note about PyQt:
I didn't uptdate the part for PyQt. Since I'm not familiar with PyQt and sip,
I'm not sure if I'll manage to do that. But I'm interested in using QHexEdit in
PyQt 5 myself. So if I'll have some time I'll try to wrap my head around this
stuff.
Original issue reported on code.google.com by [email protected]
on 31 Dec 2013 at 12:40
Attachments:
The inclusion of the GNU LGPL v2.1 in the license.txt file under the src directory suggests that the author or authors wish to make this code available for use under the terms of that license. However, without an explicit statement to that effect, it is not legally permissible for me to use this code under those terms. If the intent is to release this code under the LGPL, please add a statement of copyright and licensing to the library.
What steps will reproduce the problem?
1. call setAsciiArea(false) on the QHexEdit object
What is the expected output? What do you see instead?
I would expect the scroll bar to stop after the hex view, but instead, there's
a blank empty area on the far right, where the ascii area is usually displayed.
What version of the product are you using? On what operating system?
Latest source (from what I can see)
Please provide any additional information below.
Here's the fix I did in QHexEditPrivate::adjust()
if(_asciiArea)
setMinimumWidth(_xPosAscii + (BYTES_PER_LINE * _charWidth));
else
setMinimumWidth(_xPosHex + HEXCHARS_IN_LINE * _charWidth);
Original issue reported on code.google.com by [email protected]
on 5 Nov 2011 at 1:09
In Example saveFile() function:
file.open(QFile::WriteOnly | QFile::Text)
causes errors while saving (/n translated to /r/n);
correct way:
file.open(QFile::WriteOnly | QFile::Truncate)
Original issue reported on code.google.com by [email protected]
on 6 Jun 2013 at 4:28
What steps will reproduce the problem?
1. Set the cursor to the first Byte
2. Hit Backspace
3. QHexEdit crashes
What is the expected output? What do you see instead?
QHexEdit should ignore the key input
Original issue reported on code.google.com by [email protected]
on 22 Oct 2011 at 8:20
What steps will reproduce the problem?
1. Change Data
2. Save File
3. Edit file again
Editing file causes selection from start to point where data is changed
solution:
instead of clear() fill entire _changedData with 0.
void XByteArray::clearDataChanged()
{
_changedData = QByteArray(_changedData.length(), char(0));
}
Original issue reported on code.google.com by [email protected]
on 2 Jun 2013 at 4:25
The editor should warn a user, when they
This feature should fit to the enhanced multi file editor functionality.
$ qmake
$ nmake
build only qhexedit.dll but not qhexedit.lib(not static) for dll
Q_PROPERTY(QByteArray data READ data WRITE setData)
should include "NOTIFY dataChanged".
This helps in connecting change notifications to the property via QT MetaObject means.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.