| Classes - Annotated - Tree - Functions - Home - Structure

# QStyle Class Reference

Encapsulates common Look and Feel of a GUI. More...

`#include <qstyle.h>`

Inherits QObject.

Inherited by QCommonStyle.

List of all member functions.

## Public Members

- virtual ~QStyle ()
- GUIStyle guiStyle () const
- virtual void polish ( QWidget * )
- virtual void unPolish ( QWidget * )
- virtual void polish ( QApplication * )
- virtual void unPolish ( QApplication * )
- virtual void polish ( QPalette & )
- virtual QRect itemRect ( QPainter * p, int x, int y, int w, int h, int flags, bool enabled, const QPixmap * pixmap, const QString & text, int len=-1 )
- virtual void drawItem ( QPainter * p, int x, int y, int w, int h, int flags, const QColorGroup & g, bool enabled, const QPixmap * pixmap, const QString & text, int len=-1, const QColor * penColor = 0 )
- virtual void drawSeparator ( QPainter * p, int x1, int y1, int x2, int y2, const QColorGroup & g, bool sunken = TRUE, int lineWidth = 1, int midLineWidth = 0 )
- virtual void drawRect ( QPainter * p, int x, int y, int w, int h, const QColor &, int lineWidth = 1, const QBrush * fill = 0 )
- virtual void drawRectStrong ( QPainter * p, int x, int y, int w, int h, const QColorGroup &, bool sunken=FALSE, int lineWidth = 1, int midLineWidth = 0, const QBrush * fill = 0 )
- virtual void drawButton ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, bool sunken = FALSE, const QBrush * fill = 0 )
- virtual QRect buttonRect ( int x, int y, int w, int h )
- virtual void drawButtonMask ( QPainter * p, int x, int y, int w, int h )
- virtual void drawBevelButton ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, bool sunken = FALSE, const QBrush * fill = 0 )
- QRect bevelButtonRect ( int x, int y, int w, int h )
- virtual void drawToolButton ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, bool sunken = FALSE, const QBrush * fill = 0 )
- void drawToolButton ( QToolButton * btn, QPainter * p )
- QRect toolButtonRect ( int x, int y, int w, int h )
- virtual void drawPanel ( QPainter * p, int x, int y, int w, int h, const QColorGroup &, bool sunken=FALSE, int lineWidth = 1, const QBrush * fill = 0 )
- virtual void drawPopupPanel ( QPainter * p, int x, int y, int w, int h, const QColorGroup &, int lineWidth = 2, const QBrush * fill = 0 )
- virtual void drawArrow ( QPainter * p, Qt::ArrowType type, bool down, int x, int y, int w, int h, const QColorGroup & g, bool enabled, const QBrush * fill = 0 )
- virtual QSize exclusiveIndicatorSize () const
- virtual void drawExclusiveIndicator ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, bool on, bool down = FALSE, bool enabled = TRUE )
- virtual void drawExclusiveIndicatorMask ( QPainter * p, int x, int y, int w, int h, bool on )
- virtual QSize indicatorSize () const
- virtual void drawIndicator ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, int state, bool down = FALSE, bool enabled = TRUE )
- virtual void drawIndicatorMask ( QPainter * p, int x, int y, int w, int h, int state )
- virtual void drawFocusRect ( QPainter *, const QRect &, const QColorGroup &, const QColor * bg = 0, bool = FALSE )
- virtual void drawComboButton ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, bool sunken = FALSE, bool editable = FALSE, bool enabled = TRUE, const QBrush * fill = 0 )
- virtual QRect comboButtonRect ( int x, int y, int w, int h )
- virtual QRect comboButtonFocusRect ( int x, int y, int w, int h )
- virtual void drawComboButtonMask ( QPainter * p, int x, int y, int w, int h )
- virtual void drawPushButton ( QPushButton * btn, QPainter * p )
- virtual void drawPushButtonLabel ( QPushButton * btn, QPainter * p )
- QRect pushButtonContentsRect ( QPushButton * btn )
- int menuButtonIndicatorWidth ( int h )
- virtual void getButtonShift ( int & x, int & y )
- virtual int defaultFrameWidth () const
- virtual void tabbarMetrics ( const QTabBar *, int &, int &, int & )
- virtual void drawTab ( QPainter *, const QTabBar *, QTab *, bool selected )
- virtual void drawTabMask ( QPainter *, const QTabBar *, QTab *, bool selected )
- enum ScrollControl { AddLine = 0x1, SubLine = 0x2, AddPage = 0x4, SubPage = 0x8, First = 0x10, Last = 0x20, Slider = 0x40, NoScroll = 0x80 }
- virtual void scrollBarMetrics ( const QScrollBar *, int &, int &, int &, int & )
- virtual void drawScrollBarControls ( QPainter *, const QScrollBar *, int sliderStart, uint controls, uint activeControl )
- virtual ScrollControl scrollBarPointOver ( const QScrollBar *, int sliderStart, const QPoint & )
- virtual int sliderLength () const
- virtual void drawSlider ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, Orientation, bool tickAbove, bool tickBelow )
- virtual void drawSliderMask ( QPainter * p, int x, int y, int w, int h, Orientation, bool tickAbove, bool tickBelow )
- virtual void drawSliderGroove ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, QCOORD c, Orientation )
- virtual void drawSliderGrooveMask ( QPainter * p, int x, int y, int w, int h, QCOORD c, Orientation )
- virtual int maximumSliderDragDistance () const
- virtual int splitterWidth () const
- virtual void drawSplitter ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, Orientation )
- virtual void drawCheckMark ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, bool act, bool dis )
- virtual void polishPopupMenu ( QPopupMenu * )
- virtual int extraPopupMenuItemWidth ( bool checkable, int maxpmw, QMenuItem * mi, const QFontMetrics & fm )
- virtual int popupSubmenuIndicatorWidth ( const QFontMetrics & fm )
- virtual int popupMenuItemHeight ( bool checkable, QMenuItem * mi, const QFontMetrics & fm )
- virtual void drawPopupMenuItem ( QPainter * p, bool checkable, int maxpmw, int tab, QMenuItem * mi, const QPalette & pal, bool act, bool enabled, int x, int y, int w, int h )
- void drawMenuBarItem ( QPainter * p, int x, int y, int w, int h, QMenuItem * mi, QColorGroup & g, bool enabled, bool active )
- QSize scrollBarExtent ()
- int buttonDefaultIndicatorWidth () const
- int buttonMargin () const
- int toolBarHandleExtent () const
- int toolBarHandleExtend () const (obsolete)
- int sliderThickness () const
- void drawToolBarHandle ( QPainter * p, const QRect & r, Qt::Orientation orientation, bool highlight, const QColorGroup & cg, bool drawBorder = FALSE )

