QFont fixed width numbers with Windows Arial font
-
wrote on 23 Feb 2015, 03:58 last edited by
Hi,
porting my Windows MFC desktop program to Qt5.4 I got the problem that in Qt numbers are drawn not in fixed width, but in MFC they are.
Never got this problem before. Usually numbers in proportional Windows fonts are drawn with fixed width.
The Font here is Windows Arial and the numbers were drawn with QPainter, QFont and QPainter::drawText().
Example:
12:42:15
32:12:28
11:11:11
(Like above Qt draws the "1" with less width, MFC draws all numbers with same width)How to draw numbers with Arial font in Qt5 with fixed width?
-
wrote on 23 Feb 2015, 09:31 last edited by
I tested different programs with Windows "Arial" font:
Microsoft Windows 7 "Wordpad": Numbers are fixed width
Microsoft C++ MFC program via GDI+: Numbers are fixed width.
Libre Office: Numbers are not fixed width
Qt via QPainter: Numbers are not fixed widthBut with "Microsoft Sans Serif" all above programs are showing numbers with fixed width - strange.
So I stay with "Microsoft Sans Serif" - problem solved.
2/2