📄 qstyle.html
字号:
tool button; see also <a href="qpopupmenu.html">QPopupMenu</a>.</ul><p> <ul><li><tt>QStyle::SC_TitleBarSysMenu</tt> - system menu button (i.e. restore, close, etc.).<li><tt>QStyle::SC_TitleBarMinButton</tt> - minimize button.<li><tt>QStyle::SC_TitleBarMaxButton</tt> - maximize button.<li><tt>QStyle::SC_TitleBarCloseButton</tt> - close button.<li><tt>QStyle::SC_TitleBarLabel</tt> - window title label.<li><tt>QStyle::SC_TitleBarNormalButton</tt> - normal (restore) button.<li><tt>QStyle::SC_TitleBarShadeButton</tt> - shade button.<li><tt>QStyle::SC_TitleBarUnshadeButton</tt> - unshade button.</ul><p> <ul><li><tt>QStyle::SC_ListView</tt> - the list view area.<li><tt>QStyle::SC_ListViewBranch</tt> - (internal)<li><tt>QStyle::SC_ListViewExpand</tt> - expand item (i.e. show/hide child items).</ul><p> <ul><li><tt>QStyle::SC_All</tt> - special value that matches all SubControls.</ul><p> <p>See also <a href="#ComplexControl-enum">ComplexControl</a>.<h3 class=fn><a name="SubRect-enum"></a>QStyle::SubRect</h3><p> This enum represents a sub-area of a widget. Style implementationswould use these areas to draw the different parts of a widget.<ul><li><tt>QStyle::SR_PushButtonContents</tt> - area containing the label (iconsetwith text or pixmap).<li><tt>QStyle::SR_PushButtonFocusRect</tt> - area for the focus rect (usuallylarger than the contents rect).<li><tt>QStyle::SR_CheckBoxIndicator</tt> - area for the state indicator (e.g. check mark).<li><tt>QStyle::SR_CheckBoxContents</tt> - area for the label (text or pixmap).<li><tt>QStyle::SR_CheckBoxFocusRect</tt> - area for the focus indicator.</ul><p> <ul><li><tt>QStyle::SR_RadioButtonIndicator</tt> - area for the state indicator.<li><tt>QStyle::SR_RadioButtonContents</tt> - area for the label.<li><tt>QStyle::SR_RadioButtonFocusRect</tt> - area for the focus indicator.</ul><p> <ul><li><tt>QStyle::SR_ComboBoxFocusRect</tt> - area for the focus indicator.</ul><p> <ul><li><tt>QStyle::SR_SliderFocusRect</tt> - area for the focus indicator.</ul><p> <ul><li><tt>QStyle::SR_DockWindowHandleRect</tt> - area for the tear-off handle.</ul><p> <ul><li><tt>QStyle::SR_ProgressBarGroove</tt> - area for the groove.<li><tt>QStyle::SR_ProgressBarContents</tt> - area for the progress indicator.<li><tt>QStyle::SR_ProgressBarLabel</tt> - area for the text label.</ul><p> <ul><li><tt>QStyle::SR_ToolButtonContents</tt> - area for the tool button's label.</ul><p> <ul><li><tt>QStyle::SR_CustomBase</tt> - base value for custom ControlElements. All values abovethis are reserved for custom use. Therefore, custom values must begreater than this value.</ul><p> <p>See also <a href="#subRect">subRect</a>().<hr><h2>Member Function Documentation</h2><h3 class=fn><a name="QStyle"></a>QStyle::QStyle ()</h3>Constructs a QStyle.<h3 class=fn><a name="~QStyle"></a>QStyle::~QStyle ()<tt> [virtual]</tt></h3>Destroys the style and frees all allocated resources.<h3 class=fn>int <a name="defaultFrameWidth"></a>QStyle::defaultFrameWidth () const</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> <h3 class=fn>void <a name="drawComplexControl"></a>QStyle::drawComplexControl ( <a href="qstyle.html#ComplexControl-enum">ComplexControl</a> control, <a href="qpainter.html">QPainter</a> * p, const <a href="qwidget.html">QWidget</a> * widget, const <a href="qrect.html">QRect</a> & r, const <a href="qcolorgroup.html">QColorGroup</a> & cg, SFlags how = Style_Default, SCFlags sub = SC_All, SCFlags subActive = SC_None, const <a href="qstyleoption.html">QStyleOption</a> & opt = QStyleOption::Default ) const<tt> [pure virtual]</tt></h3><p> Draws the ComplexControl <em>control</em> using the painter <em>p</em> in thearea <em>r</em>. Colors are used from the color group <em>cg</em>. The <em>sub</em>argument specifies which SubControls to draw. Multiple SubControlscan be OR'ed together. The <em>subActive</em> argument specifies whichSubControl is active.<p> The rect <em>r</em> should be in logical coordinates. Reimplementationsof this function should use <a href="#visualRect">visualRect</a>() to change the logicalcoordinates into screen coordinates when using <a href="#drawPrimitive">drawPrimitive</a>() and<a href="#drawControl">drawControl</a>().<p> The <em>how</em> argument is used to control how the ComplexControl isdrawn. Multiple flags can OR'ed together. See the table below foran explanation of which flags are used with the variousComplexControls.<p> The <em>widget</em> argument is a pointer to a <a href="qwidget.html">QWidget</a> or one of itssubclasses. The widget can be cast to the appropriate type basedon the value of <em>control</em>. The <em>opt</em> argument can be used topass extra information required when drawing the ComplexControl.Note that <em>opt</em> may be the default value even for ComplexControlsthat can make use of the extra options. See the table below forthe appropriate <em>widget</em> and <em>opt</em> usage:<p> <center><table cellpadding="4" cellspacing="2" border="0"><tr bgcolor="#a2c511"> <th valign="top">ComplexControl & Widget Cast<th valign="top">Style Flags<th valign="top">Notes<th valign="top">Options<th valign="top">Notes<tr bgcolor="#f0f0f0"> <td valign="top" colspan="1" rowspan="2"> <a href="#ComplexControl-enum">CC_SpinWidget</a>(const QSpinWidget *)<td valign="top"><a href="#StyleFlags-enum">Style_Enabled</a> <td valign="top">Set if the spinwidget is enabled.<td valign="top" colspan="1" rowspan="2"> Unused.<td valign="top" colspan="1" rowspan="2"> <tr bgcolor="#f0f0f0"> <td valign="top"><a href="#StyleFlags-enum">Style_HasFocus</a> <td valign="top">Set if the spinwidget has input focus.<tr bgcolor="#d0d0d0"> <td valign="top" colspan="1" rowspan="2"> <a href="#ComplexControl-enum">CC_ComboBox</a>(const <a href="qcombobox.html">QComboBox</a> *)<td valign="top"><a href="#StyleFlags-enum">Style_Enabled</a> <td valign="top">Set if the combobox is enabled.<td valign="top" colspan="1" rowspan="2"> Unused.<td valign="top" colspan="1" rowspan="2"> <tr bgcolor="#d0d0d0"> <td valign="top"><a href="#StyleFlags-enum">Style_HasFocus</a> <td valign="top">Set if the combobox has input focus.<tr bgcolor="#f0f0f0"> <td valign="top" colspan="1" rowspan="2"> <a href="#ComplexControl-enum">CC_ScrollBar</a>(const <a href="qscrollbar.html">QScrollBar</a> *)<td valign="top"><a href="#StyleFlags-enum">Style_Enabled</a> <td valign="top">Set if the scrollbar is enabled.<td valign="top" colspan="1" rowspan="2"> Unused.<td valign="top" colspan="1" rowspan="2"> <tr bgcolor="#f0f0f0"> <td valign="top"><a href="#StyleFlags-enum">Style_HasFocus</a> <td valign="top">Set if the scrollbar has input focus.<tr bgcolor="#d0d0d0"> <td valign="top" colspan="1" rowspan="2"> <a href="#ComplexControl-enum">CC_Slider</a>(const <a href="qslider.html">QSlider</a> *)<td valign="top"><a href="#StyleFlags-enum">Style_Enabled</a> <td valign="top">Set if the slider is enabled.<td valign="top" colspan="1" rowspan="2"> Unused.<td valign="top" colspan="1" rowspan="2"> <tr bgcolor="#d0d0d0"> <td valign="top"><a href="#StyleFlags-enum">Style_HasFocus</a> <td valign="top">Set if the slider has input focus.<tr bgcolor="#f0f0f0"> <td valign="top" colspan="1" rowspan="6"> <a href="#ComplexControl-enum">CC_ToolButton</a>(const <a href="qtoolbutton.html">QToolButton</a> *)<td valign="top"><a href="#StyleFlags-enum">Style_Enabled</a> <td valign="top">Set if the toolbutton is enabled.<td valign="top" colspan="1" rowspan="6"> <a href="qstyleoption.html">QStyleOption</a> ( <a href="qt.html#ArrowType-enum">ArrowType</a> t )<ul><li> opt.<a href="qstyleoption.html#arrowType">arrowType</a>()</ul><td valign="top" colspan="1" rowspan="6"> When the tool button only contains an arrow, <em>t</em> is thearrow's type.<tr bgcolor="#f0f0f0"> <td valign="top"><a href="#StyleFlags-enum">Style_HasFocus</a> <td valign="top">Set if the toolbutton has input focus.<tr bgcolor="#f0f0f0"> <td valign="top"><a href="#StyleFlags-enum">Style_Down</a> <td valign="top">Set if the toolbutton is down (ie. mousebutton or space pressed).<tr bgcolor="#f0f0f0"> <td valign="top"><a href="#StyleFlags-enum">Style_On</a> <td valign="top">Set if the toolbutton is a toggle buttonand is toggled on.<tr bgcolor="#f0f0f0"> <td valign="top"><a href="#StyleFlags-enum">Style_AutoRaise</a> <td valign="top">Set if the toolbutton has auto-raise enabled.<tr bgcolor="#f0f0f0"> <td valign="top"><a href="#StyleFlags-enum">Style_Raised</a> <td valign="top">Set if the button is not down, not on and doesn'tcontain the mouse when auto-raise is enabled.<tr bgcolor="#d0d0d0"> <td valign="top"><a href="#ComplexControl-enum">CC_TitleBar</a>(const <a href="qwidget.html">QWidget</a> *)<td valign="top"><a href="#StyleFlags-enum">Style_Enabled</a> <td valign="top">Set if the titlebar is enabled.<td valign="top">Unused.<td valign="top"> <tr bgcolor="#f0f0f0"> <td valign="top"><a href="#ComplexControl-enum">CC_ListView</a>(const <a href="qlistview.html">QListView</a> *)<td valign="top"><a href="#StyleFlags-enum">Style_Enabled</a> <td valign="top">Set if the titlebar is enabled.<td valign="top"><a href="qstyleoption.html">QStyleOption</a> ( <a href="qlistviewitem.html">QListViewItem</a> *item )<ul><li> opt.<a href="qstyleoption.html#listViewItem">listViewItem</a>()</ul><td valign="top"><em>item</em> is the item that needs branches drawn</table></center><p> <p>See also <a href="#ComplexControl-enum">ComplexControl</a> and <a href="#SubControl-enum">SubControl</a>.<h3 class=fn>void <a name="drawComplexControlMask"></a>QStyle::drawComplexControlMask ( <a href="qstyle.html#ComplexControl-enum">ComplexControl</a> control, <a href="qpainter.html">QPainter</a> * p, const <a href="qwidget.html">QWidget</a> * widget, const <a href="qrect.html">QRect</a> & r, const <a href="qstyleoption.html">QStyleOption</a> & opt = QStyleOption::Default ) const<tt> [pure virtual]</tt></h3><p> Draw a bitmask for the ComplexControl <em>control</em> using the painter<em>p</em> in the area <em>r</em>. See <a href="#drawComplexControl">drawComplexControl</a>() for an explanationof the use of the <em>widget</em> and <em>opt</em> arguments.<p> The rect <em>r</em> should be in logical coordinates. Reimplementationsof this function should use <a href="#visualRect">visualRect</a>() to change the logicalcorrdinates into screen coordinates when using <a href="#drawPrimitive">drawPrimitive</a>() and<a href="#drawControl">drawControl</a>().<p> <p>See also <a href="#drawComplexControl">drawComplexControl</a>() and <a href="#ComplexControl-enum">ComplexControl</a>.<h3 class=fn>void <a name="drawControl"></a>QStyle::drawControl ( <a href="qstyle.html#ControlElement-enum">ControlElement</a> element, <a href="qpainter.html">QPainter</a> * p, const <a href="qwidget.html">QWidget</a> * widget, const <a href="qrect.html">QRect</a> & r, const <a href="qcolorgroup.html">QColorGroup</a> & cg, SFlags how = Style_Default, const <a href="qstyleoption.html">QStyleOption</a> & opt = QStyleOption::Default ) const<tt> [pure virtual]</tt></h3><p> Draws the ControlElement <em>element</em> using the painter <em>p</em> in thearea <em>r</em>. Colors are used from the color group <em>cg</em>.<p> The rect <em>r</em> should be in screen coordinates.<p> The <em>how</em> argument is used to control how the ControlElement isdrawn. Multiple flags can be OR'ed together. See the table belowfor an explanation of which flags are used with the variousControlElements.<p> The <em>widget</em> argument is a pointer to a <a href="qwidget.html">QWidget</a> or one of itssubclasses. The widget can be cast to the appropriate type basedon the value of <em>element</em>. The <em>opt</em> argument can be used topass extra information required when drawing the ControlElement.Note that <em>opt</em> may be the default value even for ControlElementsthat can make use of the extra options. See the table below forthe appropriate <em>widget</em> and <em>opt</em> usage:<p> <center><table cellpadding="4" cellspacing="2" border="0"><tr bgcolor="#a2c511"> <th valign="top">ControlElement & Widget Cast
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -