Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QFont fixed width numbers with Windows Arial font
Forum Updated to NodeBB v4.3 + New Features

QFont fixed width numbers with Windows Arial font

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mireiner
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mireiner
      wrote on last edited by
      #2

      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 width

      But with "Microsoft Sans Serif" all above programs are showing numbers with fixed width - strange.

      So I stay with "Microsoft Sans Serif" - problem solved.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved