diff --git a/src/plugins/bineditor/bineditor.cpp b/src/plugins/bineditor/bineditor.cpp index a3a142ad5dfe2d33b0c33df3dc0bc39d036f670e..4ab07964a384b6ada6c465cccb98c844d3991191 100644 --- a/src/plugins/bineditor/bineditor.cpp +++ b/src/plugins/bineditor/bineditor.cpp @@ -126,6 +126,15 @@ void BinEditor::init() ++hex; } + if (m_isMonospacedFont && fm.width("M M ") != m_charWidth * 4) { + // On Qt/Mac, monospace font widths may have a fractional component + // This breaks the assumption that width("MMM") == width('M') * 3 + + m_isMonospacedFont = false; + m_columnWidth = fm.width("MMM"); + m_labelWidth = fm.width("MMMM:MMMM:MMMM:MMMM"); + } + horizontalScrollBar()->setRange(0, 2 * m_margin + 16 * m_columnWidth + m_labelWidth + m_textWidth - viewport()->width()); horizontalScrollBar()->setPageStep(viewport()->width());