## Protected Members

- void setScrollBarExtent ( int w, int h=-1 )
- void setButtonDefaultIndicatorWidth ( int w )
- void setButtonMargin ( int w )
- void setSliderThickness ( int t )

## Detailed Description

Encapsulates common Look and Feel of a GUI.

While it is not possible to fully enumerate the look of graphic elements and the feel of widgets in a GUI, a large number of elements are common to many widgets. The QStyle class allows the look of these elements to be modified across all widgets that use the QStyle methods. It also provides two feel options - Motif and Windows.

In previous versions of Qt, the look and feel option for widgets was specified by a single value - the GUIStyle. Starting with Qt 2.0, this notion has been expanded to allow the look to be specified by virtual drawing functions.

Derived classes may reimplement some or all of the drawing functions to modify the look of all widgets which utilize those functions.

Examples: themes/main.cpp

## Member Type Documentation

### QStyle::ScrollControl

This enum type defines :

- `AddLine` - control to scroll one line down, usually an arrow button
- `SubLine` - control to scroll one line up, usually an arrow button
- `AddPage` - control to scroll one page down
- `SubPage` - control to scroll one page up
- `First` - control to scroll to top of the range
- `Last` - control to scroll to bottom of the range
- `Slider` - the slider control
- `NoScroll` - null value, indicates none of the visible controls

## Member Function Documentation

### QStyle::~QStyle () `[virtual]`

Destructs the style.

### QRect QStyle::bevelButtonRect ( int x, int y, int w, int h )

Returns the rectangle available for contents in a bevel button. Usually this is the entire rectangle minus the border, but it may also be smaller when you think about rounded buttons.

