4 #include <QAbstractScrollArea> 11 #ifdef QHEXEDIT_EXPORTS 12 #define QHEXEDIT_API Q_DECL_EXPORT 13 #elif QHEXEDIT_IMPORTS 14 #define QHEXEDIT_API Q_DECL_IMPORT 59 class QHEXEDIT_API
QHexEdit :
public QAbstractScrollArea
66 Q_PROPERTY(
bool addressArea READ addressArea WRITE setAddressArea)
71 Q_PROPERTY(QColor addressAreaColor READ addressAreaColor WRITE setAddressAreaColor)
78 Q_PROPERTY(qint64 addressOffset READ addressOffset WRITE setAddressOffset)
82 Q_PROPERTY(
int addressWidth READ addressWidth WRITE setAddressWidth)
86 Q_PROPERTY(
bool asciiArea READ asciiArea WRITE setAsciiArea)
89 Q_PROPERTY(
int bytesPerLine READ bytesPerLine WRITE setBytesPerLine)
95 Q_PROPERTY(qint64 cursorPosition READ cursorPosition WRITE setCursorPosition)
102 Q_PROPERTY(QByteArray data READ data WRITE setData NOTIFY dataChanged)
107 Q_PROPERTY(
bool hexCaps READ hexCaps WRITE setHexCaps)
111 Q_PROPERTY(
bool dynamicBytesPerLine READ dynamicBytesPerLine WRITE setDynamicBytesPerLine)
115 Q_PROPERTY(
bool highlighting READ highlighting WRITE setHighlighting)
121 Q_PROPERTY(QColor highlightingColor READ highlightingColor WRITE setHighlightingColor)
128 Q_PROPERTY(
bool overwriteMode READ overwriteMode WRITE setOverwriteMode)
134 Q_PROPERTY(QColor selectionColor READ selectionColor WRITE setSelectionColor)
141 Q_PROPERTY(
bool readOnly READ isReadOnly WRITE setReadOnly)
144 Q_PROPERTY(QFont font READ font WRITE setFont)
158 bool setData(QIODevice &iODevice);
163 QByteArray dataAt(qint64 pos, qint64 count=-1);
168 bool write(QIODevice &iODevice, qint64 pos=0, qint64 count=-1);
178 void insert(qint64 pos,
char ch);
184 void remove(qint64 pos, qint64 len=1);
191 void replace(qint64 pos,
char ch);
201 void insert(qint64 pos, const QByteArray &ba);
209 void replace(qint64 pos, qint64 len, const QByteArray &ba);
217 qint64 cursorPosition(QPoint point);
221 void ensureVisible();
228 qint64 indexOf(const QByteArray &ba, qint64 from);
240 qint64 lastIndexOf(const QByteArray &ba, qint64 from);
244 QString selectionToReadableString();
248 QString selectedData();
253 void setFont(const QFont &font);
257 QString toReadableString();
274 void currentAddressChanged(qint64 address);
277 void currentSizeChanged(qint64 size);
283 void overwriteModeChanged(
bool state);
292 void setAddressArea(
bool addressArea);
294 QColor addressAreaColor();
295 void setAddressAreaColor(const QColor &color);
297 qint64 addressOffset();
298 void setAddressOffset(qint64 addressArea);
301 void setAddressWidth(
int addressWidth);
304 void setAsciiArea(
bool asciiArea);
307 void setBytesPerLine(
int count);
309 qint64 cursorPosition();
310 void setCursorPosition(qint64 position);
313 void setData(const QByteArray &ba);
315 void setHexCaps(const
bool isCaps);
318 void setDynamicBytesPerLine(const
bool isDynamic);
319 bool dynamicBytesPerLine();
322 void setHighlighting(
bool mode);
324 QColor highlightingColor();
325 void setHighlightingColor(const QColor &color);
327 bool overwriteMode();
328 void setOverwriteMode(
bool overwriteMode);
331 void setReadOnly(
bool readOnly);
333 QColor selectionColor();
334 void setSelectionColor(const QColor &color);
338 void keyPressEvent(QKeyEvent *event);
339 void mouseMoveEvent(QMouseEvent * event);
340 void mousePressEvent(QMouseEvent * event);
341 void paintEvent(QPaintEvent *event);
342 void resizeEvent(QResizeEvent *);
343 virtual
bool focusNextPrevChild(
bool next);
346 void resetSelection(qint64 pos);
347 void resetSelection();
348 void setSelection(qint64 pos);
349 qint64 getSelectionBegin();
350 qint64 getSelectionEnd();
355 QString toReadable(const QByteArray &ba);
359 void dataChangedPrivate(
int idx=0);
365 int _pxCharWidth, _pxCharHeight;
378 qint64 _bSelectionBegin;
379 qint64 _bSelectionEnd;
380 qint64 _bSelectionInit;
387 QColor _addressAreaColor;
390 qint64 _addressOffset;
395 QBrush _brushSelection;
397 QBrush _brushHighlighted;
398 QPen _penHighlighted;
401 bool _dynamicBytesPerLine;
404 bool _editAreaIsAscii;
410 qint64 _cursorPosition;
413 QByteArray _dataShown;
414 QByteArray _hexDataShown;
415 qint64 _lastEventSize;
416 QByteArray _markedShown;
419 UndoStack * _undoStack;
Definition: qhexedit.h:59