Qt: fix Qt 5.15 deprecation warning

QFont::ForceIntegerMetrics is deprecated.
This commit is contained in:
Orgad Shaneh 2020-11-30 11:52:13 +02:00 committed by AndersBroman
parent 65c6d829db
commit 29e59a0e20
2 changed files with 3 additions and 4 deletions

View File

@ -181,10 +181,9 @@ void ByteViewText::markAppendix(int start, int length)
void ByteViewText::setMonospaceFont(const QFont &mono_font)
{
QFont int_font(mono_font);
int_font.setStyleStrategy(QFont::ForceIntegerMetrics);
const QFontMetricsF fm(int_font);
font_width_ = fm.width('M');
const QFontMetrics fm(int_font);
font_width_ = fm.boundingRect('M').width();
setFont(int_font);
viewport()->setFont(int_font);

View File

@ -119,7 +119,7 @@ private:
bool show_hex_; // Should we show the hex display?
bool show_ascii_; // Should we show the ASCII display?
int row_width_; // Number of bytes per line
qreal font_width_; // Single character width and text margin. NOTE: Use fontMetrics::width for multiple characters.
int font_width_; // Single character width and text margin. NOTE: Use fontMetrics::width for multiple characters.
int line_height_; // Font line spacing
QList<QRect> hover_outlines_; // Hovered byte outlines.