See also drawBevelButton().

### int QStyle::buttonDefaultIndicatorWidth () const

Returns the width of the default-button indicator frame.

In this version of the Qt library, subclasses must call setButtonDefaultIndicatorWidth() to change the frame width. In a future version of Qt, this function will become virtual.

### int QStyle::buttonMargin () const

Returns the amount of whitespace between pushbutton labels and the frame in this style.

### QRect QStyle::buttonRect ( int x, int y, int w, int h ) `[virtual]`

Returns the rectangle available for contents in a push button. Usually this is the entire rectangle minus the border, but it may also be smaller when you think about rounded buttons.

See also drawButton().

Reimplemented in QPlatinumStyle.

### QRect QStyle::comboButtonFocusRect ( int x, int y, int w, int h ) `[virtual]`

Returns the rectangle used to draw the the focus rectangle in a combo box.

Reimplemented in QMotifPlusStyle, QMotifStyle, QWindowsStyle, QSGIStyle, QPlatinumStyle and QCommonStyle.

### QRect QStyle::comboButtonRect ( int x, int y, int w, int h ) `[virtual]`

Returns the rectangle available for contents in a combo box button. Usually this is the entire rectangle without the nifty menu indicator, but it may also be smaller when you think about rounded buttons.

Reimplemented in QInterlaceStyle, QSGIStyle, QCommonStyle, QMotifStyle, QPlatinumStyle, QWindowsStyle and QMotifPlusStyle.

### int QStyle::defaultFrameWidth () const `[virtual]`

The default frame width, usually 2.

Reimplemented in QSGIStyle, QMotifPlusStyle, QCDEStyle and QCommonStyle.

### void QStyle::drawArrow ( QPainter * p, Qt::ArrowType type, bool down, int x, int y, int w, int h, const QColorGroup & g, bool enabled, const QBrush * fill = 0 ) `[virtual]`

Draws an arrow to indicate direction. Used for example in scrollbars and spin-boxes.

### void QStyle::drawBevelButton ( QPainter *, int, int, int, int, const QColorGroup &, bool = FALSE, const QBrush * = 0 ) `[virtual]`

Draws a press-sensitive shape in the style of a bevel button.

See also bevelButtonRect().

Reimplemented in QMotifStyle, QMotifPlusStyle, QPlatinumStyle, QWindowsStyle, QSGIStyle and QInterlaceStyle.

### void QStyle::drawButton ( QPainter *, int, int, int, int, const QColorGroup &, bool = FALSE, const QBrush * = 0 ) `[virtual]`

Draws a press-sensitive shape in the style of a full featured push button

See also buttonRect().

Reimplemented in QPlatinumStyle, QInterlaceStyle, QWindowsStyle, QMotifPlusStyle, QSGIStyle and QMotifStyle.

### void QStyle::drawButtonMask ( QPainter * p, int x, int y, int w, int h ) `[virtual]`

Draw the mask of a pushbutton. Useful if a rounded pushbuttons needs to be transparent because the style uses a fancy background pixmap.

See also drawButtonMask().

### void QStyle::drawCheckMark ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, bool act, bool dis ) `[virtual]`

Draws a checkmark suitable for checkboxes and checkable menu items.

Reimplemented in QSGIStyle, QWindowsStyle, QMotifStyle and QPlatinumStyle.

### void QStyle::drawComboButton ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, bool sunken = FALSE, bool editable = FALSE, bool enabled = TRUE, const QBrush * fill = 0 ) `[virtual]`

Draws a press-sensitive shape in the style of a combo box or menu button.

Reimplemented in QMotifPlusStyle, QInterlaceStyle, QPlatinumStyle, QWindowsStyle, QMotifStyle, QCommonStyle and QSGIStyle.

### void QStyle::drawComboButtonMask ( QPainter * p, int x, int y, int w, int h ) `[virtual]`

Draw the mask of a combo box button. Useful if a rounded buttons needs to be transparent because the style uses a fancy background pixmap.

Reimplemented in QCommonStyle.

### void QStyle::drawExclusiveIndicator ( QPainter *, int x, int y, int w, int h, const QColorGroup &, bool on, bool down = FALSE, bool enabled = TRUE ) `[virtual]`

