コード例 #1
0
ファイル: qhexedit.cpp プロジェクト: SilentControl/mangler
QHexEdit::QHexEdit(ExecutableViewer *executableViewer, QWidget *parent) : QAbstractScrollArea(parent),
    executableViewer(executableViewer)
{
    _chunks = new Chunks();
    _undoStack = new UndoStack(_chunks, this);
#ifdef Q_OS_WIN32
    setFont(QFont("Courier", 10));
#else
    setFont(QFont("Monospace", 10));
#endif
    setAddressAreaColor(this->palette().alternateBase().color());
    setHighlightingColor(QColor(0xff, 0xff, 0x99, 0xff));
    setSelectionColor(this->palette().highlight().color());

    connect(&_cursorTimer, SIGNAL(timeout()), this, SLOT(updateCursor()));
    connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(adjust()));
    connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(adjust()));
    connect(_undoStack, SIGNAL(indexChanged(int)), this, SLOT(dataChangedPrivate(int)));

    _cursorTimer.setInterval(500);
    _cursorTimer.start();

    setAddressWidth(4);
    setAddressArea(true);
    setAsciiArea(true);
    setOverwriteMode(true);
    setHighlighting(true);
    setReadOnly(false);

    init();

    connect(this, SIGNAL(dataChanged()), executableViewer, SLOT(hexDataChanged()));
}
コード例 #2
0
ファイル: qhexedit_p.cpp プロジェクト: DDuarte/IntWars2
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();
}
コード例 #3
0
ファイル: qhexedit.cpp プロジェクト: Lo91/bsnes-plus
QHexEdit::QHexEdit(QWidget *parent) : QAbstractScrollArea(parent)
{
    _undoStack = new UndoStack(this);
    setFont(QFont(Style::Monospace));
    
    setAddressAreaColor(this->palette().alternateBase().color());
    setHighlightingColor(QColor(0xff, 0xff, 0x99, 0xff));
    setSelectionColor(this->palette().highlight().color());

    connect(&_cursorTimer, SIGNAL(timeout()), this, SLOT(updateCursor()));
    connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(adjust()));
    connect(_undoStack, SIGNAL(indexChanged(int)), this, SLOT(dataChangedPrivate(int)));

    _cursorTimer.setInterval(500);
    _cursorTimer.start();

    setAddressWidth(4);
    setAddressArea(true);
    setAsciiArea(true);
    setHighlighting(true);
    setReadOnly(false);

    init();

}
コード例 #4
0
QHexEdit::QHexEdit(QWidget *parent) : QAbstractScrollArea(parent)
{
    _chunks = new Chunks();
    _undoStack = new UndoStack(_chunks, this);
#ifdef Q_OS_WIN32
    setFont(QFont("Fixedsys", 12));
#else
    setFont(QFont("Monospace", 12));
#endif
    setAddressAreaColor(this->palette().alternateBase().color());
    setHighlightingColor(QColor(0, 0, 0, 0xff));
    setSelectionColor(QColor(0xff, 0xff, 0, 0xff));

    setStyleSheet(QString::fromUtf8("background-color:Black; color:green"));

    connect(&_cursorTimer, SIGNAL(timeout()), this, SLOT(updateCursor()));
    connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(adjust()));
    connect(_undoStack, SIGNAL(indexChanged(int)), this, SLOT(dataChangedPrivate(int)));

    _cursorTimer.setInterval(500);
    _cursorTimer.start();

    setAddressWidth(4);
    setAddressArea(true);
    setAsciiArea(true);
    setOverwriteMode(true);
    setHighlighting(true);
    setReadOnly(false);

    init();

}
コード例 #5
0
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;
}
コード例 #6
0
ファイル: qhexedit.cpp プロジェクト: Simsys/qhexedit2
QHexEdit::QHexEdit(QWidget *parent) : QAbstractScrollArea(parent)
{
    _addressArea = true;
    _addressWidth = 4;
    _asciiArea = true;
    _overwriteMode = true;
    _highlighting = true;
    _readOnly = false;
    _cursorPosition = 0;
    _lastEventSize = 0;
    _hexCharsInLine = 47;
    _bytesPerLine = 16;
    _editAreaIsAscii = false;
    _hexCaps = false;
    _dynamicBytesPerLine = false;

    _chunks = new Chunks(this);
    _undoStack = new UndoStack(_chunks, this);
#ifdef Q_OS_WIN32
    setFont(QFont("Courier", 10));
#else
    setFont(QFont("Monospace", 10));
#endif
    setAddressAreaColor(this->palette().alternateBase().color());
    setHighlightingColor(QColor(0xff, 0xff, 0x99, 0xff));
    setSelectionColor(this->palette().highlight().color());

    connect(&_cursorTimer, SIGNAL(timeout()), this, SLOT(updateCursor()));
    connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(adjust()));
    connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(adjust()));
    connect(_undoStack, SIGNAL(indexChanged(int)), this, SLOT(dataChangedPrivate(int)));

    _cursorTimer.setInterval(500);
    _cursorTimer.start();

    setAddressWidth(4);
    setAddressArea(true);
    setAsciiArea(true);
    setOverwriteMode(true);
    setHighlighting(true);
    setReadOnly(false);

    init();

}
コード例 #7
0
ファイル: qhexedit_p.cpp プロジェクト: pockemul/PockEmul
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;
}