Hi,
I want to implement a hex-editor with a classical 3-parts-layout (offset, hex, ascii) with Qt (and Python, but that does not matter because class-names are equal to those of C++). As a proof of concept I thought it's maybe a good idea to use a QGraphicsView in which I place a QGraphicsScene. The QGraphicsScene is then filled with the three QGraphicsTextItems representing the current offset, hex and ascii values.
See the graphics below to get a better understanding:
fredi_arch.png
Currently this implementation has some problems:
- First of all, I wanted to get your opinion on this setup. Is there any better way? All in all it's less pixel-calculations than I expected because almost all geometry can be determined by already available methods (e. g. like those provided by QFontMetrics). The QGraphicsTextItem also allows me to apply colors, e. g. for implementing selections.
- The QGraphicsScene is created in case the navigation bar or the mouse wheel is used on the QGraphicsView or when a resizeEvent() occurs. That works fine, but I'm not sure if that's the best approach.
- Is there any way to fix the QGraphicsScene in the QGraphicsView? When I press the Page-Up/Page-Down keys it moves around (but the mouse-click coordinates which are relative to an item's position are still given correctly).
Thanks for reading and giving me your opinions beforehand
Rainer
Bookmarks