Draws a mark indicating the state of an exclusive choice.

Reimplemented in QSGIStyle, QMotifPlusStyle, QMotifStyle, QPlatinumStyle, QInterlaceStyle, QWindowsStyle and QCDEStyle.

### void QStyle::drawExclusiveIndicatorMask ( QPainter * p, int x, int y, int w, int h, bool ) `[virtual]`

Draws the mask of a mark indicating the state of an exclusive choice.

Reimplemented in QMotifStyle, QInterlaceStyle, QSGIStyle and QWindowsStyle.

### void QStyle::drawFocusRect ( QPainter * p, const QRect & r, const QColorGroup & g, const QColor * = 0, bool atBorder = FALSE ) `[virtual]`

Draws a mark indicating keyboard focus is on r. atBorder indicates whether the focus rectangle is at the border of an item (for example an item in a listbox). Certain styles (Motif style as the most prominent example) might have to shrink the rectangle a bit in that case to ensure that the focus rectangle is visible at all.

Reimplemented in QWindowsStyle, QInterlaceStyle and QMotifStyle.

### void QStyle::drawIndicator ( QPainter *, int, int, int, int, const QColorGroup &, int state, bool = FALSE, bool = TRUE ) `[virtual]`

Draws a mark indicating the state of a choice.

Reimplemented in QCDEStyle, QInterlaceStyle, QSGIStyle, QMotifStyle, QPlatinumStyle, QWindowsStyle and QMotifPlusStyle.

### void QStyle::drawIndicatorMask ( QPainter * p, int x, int y, int w, int h, int ) `[virtual]`

Draws the mask of a mark indicating the state of a choice.

Reimplemented in QInterlaceStyle, QPlatinumStyle and QSGIStyle.

### void QStyle::drawItem ( QPainter * p, int x, int y, int w, int h, int flags, const QColorGroup & g, bool enabled, const QPixmap * pixmap, const QString & text, int len=-1, const QColor * penColor = 0 ) `[virtual]`

Draw text or a pixmap in an area.

### void QStyle::drawPanel ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, bool sunken=FALSE, int lineWidth = 1, const QBrush * fill = 0 ) `[virtual]`

Draws a panel to separate parts of the visual interface.

Reimplemented in QSGIStyle, QMotifPlusStyle, QInterlaceStyle and QWindowsStyle.

### void QStyle::drawPopupMenuItem ( QPainter * p, bool checkable, int maxpmw, int tab, QMenuItem * mi, const QPalette & pal, bool act, bool enabled, int x, int y, int w, int h ) `[virtual]`

Draws the menu item mi using the painter p. The painter is preset to the right font. maxpmw is the maximum width of all iconsets within a check column. tab specifies the minimum number of pixels necessary to draw all labels of the menu without their accelerators (which are separated by a tab character in the label text). pal is the palette, act and enabled define whether the item is active (i.e. highlighted) or enabled, respectively. Finally, x, y, w and h determine the geometry of the entire item.

Note that mi can be 0 in the case of multicolumn popup menus. In that case, drawPopupMenuItem() simply draws the appropriate item background.

Reimplemented in QMotifPlusStyle, QSGIStyle, QMotifStyle, QPlatinumStyle and QWindowsStyle.

### void QStyle::drawPopupPanel ( QPainter * p, int x, int y, int w, int h, const QColorGroup & cg, int lineWidth = 2, const QBrush * fill = 0 ) `[virtual]`

Draws a panel suitable as frame for popup windows.

Reimplemented in QWindowsStyle, QPlatinumStyle and QSGIStyle.

### void QStyle::drawPushButton ( QPushButton *, QPainter * ) `[virtual]`

Draws a pushbutton. This function will normally call drawButton() with arguments according to the current state of the pushbutton.

See also drawPushButtonLabel() and QPushButton::drawButton().

Reimplemented in QSGIStyle, QMotifPlusStyle, QInterlaceStyle, QPlatinumStyle, QMotifStyle and QWindowsStyle.

### void QStyle::drawPushButtonLabel ( QPushButton *, QPainter * ) `[virtual]`

Draws the label of a pushbutton. This function will normally call drawItem() with arguments according to the current state of the pushbutton.

In reimplementations of this function, you will find pushButtonContentsRect() useful.

