Important: Please read the Qt Code of Conduct -

[SOLVED with Work-around] QFont setFixedPitch works in Qt 4.8, not in 5.0

  • I am using QFont's setFixedPitch in various places in my code in Qt 4.8, and it works perfectly. All the characters including letters, numbers, and blanks line up in perfect columns. But in Qt5.0, the displays are all wrong due to variable fonts, i.e. setFixedPitch no longer works. Each character is a different width.
    Typical code:
    setting the font
    @QFont* memoryDumpFont = new QFont("Monospace", 9);
    writing a table item
    @QTableWidgetItem *item = new QTableWidgetItem(value);
    ui->MemoryDump->setItem(row, col, item);@

  • Changed my font from "Monospace" to "Courier" for a workaround. But I wonder why it doesn't work like it used to?

Log in to reply