MCPcopy Create free account
hub / github.com/Simsys/qhexedit2 / resizeEvent

Method resizeEvent

src/qhexedit.cpp:984–1003  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

982}
983
984void QHexEdit::resizeEvent(QResizeEvent *)
985{
986 if (_dynamicBytesPerLine)
987 {
988 int pxFixGaps = 0;
989 if (_addressArea)
990 pxFixGaps = addressWidth() * _pxCharWidth + 2 * _pxAreaMargin;
991 pxFixGaps += 2 * _pxAreaMargin;
992 if (_asciiArea)
993 pxFixGaps += 2 * _pxAreaMargin;
994
995 // +1 because the last hex value do not have space. so it is effective one char more
996 int charWidth = (viewport()->width() - pxFixGaps ) / _pxCharWidth + 1;
997
998 // 2 hex alfa-digits 1 space 1 ascii per byte = 4; if ascii is disabled then 3
999 // to prevent devision by zero use the min value 1
1000 setBytesPerLine(std::max(charWidth / (_asciiArea ? 4 : 3), 1));
1001 }
1002 adjust();
1003}
1004
1005bool QHexEdit::focusNextPrevChild(bool next)
1006{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected