diff --git a/Source/GUI/MemViewer/MemViewer.cpp b/Source/GUI/MemViewer/MemViewer.cpp index b4a615e..47d0b9c 100644 --- a/Source/GUI/MemViewer/MemViewer.cpp +++ b/Source/GUI/MemViewer/MemViewer.cpp @@ -49,7 +49,7 @@ MemViewer::~MemViewer() void MemViewer::initialise() { - updateFontSize(m_memoryFontSize); + updateFontSize(); m_curosrRect = new QRect(); m_updatedRawMemoryData = new char[m_numCells]; m_lastRawMemoryData = new char[m_numCells]; @@ -356,9 +356,14 @@ void MemViewer::wheelEvent(QWheelEvent* event) if (event->modifiers().testFlag(Qt::ControlModifier)) { if (event->angleDelta().y() < 0 && m_memoryFontSize > 5) - updateFontSize(m_memoryFontSize - 1); + { + m_memoryFontSize -= 1; + } else if (event->angleDelta().y() > 0) - updateFontSize(m_memoryFontSize + 1); + { + m_memoryFontSize += 1; + } + updateFontSize(); viewport()->update(); } @@ -368,9 +373,12 @@ void MemViewer::wheelEvent(QWheelEvent* event) } } -void MemViewer::updateFontSize(int newSize) +void MemViewer::updateFontSize() { - m_memoryFontSize = newSize; + if (m_memoryFontSize == -1) + { + m_memoryFontSize = static_cast(font().pointSize() * 1.5); + } QFont fixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont); fixedFont.setPointSize(m_memoryFontSize); diff --git a/Source/GUI/MemViewer/MemViewer.h b/Source/GUI/MemViewer/MemViewer.h index bdfcae2..eff1f7b 100644 --- a/Source/GUI/MemViewer/MemViewer.h +++ b/Source/GUI/MemViewer/MemViewer.h @@ -67,7 +67,7 @@ class MemViewer : public QAbstractScrollArea void initialise(); - void updateFontSize(int newSize); + void updateFontSize(); bytePosFromMouse mousePosToBytePos(QPoint pos); void scrollToSelection(); void copySelection(Common::MemType type) const; @@ -93,7 +93,7 @@ class MemViewer : public QAbstractScrollArea const int m_numRows = 16; const int m_numColumns = 16; // Should be a multiple of 16, or the header doesn't make much sense const int m_numCells = m_numRows * m_numColumns; - int m_memoryFontSize = 15; + int m_memoryFontSize = -1; int m_StartBytesSelectionPosX = 0; int m_StartBytesSelectionPosY = 0; int m_EndBytesSelectionPosX = 0;