qfont.html

来自「QT 下载资料仅供参考」· HTML 代码 · 共 870 行 · 第 1/4 页

HTML
870
字号
<p>Examples: <a href="menu-example.html#x1852">menu/menu.cpp</a> and <a href="themes-example.html#x240">themes/metal.cpp</a>.<h3 class=fn>void <a name="setDefaultFont"></a>QFont::setDefaultFont ( const&nbsp;<a href="qfont.html">QFont</a>&nbsp;&amp;&nbsp;f )<tt> [static]</tt></h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.<p> Please use <a href="qapplication.html#setFont">QApplication::setFont</a>() instead.<h3 class=fn>void <a name="setFamily"></a>QFont::setFamily ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;family )</h3>Sets the family name of the font. The name is case insensitive andmay include a foundry name.<p> The <em>family</em> name may optionally also include a foundry name,e.g. "Helvetica [Cronyx]". (The Qt 2.x syntax, i.e."Cronyx-Helvetica", is also supported.) If the <em>family</em> isavailable from more than one foundry and the foundry isn'tspecified, an arbitrary foundry is chosen. If the family isn'tavailable a family will be set using the <a href="#fontmatching">font    matching</a> algorithm.<p> <p>See also <a href="#family">family</a>(), <a href="#setStyleHint">setStyleHint</a>() and <a href="qfontinfo.html">QFontInfo</a>.<h3 class=fn>void <a name="setFixedPitch"></a>QFont::setFixedPitch ( bool&nbsp;enable )</h3>If <em>enable</em> is TRUE, sets fixed pitch on; otherwise sets fixedpitch off.<p> <p>See also <a href="#fixedPitch">fixedPitch</a>() and <a href="qfontinfo.html">QFontInfo</a>.<h3 class=fn>void <a name="setItalic"></a>QFont::setItalic ( bool&nbsp;enable )</h3>If <em>enable</em> is TRUE, italic is set on; otherwise italic is setoff.<p> <p>See also <a href="#italic">italic</a>() and <a href="qfontinfo.html">QFontInfo</a>.<p>Examples: <a href="fileiconview-example.html#x824">fileiconview/qfileiconview.cpp</a>, <a href="simple-qfont-demo-walkthrough.html#x2114">fonts/simple-qfont-demo/viewer.cpp</a> and <a href="themes-example.html#x241">themes/metal.cpp</a>.<h3 class=fn>void <a name="setPixelSize"></a>QFont::setPixelSize ( int&nbsp;pixelSize )</h3>Sets the font size to <em>pixelSize</em> pixels.<p> Using this function makes the font device dependent. Use<a href="#setPointSize">setPointSize</a>() or <a href="#setPointSizeFloat">setPointSizeFloat</a>() to set the size of the fontin a device independent manner.<p> <p>See also <a href="#pixelSize">pixelSize</a>().<p>Example: <a href="qwerty-example.html#x365">qwerty/qwerty.cpp</a>.<h3 class=fn>void <a name="setPixelSizeFloat"></a>QFont::setPixelSizeFloat ( float&nbsp;pixelSize )</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.<p> Sets the logical pixel height of font characters when shown onthe screen to <em>pixelSize</em>.<h3 class=fn>void <a name="setPointSize"></a>QFont::setPointSize ( int&nbsp;pointSize )</h3>Sets the point size to <em>pointSize</em>. The point size must begreater than zero.<p> <p>See also <a href="#pointSize">pointSize</a>() and <a href="#setPointSizeFloat">setPointSizeFloat</a>().<p>Example: <a href="simple-qfont-demo-walkthrough.html#x2115">fonts/simple-qfont-demo/viewer.cpp</a>.<h3 class=fn>void <a name="setPointSizeFloat"></a>QFont::setPointSizeFloat ( float&nbsp;pointSize )</h3>Sets the point size to <em>pointSize</em>. The point size must begreater than zero. The requested precision may not be achieved onall platforms.<p> <p>See also <a href="#pointSizeFloat">pointSizeFloat</a>(), <a href="#setPointSize">setPointSize</a>() and <a href="#setPixelSize">setPixelSize</a>().<h3 class=fn>void <a name="setRawMode"></a>QFont::setRawMode ( bool&nbsp;enable )</h3>If <em>enable</em> is TRUE, turns raw mode on; otherwise turns raw modeoff. This function only has an effect under X11.<p> If raw mode is enabled, Qt will search for an X font with acomplete font name matching the family name, ignoring all othervalues set for the QFont. If the font name matches several fonts,Qt will use the first font returned by X. <a href="qfontinfo.html">QFontInfo</a> <em>cannot</em> beused to fetch information about a QFont using raw mode (it willreturn the values set in the QFont for all parameters, includingthe family name).<p> <b>Warning:</b> Do not use raw mode unless you really, really need it! Inmost (if not all) cases, <a href="#setRawName">setRawName</a>() is a much better choice.<p> <p>See also <a href="#rawMode">rawMode</a>() and <a href="#setRawName">setRawName</a>().<h3 class=fn>void <a name="setRawName"></a>QFont::setRawName ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;name )</h3>Sets a font by its system specific name. The function isparticularly useful under X, where system font settings (forexample X resources) are usually available in XLFD (X Logical FontDescription) form only. You can pass an XLFD as <em>name</em> to thisfunction.<p> In Qt 2.0 and later, a font set with <a href="#setRawName">setRawName</a>() is still afull-featured QFont. It can be queried (for example with <a href="#italic">italic</a>())or modified (for example with <a href="#setItalic">setItalic</a>()) and is therefore alsosuitable for rendering rich text.<p> If Qt's internal font database cannot resolve the raw name, thefont becomes a raw font with <em>name</em> as its family.<p> Note that the present implementation does not handle wildcards inXLFDs well, and that font aliases (file <tt>fonts.alias</tt> in the fontdirectory on X11) are not supported.<p> <p>See also <a href="#rawName">rawName</a>(), <a href="#setRawMode">setRawMode</a>() and <a href="#setFamily">setFamily</a>().<h3 class=fn>void <a name="setStrikeOut"></a>QFont::setStrikeOut ( bool&nbsp;enable )</h3>If <em>enable</em> is TRUE, sets strikeout on; otherwise sets strikeoutoff.<p> <p>See also <a href="#strikeOut">strikeOut</a>() and <a href="qfontinfo.html">QFontInfo</a>.<h3 class=fn>void <a name="setStyleHint"></a>QFont::setStyleHint ( <a href="qfont.html#StyleHint-enum">StyleHint</a>&nbsp;hint, <a href="qfont.html#StyleStrategy-enum">StyleStrategy</a>&nbsp;strategy = PreferDefault )</h3>Sets the style hint and strategy to <em>hint</em> and <em>strategy</em>,respectively.<p> If these aren't set explicitly the style hint will default to<a href="#StyleHint-enum">AnyStyle</a> and the style strategy to <a href="#StyleStrategy-enum">PreferDefault</a>.<p> <p>See also <a href="#StyleHint-enum">StyleHint</a>, <a href="#styleHint">styleHint</a>(), <a href="#StyleStrategy-enum">StyleStrategy</a>, <a href="#styleStrategy">styleStrategy</a>() and <a href="qfontinfo.html">QFontInfo</a>.<p>Examples: <a href="desktop-example.html#x1766">desktop/desktop.cpp</a> and <a href="simple-qfont-demo-walkthrough.html#x2116">fonts/simple-qfont-demo/viewer.cpp</a>.<h3 class=fn>void <a name="setStyleStrategy"></a>QFont::setStyleStrategy ( <a href="qfont.html#StyleStrategy-enum">StyleStrategy</a>&nbsp;s )</h3>Sets the style strategy for the font to <em>s</em>.<p> <p>See also <a href="#StyleStrategy-enum">QFont::StyleStrategy</a>.<h3 class=fn>void <a name="setUnderline"></a>QFont::setUnderline ( bool&nbsp;enable )</h3>If <em>enable</em> is TRUE, sets underline on; otherwise sets underlineoff.<p> <p>See also <a href="#underline">underline</a>() and <a href="qfontinfo.html">QFontInfo</a>.<p>Examples: <a href="simple-qfont-demo-walkthrough.html#x2117">fonts/simple-qfont-demo/viewer.cpp</a> and <a href="menu-example.html#x1853">menu/menu.cpp</a>.<h3 class=fn>void <a name="setWeight"></a>QFont::setWeight ( int&nbsp;weight )</h3>Sets the weight the font to <em>weight</em>, which should be a valuefrom the <a href="#Weight-enum">QFont::Weight</a> enumeration.<p> <p>See also <a href="#weight">weight</a>() and <a href="qfontinfo.html">QFontInfo</a>.<p>Example: <a href="simple-qfont-demo-walkthrough.html#x2118">fonts/simple-qfont-demo/viewer.cpp</a>.<h3 class=fn>bool <a name="strikeOut"></a>QFont::strikeOut () const</h3>Returns TRUE if strikeout has been set; otherwise returns FALSE.<p> <p>See also <a href="#setStrikeOut">setStrikeOut</a>().<h3 class=fn><a href="qfont.html#StyleHint-enum">StyleHint</a> <a name="styleHint"></a>QFont::styleHint () const</h3>Returns the StyleHint.<p> The style hint affects the <a href="#fontmatching">font    matching</a> algorithm. See <a href="#StyleHint-enum">QFont::StyleHint</a> for the listof strategies.<p> <p>See also <a href="#setStyleHint">setStyleHint</a>(), <a href="#StyleStrategy-enum">QFont::StyleStrategy</a> and <a href="qfontinfo.html#styleHint">QFontInfo::styleHint</a>().<h3 class=fn><a href="qfont.html#StyleStrategy-enum">StyleStrategy</a> <a name="styleStrategy"></a>QFont::styleStrategy () const</h3>Returns the StyleStrategy.<p> The style strategy affects the <a href="#fontmatching">font    matching</a> algorithm. See <a href="#StyleStrategy-enum">QFont::StyleStrategy</a> for thelist of strategies.<p> <p>See also <a href="#setStyleHint">setStyleHint</a>() and <a href="#StyleHint-enum">QFont::StyleHint</a>.<h3 class=fn><a href="qstring.html">QString</a> <a name="substitute"></a>QFont::substitute ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;familyName )<tt> [static]</tt></h3>Returns the first family name to be used whenever <em>familyName</em> isspecified. The lookup is case insensitive.<p> If there is no substitution for <em>familyName</em>, <em>familyName</em> isreturned.<p> To obtain a list of substitutions use <a href="#substitutes">substitutes</a>().<p> <p>See also <a href="#setFamily">setFamily</a>(), <a href="#insertSubstitutions">insertSubstitutions</a>(), <a href="#insertSubstitution">insertSubstitution</a>() and <a href="#removeSubstitution">removeSubstitution</a>().<h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="substitutes"></a>QFont::substitutes ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;familyName )<tt> [static]</tt></h3>Returns a list of family names to be used whenever <em>familyName</em>is specified. The lookup is case insensitive.<p> If there is no substitution for <em>familyName</em>, an empty list isreturned.<p> <p>See also <a href="#substitute">substitute</a>(), <a href="#insertSubstitutions">insertSubstitutions</a>(), <a href="#insertSubstitution">insertSubstitution</a>() and <a href="#removeSubstitution">removeSubstitution</a>().<p>Example: <a href="simple-qfont-demo-walkthrough.html#x2119">fonts/simple-qfont-demo/viewer.cpp</a>.<h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="substitutions"></a>QFont::substitutions ()<tt> [static]</tt></h3>Returns a sorted list of substituted family names.<p> <p>See also <a href="#insertSubstitution">insertSubstitution</a>(), <a href="#removeSubstitution">removeSubstitution</a>() and <a href="#substitute">substitute</a>().<h3 class=fn><a href="qstring.html">QString</a> <a name="toString"></a>QFont::toString () const</h3>Returns a description of the font. The description is acomma-separated list of the attributes, perfectly suited for usein <a href="qsettings.html">QSettings</a>.<p> <p>See also <a href="#fromString">fromString</a>() and <a href="#operator-lt-lt">operator&lt;&lt;</a>().<h3 class=fn>bool <a name="underline"></a>QFont::underline () const</h3>Returns TRUE if underline has been set; otherwise returns FALSE.<p> <p>See also <a href="#setUnderline">setUnderline</a>().<h3 class=fn>int <a name="weight"></a>QFont::weight () const</h3>Returns the weight of the font which is one of the enumeratedvalues from <a href="#Weight-enum">QFont::Weight</a>.<p> <p>See also <a href="#setWeight">setWeight</a>(), <a href="#Weight-enum">Weight</a> and <a href="qfontinfo.html">QFontInfo</a>.<hr><h2>Related Functions</h2><h3 class=fn><a href="qdatastream.html">QDataStream</a>&nbsp;&amp; <a name="operator-lt-lt"></a>operator&lt;&lt; ( <a href="qdatastream.html">QDataStream</a>&nbsp;&amp;&nbsp;s, const&nbsp;<a href="qfont.html">QFont</a>&nbsp;&amp;&nbsp;font )</h3><p> Writes the font <em>font</em> to the data stream <em>s</em>. (<a href="#toString">toString</a>()writes to a text stream.)<p> <p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.<h3 class=fn><a href="qdatastream.html">QDataStream</a>&nbsp;&amp; <a name="operator-gt-gt"></a>operator&gt;&gt; ( <a href="qdatastream.html">QDataStream</a>&nbsp;&amp;&nbsp;s, <a href="qfont.html">QFont</a>&nbsp;&amp;&nbsp;font )</h3><p> Reads the font <em>font</em> from the data stream <em>s</em>. (<a href="#fromString">fromString</a>()reads from a text stream.)<p> <p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.<!-- eof --><hr><p>This file is part of the <a href="index.html">Qt toolkit</a>.Copyright &copy; 1995-2002<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center><table width=100% cellspacing=0 border=0><tr><td>Copyright &copy; 2002 <a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a><td align=right><div align=right>Qt version 3.0.5</div></table></div></address></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?