Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

QFont setFixedPitch works in Qt 4.8, not in 5.0

$
0
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);     memoryDumpFont->setFixedPitch(true);     memoryDumpFont->setStretch(110); writing a table item QTableWidgetItem *item = new QTableWidgetItem(value);     item->setTextAlignment(Qt::AlignCenter);     item->setFont(*memoryDumpFont);     ui->MemoryDump->setItem(row, col, item);

Viewing all articles
Browse latest Browse all 18427

Trending Articles