QFont fromString() toString() bug
Posted: Tue Nov 15 2022 9:34 pm
All,
Ubuntu 20.04 LTS
Built from tip of tip on Saturday.
The Line Edits hold the toString() output. When saving I fetch the text and attempt to translated it back.
It would also really help if the "Invalid description" actually specified what it was looking for.
The Line Edit is read only. Has to be changed by a font selector.
Adding insult to injury, when the fromString() fails, it appears to default to "Sans Serif"
https://www.logikalsolutions.com/wordpress/wp-content/uploads/2022/11/defaults-to-sans-serif.png
Ubuntu 20.04 LTS
Built from tip of tip on Saturday.
Code: Select all
m_ui->headerFontLE->text(): Monospace,10,-1,5,50,0,0,0,0,0,12,-1,5,50,0,0,0,0,0
QFont::fromString: Invalid description 'Monospace,10,-1,5,50,0,0,0,0,0,12,-1,5,50,0,0,0,0,0'
done saving header font
m_ui->footerFontLE->text(): Monospace,10,-1,5,50,0,0,0,0,0,12,-1,5,50,0,0,0,0,0
QFont::fromString: Invalid description 'Monospace,10,-1,5,50,0,0,0,0,0,12,-1,5,50,0,0,0,0,0'
done saving footer font
Code: Select all
void DialogPrintOptions::saveSettings()
{
QFont fnt;
if ( m_ui->headerFontLE->text().length() > 5 )
{
qDebug() << "m_ui->headerFontLE->text(): " << m_ui->headerFontLE->text() << "\n";
fnt.fromString( m_ui->headerFontLE->text() );
Overlord::getInstance()->setHeaderFont( fnt );
qDebug() << "done saving header font\n";
}
if ( m_ui->footerFontLE->text().length() > 5 )
{
qDebug() << "m_ui->footerFontLE->text(): " << m_ui->footerFontLE->text() << "\n";
fnt.fromString( m_ui->footerFontLE->text() );
Overlord::getInstance()->setFooterFont( fnt );
qDebug() << "done saving footer font\n";
}
The Line Edit is read only. Has to be changed by a font selector.
Adding insult to injury, when the fromString() fails, it appears to default to "Sans Serif"
https://www.logikalsolutions.com/wordpress/wp-content/uploads/2022/11/defaults-to-sans-serif.png