debug: fix the gui for smaller fonts

Using a font pointsize different from 11pt has a consequence that
fontWidth (in pixels) is not an integer anymore.
This commit is contained in:
Fabrice Bellet 2014-12-02 21:41:57 +01:00 committed by Olivier Galibert
parent 6b98aa281a
commit 1417b6be30
2 changed files with 3 additions and 3 deletions

View File

@ -280,7 +280,7 @@ void DebuggerMemView::mousePressEvent(QMouseEvent* event)
if (leftClick || rightClick)
{
QFontMetrics actualFont = fontMetrics();
const int fontWidth = MAX(1, actualFont.width('_'));
const double fontWidth = actualFont.width(QString(100, '_')) / 100.;
const int fontHeight = MAX(1, actualFont.height());
debug_view_xy topLeft = view()->visible_position();

View File

@ -152,7 +152,7 @@ void DebuggerView::paintEvent(QPaintEvent* event)
{
// Tell the MAME debug view how much real estate is available
QFontMetrics actualFont = fontMetrics();
const int fontWidth = MAX(1, actualFont.width('_'));
const double fontWidth = actualFont.width(QString(100, '_')) / 100.;
const int fontHeight = MAX(1, actualFont.height());
m_view->set_visible_size(debug_view_xy(width()/fontWidth, height()/fontHeight));
@ -344,7 +344,7 @@ void DebuggerView::mousePressEvent(QMouseEvent* event)
if (event->button() == Qt::LeftButton)
{
QFontMetrics actualFont = fontMetrics();
const int fontWidth = MAX(1, actualFont.width('_'));
const double fontWidth = actualFont.width(QString(100, '_')) / 100.;
const int fontHeight = MAX(1, actualFont.height());
debug_view_xy topLeft = m_view->visible_position();