Logo Search packages:      
Sourcecode: qt4-x11 version File versions

void QStyle::drawControl ( ControlElement  element,
const QStyleOption option,
QPainter painter,
const QWidget widget = 0 
) const [pure virtual]

Draws the given element with the provided painter with the style options specified by option.

The widget argument is optional and can be used as aid in drawing the control. The option parameter is a pointer to a QStyleOption object that can be casted 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.

Control Element QStyleOption Subclass Style Flag Remark {1,5} CE_MenuItem, CE_MenuBarItem {1,5} QStyleOptionMenuItem State_Selected The menu item is currently selected item. State_Enabled The item is enabled. State_DownArrow Indicates that a scroll down arrow should be drawn. State_UpArrow Indicates that a scroll up arrow should be drawn State_HasFocus Set if the menubar has input focus. {1,5} CE_PushButton, CE_PushButtonBevel, CE_PushButtonLabel {1,5} QStyleOptionButton State_Enabled Set if the button is enabled. State_HasFocus Set if the button has input focus. State_Raised Set if the button is not down, not on and not flat. State_On Set if the button is a toggle button and is toggled on. State_Sunken Set if the button is down (i.e., the mouse button or the space bar is pressed on the button).

{1,6} CE_RadioButton, CE_RadioButtonLabel, CE_CheckBox, CE_CheckBoxLabel {1,6} QStyleOptionButton State_Enabled Set if the button is enabled. State_HasFocus Set if the button has input focus. State_On Set if the button is checked. State_Off Set if the button is not checked. State_NoChange Set if the button is in the NoChange state. State_Sunken Set if the button is down (i.e., the mouse button or the space bar is pressed on the button). {1,2} CE_ProgressBarContents, CE_ProgressBarLabel, CE_ProgressBarGroove {1,2} QStyleOptionProgressBar State_Enabled Set if the progressbar is enabled. State_HasFocus Set if the progressbar has input focus. CE_Header, CE_HeaderSection, CE_HeaderLabel QStyleOptionHeader {1,7} CE_ToolButtonLabel {1,7} QStyleOptionToolButton State_Enabled Set if the tool button is enabled. State_HasFocus Set if the tool button has input focus. State_Sunken Set if the tool button is down (i.e., a mouse button or the space bar is pressed). State_On Set if the tool button is a toggle button and is toggled on. State_AutoRaise Set if the tool button has auto-raise enabled. State_MouseOver Set if the mouse pointer is over the tool button. State_Raised Set if the button is not down and is not on. CE_ToolBoxTab QStyleOptionToolBox State_Selected The tab is the currently selected tab. {1,3} CE_HeaderSection {1,3} QStyleOptionHeader State_Sunken Indicates that the section is pressed. State_UpArrow Indicates that the sort indicator should be pointing up. State_DownArrow Indicates that the sort indicator should be pointing down.

See also:
drawPrimitive(), drawComplexControl()

Implemented in QCDEStyle, QCleanlooksStyle, QCommonStyle, QMotifStyle, QPlastiqueStyle, QWindowsStyle, and QWindowsXPStyle.

Referenced by Q3DockWindow::drawContents(), QStylePainter::drawControl(), Q3IconView::drawRubber(), QSplitterHandle::paintEvent(), QMenuBar::paintEvent(), QDockWidget::paintEvent(), QSizeGrip::paintEvent(), QToolBar::paintEvent(), QListView::paintEvent(), QMenu::paintEvent(), Q3ProgressBar::paintEvent(), Q3Header::paintSection(), QHeaderView::paintSection(), Q3Header::paintSectionLabel(), and Q3ListBox::viewportPaintEvent().


Generated by  Doxygen 1.6.0   Back to index