qt 5.12 compatibility

This commit is contained in:
Roy Qu 2023-01-15 13:38:36 +00:00
parent 9036899cd8
commit e1e60d2f64
1 changed files with 4 additions and 0 deletions

View File

@ -145,7 +145,11 @@ QString RTFExporter::getFormatName()
QString RTFExporter::getHeader()
{
QFontMetrics fm(mFont);
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
int tabWidth = mTabSize * fm.horizontalAdvance("M")*72*20/fm.fontDpi();
#else
int tabWidth = mTabSize * fm.horizontalAdvance("M")*72*20/96;
#endif
QString result = QString("{\\rtf1\\ansi\\deff0\\deftab%1").arg(tabWidth) + getFontTable();
// all the colors