Qt: Fix compilation on Qt <5.11

This commit is contained in:
Connor McLaughlin 2020-12-17 13:05:17 +10:00
parent 4b4b97540e
commit 681fccd5e6

View file

@ -37,8 +37,13 @@ int MemoryViewWidget::asciiWidth() const
void MemoryViewWidget::updateMetrics()
{
m_char_width = fontMetrics().horizontalAdvance(QChar('0'));
m_char_height = fontMetrics().height();
const QFontMetrics fm(fontMetrics());
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
m_char_width = fm.horizontalAdvance(QChar('0'));
#else
m_char_width = fm.boundingRect(QChar('0')).width();
#endif
m_char_height = fm.height();
}
void MemoryViewWidget::setData(size_t address_offset, const void* data_ptr, size_t data_size)