Calculate font pixel size if the size was set with setPointSize() or setPointSizeF().

This commit is contained in:
Roman Telezhynskyi 2023-10-08 07:40:21 +03:00
parent e9f42bda30
commit 5fb441c9ba

View File

@ -334,7 +334,14 @@ void VTextGraphicsItem::SetPieceName(const QString &name)
*/
auto VTextGraphicsItem::GetFontSize() const -> int
{
return m_tm.GetFont().pixelSize();
int size = m_tm.GetFont().pixelSize();
if (size == -1)
{
QFontMetrics fontMetrics(m_tm.GetFont());
size = fontMetrics.height();
}
return size;
}
//---------------------------------------------------------------------------------------------------------------------