See also drawPushButton() and QPushButton::drawButtonLabel().

Reimplemented in QPlatinumStyle, QCommonStyle and QInterlaceStyle.

### void QStyle::drawRect ( QPainter * p, int x, int y, int w, int h, const QColor & c, int lineWidth = 1, const QBrush * fill = 0 ) `[virtual]`

Draws a simple rectangle to separate parts of the visual interface.

### void QStyle::drawRectStrong ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, bool sunken=FALSE, int lineWidth = 1, int midLineWidth = 0, const QBrush * fill = 0 ) `[virtual]`

Draws an emphasized rectangle to strongly separate parts of the visual interface.

### void QStyle::drawScrollBarControls ( QPainter *, const QScrollBar *, int sliderStart, uint controls, uint activeControl ) `[virtual]`

Draws the given scrollbar. Used internally by QScrollbar.

The controls are either ADD_LINE, SUB_LINE, ADD_PAGE, SUB_PAGE, FIRST, LAST, SLIDER or NONE

Controls is a combination of these, activeControl is the control currently pressed down.

Reimplemented in QSGIStyle, QPlatinumStyle, QWindowsStyle, QInterlaceStyle, QMotifPlusStyle and QMotifStyle.

### void QStyle::drawSeparator ( QPainter * p, int x1, int y1, int x2, int y2, const QColorGroup & g, bool sunken = TRUE, int lineWidth = 1, int midLineWidth = 0 ) `[virtual]`

Draws a line to separate parts of the visual interface.

Reimplemented in QSGIStyle.

### void QStyle::drawSlider ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, Orientation, bool tickAbove, bool tickBelow ) `[virtual]`

Draws a slider.

Reimplemented in QMotifStyle, QInterlaceStyle, QPlatinumStyle, QWindowsStyle, QSGIStyle and QMotifPlusStyle.

### void QStyle::drawSliderGroove ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, QCOORD c, Orientation ) `[virtual]`

Draws a slider groove.

Reimplemented in QInterlaceStyle, QMotifPlusStyle, QMotifStyle, QWindowsStyle, QPlatinumStyle and QSGIStyle.

### void QStyle::drawSliderGrooveMask ( QPainter * p, int x, int y, int w, int h, QCOORD c, Orientation ) `[virtual]`

Draws the mask of a slider groove.

Reimplemented in QCommonStyle, QInterlaceStyle and QSGIStyle.

### void QStyle::drawSliderMask ( QPainter * p, int x, int y, int w, int h, Orientation, bool, bool ) `[virtual]`

Draws the mask of a slider.

Reimplemented in QWindowsStyle, QSGIStyle, QCommonStyle, QPlatinumStyle and QInterlaceStyle.

### void QStyle::drawSplitter ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, Orientation orient ) `[virtual]`

Draws a splitter handle in the rectangle described by x, y, w, h using painter p and color group g. The orientation is orient.

See also splitterWidth().

Reimplemented in QWindowsStyle, QSGIStyle, QMotifStyle and QInterlaceStyle.

### void QStyle::drawToolBarHandle ( QPainter * p, const QRect & r, Qt::Orientation orientation, bool highlight, const QColorGroup & cg, bool drawBorder = FALSE )

Draws the handle for the toolbar using the painter p with the toolbar coordinates r. orientation gives the orientation of the toolbar, and the handle is drawn highlighted if highlight is TRUE, else not. cg is the QColorGroup of the toolbar and if drawBorder is TRUE a border around the handle may be drawn.

WARNING: Because of binary compatibility this method is NOT virtual, so reimplementing it in Qt 2.x doesn't make sense. In the next major release this method will become virtual!.

### void QStyle::drawToolButton ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, bool sunken = FALSE, const QBrush * fill = 0 ) `[virtual]`

Draws a press-sensitive shape in the style of a toolbar button

The default implementation calls drawBevelButton()

See also drawBevelButton().

### void QStyle::drawToolButton ( QToolButton *, QPainter * )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Draws a toolbutton. This function will normally call drawToolButton() with arguments according to the current state of the toolbutton.

See also QToolButton::drawButton().

### QSize QStyle::exclusiveIndicatorSize () const `[virtual]`

Returns the size of the mark used to indicate exclusive choice.

Reimplemented in QSGIStyle, QInterlaceStyle, QWindowsStyle, QMotifPlusStyle, QPlatinumStyle and QMotifStyle.

### int QStyle::extraPopupMenuItemWidth ( bool checkable, int maxpmw, QMenuItem * mi, const QFontMetrics & fm ) `[virtual]`

Returns the extra width of a menu item mi, that means all extra pixels besides the space the menu item text requires. checkable defines, whether the menu has a check column. maxpmw is the maximum width of all iconsets within a check column and fm defines the font metrics used to draw the label. This is particularly useful to calculate a suitable size for a submenu indicator or the column separation, including the tab column used to indicate item accelerators.

Reimplemented in QMotifStyle, QPlatinumStyle and QWindowsStyle.

### void QStyle::getButtonShift ( int & x, int & y ) `[virtual]`

Some GUI styles shift the contents of a button when the button is down. The default implementation returns 0 for both x and y.

Reimplemented in QWindowsStyle, QPlatinumStyle, QMotifPlusStyle and QCommonStyle.

### GUIStyle QStyle::guiStyle () const

Returns an indicator to the additional "feel" component of a style. Current supported values are Qt::WindowsStyle and Qt::MotifStyle.

### QSize QStyle::indicatorSize () const `[virtual]`

Returns the size of the mark used to indicate choice.

Reimplemented in QMotifPlusStyle, QPlatinumStyle, QMotifStyle, QSGIStyle, QInterlaceStyle and QWindowsStyle.

### QRect QStyle::itemRect ( QPainter * p, int x, int y, int w, int h, int flags, bool enabled, const QPixmap * pixmap, const QString & text, int len=-1 ) `[virtual]`

Returns the appropriate area within a rectangle in which to draw text or a pixmap.

### int QStyle::maximumSliderDragDistance () const `[virtual]`

Some feels require the scrollbar or other sliders to jump back to the original position when the mouse pointer is too far away while dragging.

This behavior can be customized with this function. The default is -1 (no jump back) while Windows requires 20 (weird jump back).

Reimplemented in QPlatinumStyle, QCommonStyle and QWindowsStyle.

### int QStyle::menuButtonIndicatorWidth ( int h )

Returns the width of the menu button indicator for a given button height h.

### void QStyle::polish ( QApplication * ) `[virtual]`

Late initialization of the QApplication object.

See also unPolish(QApplication*).

### void QStyle::polish ( QPalette & ) `[virtual]`

The style may have certain requirements for color palettes. In this function it has the chance to change the palette according to these requirements.

See also QPalette and QApplication::setPalette().

### void QStyle::polish ( QWidget * ) `[virtual]`

Initializes the appearance of a widget.

This function is called for every widget, after it has been fully created just before it is shown the very first time.

Reasonable actions in this function might be to set the of the widget and the background pixmap, for example. Unreasonable use would be setting the geometry!

The QWidget::inherits() function may provide enough information to allow class-specific customizations. But be careful not to hard-code things too much, as new QStyle sub-classes will be expected to work reasonably with all current and future widgets.

See also unPolish(QWidget*).

Reimplemented in QMotifStyle, QInterlaceStyle, QMotifPlusStyle and QSGIStyle.

### void QStyle::polishPopupMenu ( QPopupMenu * p ) `[virtual]`

Polishes the popup menu p according to the GUI style. This is usually means setting the mouse tracking ( QPopupMenu::setMouseTracking() ) and whether the menu is checkable by default ( QPopupMenu::setCheckable() ).

Reimplemented in QWindowsStyle, QMotifStyle, QPlatinumStyle and QMotifPlusStyle.

### int QStyle::popupMenuItemHeight ( bool checkable, QMenuItem * mi, const QFontMetrics & fm ) `[virtual]`

Returns the height of the menu item mi. checkable defines, whether the menu has a check column, fm defines the font metrics used to draw the label.

Reimplemented in QWindowsStyle, QSGIStyle, QPlatinumStyle and QMotifStyle.

### int QStyle::popupSubmenuIndicatorWidth ( const QFontMetrics & fm ) `[virtual]`

Returns the width of the arrow indicating popup submenus. fm defines the font metrics used to draw the popup menu.

Reimplemented in QCommonStyle.

### QRect QStyle::pushButtonContentsRect ( QPushButton * btn )

Auxiliary function to return the contents rectangle of a push button btn. The contents rectangle is the space available for the button label.

The result depends on the look (buttonRect() ), whether the button needs space for a default indicator (buttonDefaultIndicatorWidth()) and whether it is pushed down and needs to be shifted (getButtonShift()).

### QSize QStyle::scrollBarExtent ()

Returns a QSize containing the width of a vertical scrollbar and the height of a horizontal scrollbar in this style.

In this version of the Qt library, subclasses must call setScrollBarExtent() to change the extent of scrollbars. In a future version of Qt, this function will become virtual.

### void QStyle::scrollBarMetrics ( const QScrollBar *, int &, int &, int &, int & ) `[virtual]`

Returns the metrics of the passed scrollbar: sliderMin, sliderMax, sliderLength and buttonDim.

Reimplemented in QPlatinumStyle, QMotifStyle, QMotifPlusStyle, QSGIStyle, QWindowsStyle and QInterlaceStyle.

### QStyle::ScrollControl QStyle::scrollBarPointOver( const QScrollBar * sb, int sliderStart, const QPoint & p )

Returns the scrollbar control under the passed point.

### void QStyle::setButtonDefaultIndicatorWidth ( int w ) `[protected]`

Sets the width of the default-button indicator frame.

In a future version of the Qt library, this function will be removed and subclasses will be able to reimplement buttonDefaultIndicatorWidth().

### void QStyle::setButtonMargin ( int m ) `[protected]`

Sets the button margin.

In a future version of the Qt library, this function may be removed and subclasses will be able to reimplement buttonMargin().

### void QStyle::setScrollBarExtent ( int width, int height=-1 ) `[protected]`

Sets the width of a vertical scrollbar in this style to width and the height of a horizontal scrollbar to height. If height is negative, width will be used for both extents. By default both extents are 16 pixels.

In a future version of the Qt library, this function will be removed and subclasses will be able to reimplement scrollBarExtent().

### void QStyle::setSliderThickness ( int t ) `[protected]`

Sets the slider thickness.

In a future version of the Qt library, this function may be removed and subclasses will be able to reimplement sliderThickness().

### int QStyle::sliderLength () const `[virtual]`

The length of a slider.

Reimplemented in QPlatinumStyle, QWindowsStyle and QMotifStyle.

### int QStyle::sliderThickness () const

Returns the thickness of a slider in this style. The thickness is dimension perpendicular to the slider motion (e.g. the height for a horizontal slider).

### int QStyle::splitterWidth () const `[virtual]`

Returns the width of a splitter handle.

See also drawSplitter().

Reimplemented in QMotifStyle, QSGIStyle, QWindowsStyle and QInterlaceStyle.

### int QStyle::toolBarHandleExtend () const

This function is obsolete. It is provided to keep old source working, and will probably be removed in a future version of Qt. We strongly advise against using it in new code.

### int QStyle::toolBarHandleExtent () const

Returns the extent (height or width depending on the orientation) which a toolbar handle has.

WARNING: Because of binary compatibility this method is NOT virtual, so reimplementing it in Qt 2.x doesn't make sense. In the next major release this method will become virtual!.

### QRect QStyle::toolButtonRect ( int x, int y, int w, int h )

Returns the rectangle available for contents in a tool button. Usually this is the entire rectangle minus the border, but it may also be smaller when you think about rounded buttons.

The default implementation returns bevelButtonRect()

See also drawToolButton().

### void QStyle::unPolish ( QApplication * ) `[virtual]`

Redo the application polish

See also polish(QApplication*).

### void QStyle::unPolish ( QWidget * ) `[virtual]`

Undoes the initialization of a widget's appearance.

This function is the counterpart to polish. Is is called for every polished widget when the style is dynamically changed. The former style has to un-polish its settings before the new style can polish them again.

See also polish(QWidget*).

Reimplemented in QMotifPlusStyle, QInterlaceStyle and QSGIStyle.

Search the documentation, FAQ, qt-interest archive and more (uses www.trolltech.com):

This file is part of the Qt toolkit, copyright © 1995-2000 Trolltech, all rights reserved.