Obsolete Members for QFont

QFont 的以下成员已被弃用。提供这些成员是为了保持旧源代码的正常运行。我们强烈建议不要在新代码中使用它们。

公共函数

(deprecated in 6.0) int legacyWeight() const
(deprecated in 6.0) void setLegacyWeight(int legacyWeight)

成员函数文档

[deprecated in 6.0] int QFont::legacyWeight() const

自 6.0 版起,该函数已被弃用。我们强烈建议不要在新代码中使用该函数。

请使用weight() 代替它。

返回转换为 Qt 5 及更早版本中使用的非标准字体权重标尺的字体权重。

自 Qt 6 起,将使用 OpenType 标准的字体权重标度,而不是非标准标度。这就需要从使用旧标尺的值进行转换。为方便起见,在从使用旧重量标度的代码移植时,可以使用此函数。

另请参见 setLegacyWeight()、setWeight()、weight() 和QFontInfo

[deprecated in 6.0] void QFont::setLegacyWeight(int legacyWeight)

自 6.0 版起,该函数已被弃用。我们强烈建议不要在新代码中使用该函数。

请使用setWeight() 代替。

使用 Qt 5 及以前版本的传统字体权重标尺将字体权重设置为legacyWeight

自 Qt 6 起,将使用 OpenType 标准的字体权重标度,而不是非标准标度。这就需要从使用旧标尺的值进行转换。为方便起见,在从使用旧重量标度的代码移植时,可以使用此函数。

注意: 如果设置了styleName(),则在选择字体时可以忽略此值。

另请参阅 legacyWeight()、setWeight()、weight() 和QFontInfo

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.