📄 qstyle.cpp
字号:
This enum describes flags that are used when drawing primitive elements. Note that not all primitives use all of these flags, and that the flags may mean different things to different items. \value State_None \value State_Active \value State_AutoRaise \value State_Bottom \value State_Children \value State_DownArrow \value State_Editing \value State_Enabled \value State_FocusAtBorder \value State_HasEditFocus \value State_HasFocus \value State_Horizontal \value State_Item \value State_KeyboardFocusChange \value State_Mini \value State_MouseOver \value State_NoChange \value State_Off \value State_On \value State_Open \value State_Raised \value State_ReadOnly \value State_Selected \value State_Sibling \value State_Small \value State_Sunken \value State_Top \value State_UpArrow \value State_Window \omitvalue State_Default \sa drawPrimitive()*//*! \fn void QStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, \ QPainter *painter, const QWidget *widget) const Draws the given primitive \a element with the provided \a painter using the style options specified by \a option. The \a widget argument is optional and may contain a widget that may aid in drawing the primitive element. The table below is listing the primitive elements and their associated style option subclasses. The style options contain all the parameters required to draw the elements, including QStyleOption::state which holds the style flags that are used when drawing. The table also describes which flags that are set when casting the given option to the appropriate subclass. Note that if a primitive element is not listed here, it is because it uses a plain QStyleOption object. \table \header \o Primitive Element \o QStyleOption Subclass \o Style Flag \o Remark \row \o \l PE_FrameFocusRect \o \l QStyleOptionFocusRect \o \l State_FocusAtBorder \o Whether the focus is is at the border or inside the widget. \row \o{1,2} \l PE_IndicatorCheckBox \o{1,2} \l QStyleOptionButton \o \l State_NoChange \o Indicates a "tri-state" checkbox. \row \o \l State_On \o Indicates the indicator is checked. \row \o \l PE_IndicatorRadioButton \o \l QStyleOptionButton \o \l State_On \o Indicates that a radio button is selected. \row \o{1,3} \l PE_Q3CheckListExclusiveIndicator, \l PE_Q3CheckListIndicator \o{1,3} \l QStyleOptionQ3ListView \o \l State_On \o Indicates whether or not the controller is selected. \row \o \l State_NoChange \o Indicates a "tri-state" controller. \row \o \l State_Enabled \o Indicates the controller is enabled. \row \o{1,4} \l PE_IndicatorBranch \o{1,4} \l QStyleOption \o \l State_Children \o Indicates that the control for expanding the tree to show child items, should be drawn. \row \o \l State_Item \o Indicates that a horizontal branch (to show a child item), should be drawn. \row \o \l State_Open \o Indicates that the tree branch is expanded. \row \o \l State_Sibling \o Indicates that a vertical line (to show a sibling item), should be drawn. \row \o \l PE_IndicatorHeaderArrow \o \l QStyleOptionHeader \o \l State_UpArrow \o Indicates that the arrow should be drawn up; otherwise it should be down. \row \o \l PE_FrameGroupBox, \l PE_Frame, \l PE_FrameLineEdit, \l PE_FrameMenu, \l PE_FrameDockWidget \o \l QStyleOptionFrame \o \l State_Sunken \o Indicates that the Frame should be sunken. \row \o \l PE_IndicatorToolBarHandle \o \l QStyleOption \o \l State_Horizontal \o Indicates that the window handle is horizontal instead of vertical. \row \o \l PE_Q3DockWindowSeparator \o \l QStyleOption \o \l State_Horizontal \o Indicates that the separator is horizontal instead of vertical. \row \o \l PE_IndicatorSpinPlus, \l PE_IndicatorSpinMinus, \l PE_IndicatorSpinUp, \l PE_IndicatorSpinDown, \o \l QStyleOptionSpinBox \o \l State_Sunken \o Indicates that the button is pressed. \endtable \sa drawComplexControl(), drawControl()*//*! \enum QStyle::ControlElement This enum represents a control element. A control element is a part of a widget that performs some action or displays information to the user. \value CE_PushButton A QPushButton, draws CE_PushButtonBevel, CE_PushButtonLabel and PE_FrameFocusRect. \value CE_PushButtonBevel The bevel and default indicator of a QPushButton. \value CE_PushButtonLabel The label (an icon with text or pixmap) of a QPushButton. \value CE_DockWidgetTitle Dock window title. \value CE_Splitter Splitter handle; see also QSplitter. \value CE_CheckBox A QCheckBox, draws a PE_IndicatorCheckBox, a CE_CheckBoxLabel and a PE_FrameFocusRect. \value CE_CheckBoxLabel The label (text or pixmap) of a QCheckBox. \value CE_RadioButton A QRadioButton, draws a PE_IndicatorRadioButton, a CE_RadioButtonLabel and a PE_FrameFocusRect. \value CE_RadioButtonLabel The label (text or pixmap) of a QRadioButton. \value CE_TabBarTab The tab and label within a QTabBar. \value CE_TabBarTabShape The tab shape within a tab bar. \value CE_TabBarTabLabel The label within a tab. \value CE_ProgressBar A QProgressBar, draws CE_ProgressBarGroove, CE_ProgressBarContents and CE_ProgressBarLabel. \value CE_ProgressBarGroove The groove where the progress indicator is drawn in a QProgressBar. \value CE_ProgressBarContents The progress indicator of a QProgressBar. \value CE_ProgressBarLabel The text label of a QProgressBar. \value CE_ToolButtonLabel A tool button's label. \value CE_MenuBarItem A menu item in a QMenuBar. \value CE_MenuBarEmptyArea The empty area of a QMenuBar. \value CE_MenuItem A menu item in a QMenu. \value CE_MenuScroller Scrolling areas in a QMenu when the style supports scrolling. \value CE_MenuTearoff A menu item representing the tear off section of a QMenu. \value CE_MenuEmptyArea The area in a menu without menu items. \value CE_MenuHMargin The horizontal extra space on the left/right of a menu. \value CE_MenuVMargin The vertical extra space on the top/bottom of a menu. \value CE_Q3DockWindowEmptyArea The empty area of a QDockWidget. \value CE_ToolBoxTab The toolbox's tab and label within a QToolBox. \value CE_SizeGrip Window resize handle; see also QSizeGrip. \value CE_Header A header. \value CE_HeaderSection A header section. \value CE_HeaderLabel The header's label. \value CE_ScrollBarAddLine Scroll bar line increase indicator. (i.e., scroll down); see also QScrollBar. \value CE_ScrollBarSubLine Scroll bar line decrease indicator (i.e., scroll up). \value CE_ScrollBarAddPage Scolllbar page increase indicator (i.e., page down). \value CE_ScrollBarSubPage Scroll bar page decrease indicator (i.e., page up). \value CE_ScrollBarSlider Scroll bar slider. \value CE_ScrollBarFirst Scroll bar first line indicator (i.e., home). \value CE_ScrollBarLast Scroll bar last line indicator (i.e., end). \value CE_RubberBand Rubber band used in for example an icon view. \value CE_FocusFrame Focus frame that is style controlled. \value CE_CustomBase Base value for custom control elements; custom values must be greater than this value. \value CE_ComboBoxLabel The label of a non-editable QComboBox. \value CE_ToolBar A toolbar like QToolBar. \value CE_ToolBoxTabShape The toolbox's tab shape. \value CE_ToolBoxTabLabel The toolbox's tab label. \value CE_HeaderEmptyArea The area of a header view where there are no header sections. \omitvalue CE_ColumnViewGrip \sa drawControl()*//*! \fn void QStyle::drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const Draws the given \a element with the provided \a painter with the style options specified by \a option. The \a widget argument is optional and can be used as aid in drawing the control. The \a option parameter is a pointer to a QStyleOption object that can be cast to the correct subclass using the qstyleoption_cast() function. The table below is listing the control elements and their associated style option subclass. The style options contain all the parameters required to draw the controls, including QStyleOption::state which holds the style flags that are used when drawing. The table also describes which flags that are set when casting the given option to the appropriate subclass. Note that if a control element is not listed here, it is because it uses a plain QStyleOption object. \table \header \o Control Element \o QStyleOption Subclass \o Style Flag \o Remark \row \o{1,5} \l CE_MenuItem, \l CE_MenuBarItem \o{1,5} \l QStyleOptionMenuItem \o \l State_Selected \o The menu item is currently selected item. \row \o \l State_Enabled \o The item is enabled. \row \o \l State_DownArrow \o Indicates that a scroll down arrow should be drawn. \row \o \l State_UpArrow \o Indicates that a scroll up arrow should be drawn \row \o \l State_HasFocus \o Set if the menu bar has input focus. \row \o{1,5} \l CE_PushButton, \l CE_PushButtonBevel, \l CE_PushButtonLabel \o{1,5} \l QStyleOptionButton \o \l State_Enabled \o Set if the button is enabled. \row \o \l State_HasFocus \o Set if the button has input focus. \row \o \l State_Raised \o Set if the button is not down, not on and not flat. \row \o \l State_On \o Set if the button is a toggle button and is toggled on. \row \o \l State_Sunken \o Set if the button is down (i.e., the mouse button or the space bar is pressed on the button). \row \o{1,6} \l CE_RadioButton, \l CE_RadioButtonLabel, \l CE_CheckBox, \l CE_CheckBoxLabel \o{1,6} \l QStyleOptionButton \o \l State_Enabled \o Set if the button is enabled. \row \o \l State_HasFocus \o Set if the button has input focus. \row \o \l State_On \o Set if the button is checked. \row \o \l State_Off \o Set if the button is not checked. \row \o \l State_NoChange \o Set if the button is in the NoChange state. \row \o \l State_Sunken \o Set if the button is down (i.e., the mouse button or the space bar is pressed on the button). \row \o{1,2} \l CE_ProgressBarContents, \l CE_ProgressBarLabel, \l CE_ProgressBarGroove \o{1,2} \l QStyleOptionProgressBar \o \l State_Enabled \o Set if the progress bar is enabled. \row \o \l State_HasFocus \o Set if the progress bar has input focus. \row \o \l CE_Header, \l CE_HeaderSection, \l CE_HeaderLabel \o \l QStyleOptionHeader \o \o \row \o{1,3} \l CE_TabBarTab, CE_TabBarTabShape, CE_TabBarTabLabel \o{1,3} \l QStyleOptionTab \o \l State_Enabled \o Set if the tab bar is enabled. \row \o \l State_Selected \o The tab bar is the currently selected tab bar. \row \o \l State_HasFocus \o Set if the tab bar tab has input focus. \row \o{1,7} \l CE_ToolButtonLabel \o{1,7} \l QStyleOptionToolButton \o \l State_Enabled \o Set if the tool button is enabled. \row \o \l State_HasFocus \o Set if the tool button has input focus. \row \o \l State_Sunken \o Set if the tool button is down (i.e., a mouse button or the space bar is pressed). \row \o \l State_On \o Set if the tool button is a toggle button and is toggled on. \row \o \l State_AutoRaise \o Set if the tool button has auto-raise enabled. \row \o \l State_MouseOver \o Set if the mouse pointer is over the tool button. \row \o \l State_Raised \o Set if the button is not down and is not on. \row \o \l CE_ToolBoxTab \o \l QStyleOptionToolBox \o \l State_Selected \o The tab is the currently selected tab. \row \o{1,3} \l CE_HeaderSection \o{1,3} \l QStyleOptionHeader \o \l State_Sunken \o Indicates that the section is pressed. \row \o \l State_UpArrow \o Indicates that the sort indicator should be pointing up. \row \o \l State_DownArrow \o Indicates that the sort indicator should be pointing down. \endtable \sa drawPrimitive(), drawComplexControl()*//*! \enum QStyle::SubElement This enum represents a sub-area of a widget. Style implementations use these areas to draw the different parts of a widget. \value SE_PushButtonContents Area containing the label (icon with text or pixmap). \value SE_PushButtonFocusRect Area for the focus rect (usually larger than the contents rect). \value SE_PushButtonLayoutItem Area that counts for the parent layout. \value SE_CheckBoxIndicator Area for the state indicator (e.g., check mark). \value SE_CheckBoxContents Area for the label (text or pixmap). \value SE_CheckBoxFocusRect Area for the focus indicator. \value SE_CheckBoxClickRect Clickable area, defaults to SE_CheckBoxFocusRect. \value SE_CheckBoxLayoutItem Area that counts for the parent layout. \value SE_DateTimeEditLayoutItem Area that counts for the parent layout. \value SE_RadioButtonIndicator Area for the state indicator. \value SE_RadioButtonContents Area for the label. \value SE_RadioButtonFocusRect Area for the focus indicator. \value SE_RadioButtonClickRect Clickable area, defaults to SE_RadioButtonFocusRect. \value SE_RadioButtonLayoutItem Area that counts for the parent layout. \value SE_ComboBoxFocusRect Area for the focus indicator. \value SE_SliderFocusRect Area for the focus indicator. \value SE_SliderLayoutItem Area that counts for the parent layout. \value SE_SpinBoxLayoutItem Area that counts for the parent layout.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -