QHexEditPrivate::QHexEditPrivate(QScrollArea *parent) : QWidget(parent) { _undoStack = new QUndoStack(this); _scrollArea = parent; setAddressWidth(4); setAddressOffset(0); setAddressArea(true); setAsciiArea(true); setHighlighting(true); setOverwriteMode(true); setReadOnly(false); setAddressAreaColor(QColor(0xd4, 0xd4, 0xd4, 0xff)); setHighlightingColor(QColor(0xff, 0xff, 0x99, 0xff)); setSelectionColor(QColor(0x6d, 0x9e, 0xff, 0xff)); setFont(QFont("Courier", 10)); _size = 0; resetSelection(0); setFocusPolicy(Qt::StrongFocus); connect(&_cursorTimer, SIGNAL(timeout()), this, SLOT(updateCursor())); _cursorTimer.setInterval(500); _cursorTimer.start(); }
// ********************************************************************** Private utility functions void QHexEdit::init() { _undoStack->clear(); setAddressOffset(0); resetSelection(0); setCursorPosition(0); verticalScrollBar()->setValue(0); _modified = false; }
int QHexEdit::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QScrollArea::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: currentAddressChanged((*reinterpret_cast< int(*)>(_a[1]))); break; case 1: currentSizeChanged((*reinterpret_cast< int(*)>(_a[1]))); break; case 2: dataChanged(); break; case 3: overwriteModeChanged((*reinterpret_cast< bool(*)>(_a[1]))); break; case 4: setAddressWidth((*reinterpret_cast< int(*)>(_a[1]))); break; case 5: setAddressArea((*reinterpret_cast< bool(*)>(_a[1]))); break; case 6: setAsciiArea((*reinterpret_cast< bool(*)>(_a[1]))); break; case 7: setHighlighting((*reinterpret_cast< bool(*)>(_a[1]))); break; default: ; } _id -= 8; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QByteArray*>(_v) = data(); break; case 1: *reinterpret_cast< int*>(_v) = addressOffset(); break; case 2: *reinterpret_cast< QColor*>(_v) = addressAreaColor(); break; case 3: *reinterpret_cast< QColor*>(_v) = highlightingColor(); break; case 4: *reinterpret_cast< bool*>(_v) = overwriteMode(); break; } _id -= 5; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setData(*reinterpret_cast< QByteArray*>(_v)); break; case 1: setAddressOffset(*reinterpret_cast< int*>(_v)); break; case 2: setAddressAreaColor(*reinterpret_cast< QColor*>(_v)); break; case 3: setHighlightingColor(*reinterpret_cast< QColor*>(_v)); break; case 4: setOverwriteMode(*reinterpret_cast< bool*>(_v)); break; } _id -= 5; } else if (_c == QMetaObject::ResetProperty) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 5; } #endif // QT_NO_PROPERTIES return _id; }
QHexEditPrivate::QHexEditPrivate(QScrollArea *parent) : QWidget(parent) { _scrollArea = parent; setAddressWidth(4); setAddressOffset(0); setAddressArea(true); setAsciiArea(true); setHighlighting(true); setOverwriteMode(true); setAddressAreaColor(QColor(Qt::lightGray).lighter(110)); setHighlightingColor(QColor(Qt::yellow).lighter(160)); setFont(QFont("Mono", 10)); connect(&_cursorTimer, SIGNAL(timeout()), this, SLOT(updateCursor())); _cursorTimer.setInterval(500); _cursorTimer.start(); setFocusPolicy(Qt::StrongFocus); _size = -1; }