Qt 4.8
Public Types | Public Functions | Public Variables | Related Functions | List of all members
QStyleOption Class Reference

The QStyleOption class stores the parameters used by QStyle functions. More...

#include <qstyleoption.h>

Inheritance diagram for QStyleOption:
QStyleOptionButton QStyleOptionComplex QStyleOptionDockWidget QStyleOptionFocusRect QStyleOptionFrame QStyleOptionGraphicsItem QStyleOptionHeader QStyleOptionMenuItem QStyleOptionProgressBar QStyleOptionQ3DockWindow QStyleOptionQ3ListViewItem QStyleOptionRubberBand QStyleOptionTab QStyleOptionTabBarBase QStyleOptionTabWidgetFrame QStyleOptionToolBar QStyleOptionToolBox QStyleOptionViewItem

Public Types

enum  OptionType {
  SO_Default, SO_FocusRect, SO_Button, SO_Tab,
  SO_MenuItem, SO_Frame, SO_ProgressBar, SO_ToolBox,
  SO_Header, SO_Q3DockWindow, SO_DockWidget, SO_Q3ListViewItem,
  SO_ViewItem, SO_TabWidgetFrame, SO_TabBarBase, SO_RubberBand,
  SO_ToolBar, SO_GraphicsItem, SO_Complex = 0xf0000, SO_Slider,
  SO_SpinBox, SO_ToolButton, SO_ComboBox, SO_Q3ListView,
  SO_TitleBar, SO_GroupBox, SO_SizeGrip, SO_CustomBase = 0xf00,
  SO_ComplexCustomBase = 0xf000000
}
 This enum is used internally by QStyleOption, its subclasses, and qstyleoption_cast() to determine the type of style option. More...
 
enum  StyleOptionType { Type = SO_Default }
 This enum is used to hold information about the type of the style option, and is defined for each QStyleOption subclass. More...
 
enum  StyleOptionVersion { Version = 1 }
 This enum is used to hold information about the version of the style option, and is defined for each QStyleOption subclass. More...
 

Public Functions

void init (const QWidget *w)
 Use initFrom(widget) instead. More...
 
void initFrom (const QWidget *w)
 
QStyleOptionoperator= (const QStyleOption &other)
 Assign other to this QStyleOption. More...
 
 QStyleOption (int version=QStyleOption::Version, int type=SO_Default)
 Constructs a QStyleOption with the specified version and type. More...
 
 QStyleOption (const QStyleOption &other)
 Constructs a copy of other. More...
 
 ~QStyleOption ()
 Destroys this style option object. More...
 

Public Variables

Qt::LayoutDirection direction
 the text layout direction that should be used when drawing text in the control More...
 
QFontMetrics fontMetrics
 the font metrics that should be used when drawing text in the control More...
 
QPalette palette
 the palette that should be used when painting the control More...
 
QRect rect
 the area that should be used for various calculations and painting More...
 
QStyle::State state
 the style flags that are used when drawing the control More...
 
int type
 the option type of the style option More...
 
int version
 the version of the style option More...
 

Related Functions

(Note that these are not member functions.)

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

Detailed Description

The QStyleOption class stores the parameters used by QStyle functions.

QStyleOption and its subclasses contain all the information that QStyle functions need to draw a graphical element.

For performance reasons, there are few member functions and the access to the member variables is direct (i.e., using the . or -> operator). This low-level feel makes the structures straightforward to use and emphasizes that these are simply parameters used by the style functions.

The caller of a QStyle function usually creates QStyleOption objects on the stack. This combined with Qt's extensive use of implicit sharing for types such as QString, QPalette, and QColor ensures that no memory allocation needlessly takes place.

The following code snippet shows how to use a specific QStyleOption subclass to paint a push button:

void MyPushButton::paintEvent(QPaintEvent *)
{
option.initFrom(this);
if (isDefault())
option.text = text();
option.icon = icon();
QPainter painter(this);
style()->drawControl(QStyle::CE_PushButton, &option, &painter, this);
}

In our example, the control is a QStyle::CE_PushButton, and according to the QStyle::drawControl() documentation the corresponding class is QStyleOptionButton.

When reimplementing QStyle functions that take a QStyleOption parameter, you often need to cast the QStyleOption to a subclass. For safety, you can use qstyleoption_cast() to ensure that the pointer type is correct. For example:

void MyStyle::drawPrimitive(PrimitiveElement element,
const QStyleOption *option,
QPainter *painter,
const QWidget *widget)
{
if (element == PE_FrameFocusRect) {
const QStyleOptionFocusRect *focusRectOption =
if (focusRectOption) {
// ...
}
}
// ...
}

The qstyleoption_cast() function will return 0 if the object to which option points is not of the correct type.

For an example demonstrating how style options can be used, see the widgets/styles{Styles} example.

See also
QStyle, QStylePainter

Definition at line 67 of file qstyleoption.h.

Enumerations

◆ OptionType

This enum is used internally by QStyleOption, its subclasses, and qstyleoption_cast() to determine the type of style option.

In general you do not need to worry about this unless you want to create your own QStyleOption subclass and your own styles.

The following values are used for custom controls:

  • SO_CustomBase Reserved for custom QStyleOptions; all custom controls values must be above this value
  • SO_ComplexCustomBase Reserved for custom QStyleOptions; all custom complex controls values must be above this value

Some style options are defined for various Qt3Support controls:

See also
type
Enumerator
SO_Default 
SO_FocusRect 
SO_Button 
SO_Tab 
SO_MenuItem 
SO_Frame 
SO_ProgressBar 
SO_ToolBox 
SO_Header 
SO_Q3DockWindow 
SO_DockWidget 
SO_Q3ListViewItem 
SO_ViewItem 
SO_TabWidgetFrame 
SO_TabBarBase 
SO_RubberBand 
SO_ToolBar 
SO_GraphicsItem 
SO_Complex 
SO_Slider 
SO_SpinBox 
SO_ToolButton 
SO_ComboBox 
SO_Q3ListView 
SO_TitleBar 
SO_GroupBox 
SO_SizeGrip 
SO_CustomBase 
SO_ComplexCustomBase 

Definition at line 70 of file qstyleoption.h.

70  {
75 
78 
79  SO_CustomBase = 0xf00,
80  SO_ComplexCustomBase = 0xf000000
81  };

◆ StyleOptionType

This enum is used to hold information about the type of the style option, and is defined for each QStyleOption subclass.

  • Type The type of style option provided (SO_Default for this class).

The type is used internally by QStyleOption, its subclasses, and qstyleoption_cast() to determine the type of style option. In general you do not need to worry about this unless you want to create your own QStyleOption subclass and your own styles.

See also
StyleOptionVersion
Enumerator
Type 

Definition at line 83 of file qstyleoption.h.

◆ StyleOptionVersion

This enum is used to hold information about the version of the style option, and is defined for each QStyleOption subclass.

  • Version 1

The version is used by QStyleOption subclasses to implement extensions without breaking compatibility. If you use qstyleoption_cast(), you normally do not need to check it.

See also
StyleOptionType
Enumerator
Version 

Definition at line 84 of file qstyleoption.h.

Constructors and Destructors

◆ QStyleOption() [1/2]

QStyleOption::QStyleOption ( int  version = QStyleOption::Version,
int  type = SO_Default 
)

Constructs a QStyleOption with the specified version and type.

The version has no special meaning for QStyleOption; it can be used by subclasses to distinguish between different version of the same option type.

The state member variable is initialized to QStyle::State_None.

See also
version, type

Definition at line 167 of file qstyleoption.cpp.

170 {
171 }
int version
the version of the style option
Definition: qstyleoption.h:86
static Qt::LayoutDirection layoutDirection()
int type
the option type of the style option
Definition: qstyleoption.h:87
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
QFontMetrics fontMetrics
the font metrics that should be used when drawing text in the control
Definition: qstyleoption.h:91
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
Qt::LayoutDirection direction
the text layout direction that should be used when drawing text in the control
Definition: qstyleoption.h:89

◆ QStyleOption() [2/2]

QStyleOption::QStyleOption ( const QStyleOption other)

Constructs a copy of other.

Definition at line 249 of file qstyleoption.cpp.

250  : version(Version), type(Type), state(other.state),
251  direction(other.direction), rect(other.rect), fontMetrics(other.fontMetrics),
252  palette(other.palette)
253 {
254 }
int version
the version of the style option
Definition: qstyleoption.h:86
int type
the option type of the style option
Definition: qstyleoption.h:87
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
QFontMetrics fontMetrics
the font metrics that should be used when drawing text in the control
Definition: qstyleoption.h:91
QPalette palette
the palette that should be used when painting the control
Definition: qstyleoption.h:92
Qt::LayoutDirection direction
the text layout direction that should be used when drawing text in the control
Definition: qstyleoption.h:89
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90

◆ ~QStyleOption()

QStyleOption::~QStyleOption ( )

Destroys this style option object.

Definition at line 177 of file qstyleoption.cpp.

178 {
179 }

Functions

◆ init()

void QStyleOption::init ( const QWidget widget)

Use initFrom(widget) instead.

Definition at line 203 of file qstyleoption.cpp.

Referenced by QFrame::drawFrame(), QMenuBar::heightForWidth(), QTabBarPrivate::initStyleBaseOption(), QAbstractScrollAreaPrivate::layoutChildren(), QTabBar::mouseMoveEvent(), QCalendarPopup::mousePressEvent(), QTabBar::mousePressEvent(), QDateTimeEditPrivate::newHoverControl(), QAbstractItemViewPrivate::paintDropIndicator(), QSizeGrip::paintEvent(), QDockWidget::paintEvent(), QDockWidgetTitleButton::paintEvent(), QTipLabel::paintEvent(), QComboBoxPrivateScroller::paintEvent(), QDateTimeEdit::paintEvent(), QHeaderView::paintEvent(), CloseButton::paintEvent(), QTableCornerButton::paintEvent(), QAccessibleToolButton::rect(), QTipLabel::resizeEvent(), QToolBarExtension::setOrientation(), QSizeGrip::sizeHint(), QMenu::sizeHint(), QSplitterHandle::sizeHint(), QMenuPrivate::updateActionRects(), QDateTimeEditPrivate::updateEditFieldGeometry(), and QAbstractItemView::viewOptions().

204 {
205  QWidget *window = widget->window();
207  if (widget->isEnabled())
209  if (widget->hasFocus())
213  if (widget->underMouse())
215  if (window->isActiveWindow())
217  if (widget->isWindow())
219 #ifdef Q_WS_MAC
220  extern bool qt_mac_can_clickThrough(const QWidget *w); //qwidget_mac.cpp
222  state &= ~QStyle::State_Enabled;
223 
224  switch (QMacStyle::widgetSizePolicy(widget)) {
227  break;
228  case QMacStyle::SizeMini:
230  break;
231  default:
232  ;
233  }
234 #endif
235 #ifdef QT_KEYPAD_NAVIGATION
236  if (widget->hasEditFocus())
237  state |= QStyle::State_HasEditFocus;
238 #endif
239 
240  direction = widget->layoutDirection();
241  rect = widget->rect();
242  palette = widget->palette();
243  fontMetrics = widget->fontMetrics();
244 }
QPalette palette
the widget&#39;s palette
Definition: qwidget.h:180
bool isActiveWindow
whether this widget&#39;s window is the active window
Definition: qwidget.h:186
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
bool underMouse() const
Returns true if the widget is under the mouse cursor; otherwise returns false.
Definition: qwidget.h:996
QFontMetrics fontMetrics
the font metrics that should be used when drawing text in the control
Definition: qstyleoption.h:91
bool hasFocus() const
Definition: qwidget.cpp:6583
bool qt_mac_can_clickThrough(const QWidget *)
Definition: qwidget_mac.mm:280
NSWindow * window
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
QFontMetrics fontMetrics() const
Returns the font metrics for the widget&#39;s current font.
Definition: qwidget.h:984
bool isEnabled() const
Definition: qwidget.h:948
Qt::LayoutDirection layoutDirection
the layout direction for this widget
Definition: qwidget.h:216
QPalette palette
the palette that should be used when painting the control
Definition: qstyleoption.h:92
QRect rect
the internal geometry of the widget excluding any window frame
Definition: qwidget.h:168
static WidgetSizePolicy widgetSizePolicy(const QWidget *w)
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI...
Definition: qstyle.h:68
Qt::LayoutDirection direction
the text layout direction that should be used when drawing text in the control
Definition: qstyleoption.h:89
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90

◆ initFrom()

void QStyleOption::initFrom ( const QWidget widget)
inline
Since
4.1

Initializes the state , direction , rect , palette , and fontMetrics member variables based on the specified widget.

This is a convenience function; the member variables can also be initialized manually.

See also
QWidget::layoutDirection(), QWidget::rect(), QWidget::palette(), QWidget::fontMetrics()

Definition at line 99 of file qstyleoption.h.

Referenced by QComboBoxPrivateContainer::comboStyleOption(), QPlastiqueStylePrivate::drawPartialFrame(), QAbstractScrollArea::event(), QMenu::event(), QMdi::ControlLabel::event(), QGridLayoutEngine::fillRowData(), QTextControl::getPaintContext(), QFocusFrame::initStyleOption(), QRadioButton::initStyleOption(), QToolBarSeparator::initStyleOption(), QScrollBar::initStyleOption(), QToolBoxButton::initStyleOption(), QCheckBox::initStyleOption(), QRubberBand::initStyleOption(), QDial::initStyleOption(), QMDIControl::initStyleOption(), QPushButton::initStyleOption(), QGroupBox::initStyleOption(), QSlider::initStyleOption(), QProgressBar::initStyleOption(), QDockWidget::initStyleOption(), QToolButton::initStyleOption(), QToolBar::initStyleOption(), QAbstractSpinBox::initStyleOption(), QTabWidget::initStyleOption(), QMenu::initStyleOption(), QTabBar::initStyleOption(), QHeaderView::initStyleOption(), QLineEdit::initStyleOption(), QWorkspaceTitleBar::initStyleOption(), QComboBox::initStyleOption(), QMdi::ControllerWidget::initStyleOption(), QTreeViewPrivate::itemDecorationRect(), QAbstractScrollArea::minimumSizeHint(), QTabBar::mouseReleaseEvent(), QWidgetPrivate::paintBackground(), QColumnViewGrip::paintEvent(), QStatusBar::paintEvent(), QComboBoxListView::paintEvent(), QMdiSubWindow::paintEvent(), QLabel::paintEvent(), QListView::paintEvent(), QMenu::paintEvent(), QGraphicsView::paintEvent(), QLayoutStyleInfo::QLayoutStyleInfo(), QMdi::SimpleCascader::rearrange(), QAccessibleDoubleSpinBox::rect(), QAccessibleComboBox::rect(), QComboBoxPrivateContainer::resizeEvent(), QGraphicsViewPrivate::rubberBandRegion(), QWidgetPrivate::setLayoutItemMargins(), QLabelPrivate::sizeForWidth(), QMacStyle::sizeFromContents(), QGridLayoutEngine::spacing(), QMdiSubWindowPrivate::titleBarOptions(), and QFramePrivate::updateStyledFrameWidths().

99 { init(w); }
void init(const QWidget *w)
Use initFrom(widget) instead.

◆ operator=()

QStyleOption & QStyleOption::operator= ( const QStyleOption other)

Assign other to this QStyleOption.

Definition at line 259 of file qstyleoption.cpp.

Referenced by QStyleOptionFrameV2::operator=(), QStyleOptionTabWidgetFrameV2::operator=(), QStyleOptionTabBarBaseV2::operator=(), QStyleOptionTabV2::operator=(), QStyleOptionProgressBarV2::operator=(), QStyleOptionDockWidgetV2::operator=(), QStyleOptionViewItemV2::operator=(), QStyleOptionToolBoxV2::operator=(), QStyleOptionDockWidgetV2::QStyleOptionDockWidgetV2(), QStyleOptionFrameV2::QStyleOptionFrameV2(), QStyleOptionFrameV3::QStyleOptionFrameV3(), QStyleOptionTabBarBaseV2::QStyleOptionTabBarBaseV2(), QStyleOptionTabV2::QStyleOptionTabV2(), QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2(), QStyleOptionToolBoxV2::QStyleOptionToolBoxV2(), QStyleOptionViewItemV2::QStyleOptionViewItemV2(), and QStyleOptionViewItemV3::QStyleOptionViewItemV3().

260 {
261  state = other.state;
262  direction = other.direction;
263  rect = other.rect;
264  fontMetrics = other.fontMetrics;
265  palette = other.palette;
266  return *this;
267 }
QStyle::State state
the style flags that are used when drawing the control
Definition: qstyleoption.h:88
QFontMetrics fontMetrics
the font metrics that should be used when drawing text in the control
Definition: qstyleoption.h:91
QPalette palette
the palette that should be used when painting the control
Definition: qstyleoption.h:92
Qt::LayoutDirection direction
the text layout direction that should be used when drawing text in the control
Definition: qstyleoption.h:89
QRect rect
the area that should be used for various calculations and painting
Definition: qstyleoption.h:90

Friends and Related Functions

◆ qstyleoption_cast() [1/2]

T qstyleoption_cast< T > ( const QStyleOption option)
related

Returns a T or 0 depending on the type and version of the given option.

Example:

void MyStyle::drawPrimitive(PrimitiveElement element,
const QStyleOption *option,
QPainter *painter,
const QWidget *widget)
{
if (element == PE_FrameFocusRect) {
const QStyleOptionFocusRect *focusRectOption =
if (focusRectOption) {
// ...
}
}
// ...
}
See also
QStyleOption::type, QStyleOption::version

Definition at line 885 of file qstyleoption.h.

Referenced by QStyleOptionFrameV2::operator=(), QStyleOptionFrameV3::operator=(), QStyleOptionTabBarBaseV2::operator=(), QStyleOptionProgressBarV2::operator=(), QStyleOptionDockWidgetV2::operator=(), QStyleOptionViewItemV2::operator=(), QStyleOptionViewItemV3::operator=(), QStyleOptionToolBoxV2::operator=(), QStyleOptionFrameV2::QStyleOptionFrameV2(), QStyleOptionProgressBarV2::QStyleOptionProgressBarV2(), and QStyleOptionToolBoxV2::QStyleOptionToolBoxV2().

886 {
887  if (opt && opt->version >= static_cast<T>(0)->Version && (opt->type == static_cast<T>(0)->Type
888  || int(static_cast<T>(0)->Type) == QStyleOption::SO_Default
889  || (int(static_cast<T>(0)->Type) == QStyleOption::SO_Complex
890  && opt->type > QStyleOption::SO_Complex)))
891  return static_cast<T>(opt);
892  return 0;
893 }

◆ qstyleoption_cast() [2/2]

T qstyleoption_cast< T > ( QStyleOption option)
related

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

Returns a T or 0 depending on the type of the given option.

Definition at line 896 of file qstyleoption.h.

897 {
898  if (opt && opt->version >= static_cast<T>(0)->Version && (opt->type == static_cast<T>(0)->Type
899  || int(static_cast<T>(0)->Type) == QStyleOption::SO_Default
900  || (int(static_cast<T>(0)->Type) == QStyleOption::SO_Complex
901  && opt->type > QStyleOption::SO_Complex)))
902  return static_cast<T>(opt);
903  return 0;
904 }

Properties

◆ direction

QStyleOption::direction

the text layout direction that should be used when drawing text in the control

By default, the layout direction is Qt::LeftToRight.

See also
initFrom()

Definition at line 89 of file qstyleoption.h.

Referenced by QComboBox::changeEvent(), QItemDelegate::doLayout(), QWindowsVistaStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QMotifStyle::drawComplexControl(), QStyleSheetStyle::drawComplexControl(), QCommonStyle::drawControl(), QWindowsCEStyle::drawControl(), QWindowsVistaStyle::drawControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsXPStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QMacStyle::drawControl(), QStyleSheetStyle::drawControl(), QItemDelegate::drawDecoration(), QItemDelegate::drawDisplay(), QPlastiqueStylePrivate::drawPartialFrame(), QCommonStyle::drawPrimitive(), QWindowsVistaStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QWindowsXPStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QGtkStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QStyleSheetStyle::drawPrimitive(), QMacStylePrivate::getSliderInfo(), init(), QSlider::initStyleOption(), QGraphicsWidget::initStyleOption(), QCommonStylePrivate::isViewItemCached(), QAbstractScrollAreaPrivate::layoutChildren(), operator<<(), operator=(), QFontFamilyDelegate::paint(), QColumnViewDelegate::paint(), QTabBar::paintEvent(), QDecorationStyled::region(), QComboBox::showPopup(), QStyleSheetStyle::sizeFromContents(), QCommonStyle::standardIconImplementation(), QCommonStyle::standardPixmap(), QCommonStyle::styleHint(), QWindowsVistaStyle::subControlRect(), QPlastiqueStyle::subControlRect(), QWindowsXPStyle::subControlRect(), QCleanlooksStyle::subControlRect(), QGtkStyle::subControlRect(), QStyleSheetStyle::subControlRect(), QCommonStyle::subElementRect(), QWindowsVistaStyle::subElementRect(), QPlastiqueStyle::subElementRect(), QWindowsXPStyle::subElementRect(), QCleanlooksStyle::subElementRect(), QWindowsStyle::subElementRect(), QWindowsCEStyle::subElementRect(), QMacStyle::subElementRect(), QMotifStyle::subElementRect(), QGtkStyle::subElementRect(), QStyleSheetStyle::subElementRect(), QCommonStylePrivate::tabLayout(), QDecorationStyled::titleBarHeight(), QStyleSheetStyle::titleBarLayout(), QStyleHelper::uniqueName(), QCommonStylePrivate::viewItemDrawText(), and QCommonStylePrivate::viewItemLayout().

◆ fontMetrics

QStyleOption::fontMetrics

◆ palette

QStyleOption::palette

the palette that should be used when painting the control

By default, the application's default palette is used.

See also
initFrom()

Definition at line 92 of file qstyleoption.h.

Referenced by drawArrow(), QItemDelegate::drawBackground(), QTableViewPrivate::drawCell(), QCommonStyle::drawComplexControl(), QWindowsCEStyle::drawComplexControl(), QPlastiqueStyle::drawComplexControl(), QWindowsMobileStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QWindowsStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QMotifStyle::drawComplexControl(), QStyleSheetStyle::drawComplexControl(), QMacStyle::drawComplexControl(), QWindowsVistaStyle::drawControl(), QCommonStyle::drawControl(), QWindowsCEStyle::drawControl(), QCDEStyle::drawControl(), QWindowsMobileStyle::drawControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsXPStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QMacStyle::drawControl(), QStyleSheetStyle::drawControl(), QItemDelegate::drawDecoration(), QStyleHelper::drawDial(), QItemDelegate::drawDisplay(), QItemDelegate::drawFocus(), QWindowsMobileStylePrivate::drawPanelItemViewSelected(), QPlastiqueStylePrivate::drawPartialFrame(), QWindowsCEStyle::drawPrimitive(), QWindowsVistaStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QCDEStyle::drawPrimitive(), QWindowsXPStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QGtkStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QStyleSheetStyle::drawPrimitive(), QTreeView::drawRow(), QWindowsMobileStylePrivate::drawScrollbarGrip(), QWindowsMobileStylePrivate::drawScrollbarGroove(), QWindowsMobileStylePrivate::drawScrollbarHandleDown(), QWindowsMobileStylePrivate::drawScrollbarHandleUp(), QWindowsMobileStylePrivate::drawTabBarTab(), QWindowsMobileStyle::generatedIconPixmap(), QCommonStyle::generatedIconPixmap(), QTextControl::getPaintContext(), QComboMenuDelegate::getStyleOption(), init(), QMacStylePrivate::initComboboxBdi(), QMacStylePrivate::initHIThemePushButton(), QStyledItemDelegate::initStyleOption(), QGroupBox::initStyleOption(), QMenuBar::initStyleOption(), QMenu::initStyleOption(), QGraphicsWidget::initStyleOption(), QTabBar::initStyleOption(), QMenuBar::minimumSizeHint(), QTabWidget::minimumSizeHint(), operator=(), QDecorationStyled::paint(), QFontFamilyDelegate::paint(), QScriptDebuggerLocalsItemDelegate::paint(), QComboMenuDelegate::paint(), QWellArray::paintCell(), QCommandLinkButton::paintEvent(), QStatusBar::paintEvent(), QComboBoxListView::paintEvent(), QMenuBar::paintEvent(), QLabel::paintEvent(), QListView::paintEvent(), QSplitterHandle::paintEvent(), QMenu::paintEvent(), QTabBar::paintEvent(), QWorkspaceTitleBar::paintEvent(), QWorkspaceChild::paintEvent(), QHeaderView::paintSection(), paintSep(), QGraphicsWidget::paintWindowFrame(), QSvgIconEngine::pixmap(), PixmapEntry::pixmap(), QPixmapIconEngine::pixmap(), qt_cleanlooks_draw_mdibutton(), qt_graphicsItem_highlightSelected(), qt_plastique_draw_frame(), qt_plastique_draw_handle(), qt_plastique_drawFrame(), qt_plastique_drawShadedPanel(), QItemDelegate::setOptions(), QMenuBar::sizeHint(), QWindowsMobileStyle::standardPixmap(), QCommonStyle::styleHint(), QWindowsVistaStyle::styleHint(), QCleanlooksStyle::styleHint(), QMdiSubWindowPrivate::titleBarOptions(), and QStyleHelper::uniqueName().

◆ rect

QStyleOption::rect

the area that should be used for various calculations and painting

This can have different meanings for different types of elements. For example, for a QStyle::CE_PushButton element it would be the rectangle for the entire button, while for a QStyle::CE_PushButtonLabel element it would be just the area for the push button label.

The default value is a null rectangle, i.e. a rectangle with both the width and the height set to 0.

See also
initFrom()

Definition at line 90 of file qstyleoption.h.

Referenced by calcArrow(), QStyleHelper::calcLines(), QStyleHelper::calcRadialPos(), QGroupBoxPrivate::calculateFrame(), QItemDelegate::check(), QItemDelegate::doLayout(), QListModeViewBase::doStaticLayout(), QTableViewPrivate::drawAndClipSpans(), drawArrow(), QItemDelegate::drawBackground(), QTreeView::drawBranches(), QItemDelegate::drawCheck(), QWindowsVistaStyle::drawComplexControl(), QWindowsCEStyle::drawComplexControl(), QCommonStyle::drawComplexControl(), QPlastiqueStyle::drawComplexControl(), QWindowsMobileStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QWindowsStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QMotifStyle::drawComplexControl(), QStyleSheetStyle::drawComplexControl(), QMacStyle::drawComplexControl(), QWindowsVistaStyle::drawControl(), QCommonStyle::drawControl(), QWindowsCEStyle::drawControl(), QCDEStyle::drawControl(), QPlastiqueStyle::drawControl(), QWindowsMobileStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsXPStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QMacStyle::drawControl(), QStyleSheetStyle::drawControl(), QStyleHelper::drawDial(), QItemDelegate::drawFocus(), QFrame::drawFrame(), QWindowsMobileStylePrivate::drawPanelItemViewSelected(), QPlastiqueStylePrivate::drawPartialFrame(), QWindowsCEStyle::drawPrimitive(), QWindowsVistaStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QCDEStyle::drawPrimitive(), QWindowsXPStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QGtkStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QStyleSheetStyle::drawPrimitive(), QTreeView::drawRow(), QWindowsMobileStylePrivate::drawScrollbarGrip(), QWindowsMobileStylePrivate::drawScrollbarGroove(), QWindowsMobileStylePrivate::drawScrollbarHandleDown(), QWindowsMobileStylePrivate::drawScrollbarHandleUp(), QWindowsMobileStylePrivate::drawTabBarTab(), drawTabBase(), drawTabShape(), QTreeView::drawTree(), QItemDelegate::editorEvent(), QAbstractScrollArea::event(), QMacStylePrivate::getSliderInfo(), QComboMenuDelegate::getStyleOption(), QTreeView::indexRowSizeHint(), init(), QMacStylePrivate::initComboboxBdi(), QMacStylePrivate::initHIThemePushButton(), QTabBarPrivate::initStyleBaseOption(), QDockWidget::initStyleOption(), QGraphicsWidget::initStyleOption(), QTabBar::initStyleOption(), QLineEdit::initStyleOption(), QGraphicsItemPrivate::initStyleOption(), QGraphicsWidgetPrivate::initStyleOptionTitleBar(), QCommonStylePrivate::isViewItemCached(), QTreeViewPrivate::itemDecorationRect(), QAbstractScrollAreaPrivate::layoutChildren(), QMenuBar::minimumSizeHint(), QAbstractSpinBox::minimumSizeHint(), QAbstractItemViewPrivate::openEditor(), QAbstractItemView::openPersistentEditor(), operator<<(), operator=(), QDecorationStyled::paint(), QFontFamilyDelegate::paint(), QWindowsVistaTransition::paint(), QColumnViewDelegate::paint(), QWindowsVistaPulse::paint(), QScriptDebuggerLocalsItemDelegate::paint(), QComboMenuDelegate::paint(), QComboBoxDelegate::paint(), QCalendarDelegate::paint(), QTreeViewPrivate::paintAlternatingRowColors(), QWellArray::paintCell(), QAbstractItemViewPrivate::paintDropIndicator(), QStatusBar::paintEvent(), QMenuBar::paintEvent(), QToolBar::paintEvent(), QTableView::paintEvent(), QTabWidget::paintEvent(), QListView::paintEvent(), QSplitterHandle::paintEvent(), QMenu::paintEvent(), QTabBar::paintEvent(), QHeaderView::paintEvent(), QGraphicsView::paintEvent(), QTableCornerButton::paintEvent(), QWorkspaceChild::paintEvent(), QHeaderView::paintSection(), paintSep(), QGraphicsWidget::paintWindowFrame(), QMotifStyle::pixelMetric(), QMacStylePrivate::pushButtonContentBounds(), qt_plastique_drawFrame(), qt_plastique_drawShadedPanel(), QAccessibleAbstractSpinBox::rect(), QItemDelegate::rect(), QAccessibleDoubleSpinBox::rect(), QDecorationStyled::region(), QAbstractItemViewPrivate::renderToPixmap(), QTreeViewPrivate::renderTreeToPixmapForAnimation(), QGraphicsViewPrivate::rubberBandRegion(), QAbstractItemViewPrivate::sendDelegateEvent(), QWidgetPrivate::setLayoutItemMargins(), QTabBarPrivate::setupMovableTab(), QMacStyle::sizeFromContents(), QStyleSheetStyle::sizeFromContents(), QPushButton::sizeHint(), QToolButton::sizeHint(), QMenuBar::sizeHint(), QAbstractSpinBox::sizeHint(), QDateTimeEdit::sizeHint(), QComboMenuDelegate::sizeHint(), QTableView::sizeHintForRow(), QPlastiqueStyle::styleHint(), QCommonStyle::styleHint(), QWindowsVistaStyle::styleHint(), QCleanlooksStyle::styleHint(), QWindowsXPStyle::styleHint(), QWindowsStyle::styleHint(), QMacStyle::styleHint(), QCommonStyle::subControlRect(), QWindowsVistaStyle::subControlRect(), QPlastiqueStyle::subControlRect(), QWindowsXPStyle::subControlRect(), QCleanlooksStyle::subControlRect(), QMotifStyle::subControlRect(), QMacStyle::subControlRect(), QGtkStyle::subControlRect(), QStyleSheetStyle::subControlRect(), QCommonStyle::subElementRect(), QWindowsVistaStyle::subElementRect(), QPlastiqueStyle::subElementRect(), QWindowsXPStyle::subElementRect(), QWindowsStyle::subElementRect(), QWindowsCEStyle::subElementRect(), QMacStyle::subElementRect(), QMotifStyle::subElementRect(), QGtkStyle::subElementRect(), QStyleSheetStyle::subElementRect(), QCommonStylePrivate::tabLayout(), QItemDelegatePrivate::textLayoutBounds(), QDecorationStyled::titleBarHeight(), QMdiSubWindowPrivate::titleBarHeight(), QStyleSheetStyle::titleBarLayout(), QMdiSubWindowPrivate::titleBarOptions(), QAbstractItemView::updateEditorGeometries(), QItemDelegate::updateEditorGeometry(), QMdiSubWindowPrivate::updateMask(), QWorkspaceChild::updateMask(), QFramePrivate::updateStyledFrameWidths(), QCommonStylePrivate::viewItemLayout(), QCommonStylePrivate::viewItemSize(), QListView::viewOptions(), QAbstractItemView::viewOptions(), QGraphicsWidgetPrivate::windowFrameHoverMoveEvent(), and QGraphicsWidgetPrivate::windowFrameMouseReleaseEvent().

◆ state

QStyleOption::state

the style flags that are used when drawing the control

The default value is QStyle::State_None.

See also
initFrom(), QStyle::drawPrimitive(), QStyle::drawControl(), QStyle::drawComplexControl(), QStyle::State

Definition at line 88 of file qstyleoption.h.

Referenced by QTreeViewPrivate::adjustViewOptionsForIndex(), QMacStylePrivate::aquaSizeConstrain(), QItemDelegate::decoration(), drawArrow(), QItemDelegate::drawBackground(), QTreeView::drawBranches(), QTableViewPrivate::drawCell(), QItemDelegate::drawCheck(), QWindowsVistaStyle::drawComplexControl(), QWindowsCEStyle::drawComplexControl(), QCommonStyle::drawComplexControl(), QPlastiqueStyle::drawComplexControl(), QWindowsMobileStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QWindowsStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QMotifStyle::drawComplexControl(), QMacStyle::drawComplexControl(), QWindowsCEStyle::drawControl(), QCommonStyle::drawControl(), QWindowsVistaStyle::drawControl(), QCDEStyle::drawControl(), QPlastiqueStyle::drawControl(), QWindowsMobileStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsXPStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QMacStyle::drawControl(), QStyleSheetStyle::drawControl(), QItemDelegate::drawDecoration(), QStyleHelper::drawDial(), QItemDelegate::drawDisplay(), QItemDelegate::drawFocus(), QFrame::drawFrame(), QWindowsMobileStylePrivate::drawPanelItemViewSelected(), QPlastiqueStylePrivate::drawPartialFrame(), QWindowsCEStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), QWindowsVistaStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QCDEStyle::drawPrimitive(), QWindowsXPStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QGtkStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QTreeView::drawRow(), QWindowsMobileStylePrivate::drawScrollbarGrip(), QWindowsMobileStylePrivate::drawScrollbarHandleDown(), QWindowsMobileStylePrivate::drawScrollbarHandleUp(), QWindowsMobileStylePrivate::drawTabBarTab(), drawTabBase(), drawTabShape(), QTreeView::drawTree(), QStyledItemDelegate::editorEvent(), QItemDelegate::editorEvent(), QGridLayoutEngine::fillRowData(), getControlSize(), QMacStylePrivate::getSliderInfo(), QComboMenuDelegate::getStyleOption(), QGtkPainter::gtkState(), QMenuBar::heightForWidth(), QTabWidget::heightForWidth(), init(), QMacStylePrivate::initComboboxBdi(), QMacStylePrivate::initHIThemePushButton(), QSideBarDelegate::initStyleOption(), QRadioButton::initStyleOption(), QToolBarSeparator::initStyleOption(), QScrollBar::initStyleOption(), QToolBoxButton::initStyleOption(), QCheckBox::initStyleOption(), QStyledItemDelegate::initStyleOption(), QPushButton::initStyleOption(), QGroupBox::initStyleOption(), QSlider::initStyleOption(), QProgressBar::initStyleOption(), QToolButton::initStyleOption(), QMenuBar::initStyleOption(), QToolBar::initStyleOption(), QAbstractSpinBox::initStyleOption(), QMenu::initStyleOption(), QGraphicsWidget::initStyleOption(), QDateTimeEdit::initStyleOption(), QTabBar::initStyleOption(), QLineEdit::initStyleOption(), QHeaderView::initStyleOption(), QWorkspaceTitleBar::initStyleOption(), QComboBox::initStyleOption(), QGraphicsItemPrivate::initStyleOption(), QGraphicsWidgetPrivate::initStyleOptionTitleBar(), QCommonStylePrivate::isViewItemCached(), QMenuBar::minimumSizeHint(), QTabWidget::minimumSizeHint(), QAbstractItemView::mouseReleaseEvent(), QAbstractItemViewPrivate::openEditor(), QAbstractItemView::openPersistentEditor(), operator<<(), operator=(), QDecorationStyled::paint(), QItemDelegate::paint(), QGraphicsSvgItem::paint(), QFontFamilyDelegate::paint(), QColumnViewDelegate::paint(), QCompleterItemDelegate::paint(), QScriptDebuggerLocalsItemDelegate::paint(), QGraphicsPathItem::paint(), QGraphicsRectItem::paint(), QGraphicsEllipseItem::paint(), QGraphicsPolygonItem::paint(), QGraphicsLineItem::paint(), QGraphicsPixmapItem::paint(), QGraphicsTextItem::paint(), QGraphicsSimpleTextItem::paint(), QGraphicsItemGroup::paint(), QWellArray::paintCell(), QScrollBar::paintEvent(), QMDIControl::paintEvent(), QStatusBar::paintEvent(), QSlider::paintEvent(), QComboBoxListView::paintEvent(), QDockWidgetTitleButton::paintEvent(), QMdiSubWindow::paintEvent(), QMenuBar::paintEvent(), QListView::paintEvent(), QSplitterHandle::paintEvent(), QMenu::paintEvent(), QComboBoxPrivateScroller::paintEvent(), QTabBar::paintEvent(), QDateTimeEdit::paintEvent(), QHeaderView::paintEvent(), CloseButton::paintEvent(), QWorkspaceTitleBar::paintEvent(), QMdi::ControllerWidget::paintEvent(), QTableCornerButton::paintEvent(), QWorkspaceChild::paintEvent(), QPrevNextCalButton::paintEvent(), QHeaderView::paintSection(), paintSep(), QGraphicsWidget::paintWindowFrame(), QCommonStyle::pixelMetric(), QPlastiqueStyle::pixelMetric(), QMacStyle::pixelMetric(), QStyleSheetStyle::pixelMetric(), QStyleOptionFocusRect::QStyleOptionFocusRect(), qt_plastique_draw_frame(), qt_plastique_drawFrame(), qt_plastique_drawShadedPanel(), QItemDelegate::rect(), QStyleSheetStyle::renderRule(), QAbstractItemViewPrivate::renderToPixmap(), QAbstractItemViewPrivate::sendDelegateEvent(), QMenuBar::sizeHint(), QTabWidget::sizeHint(), QSplitterHandle::sizeHint(), QStyleSheetStyle::styleSheetPalette(), QMacStyle::subControlRect(), QCommonStyle::subElementRect(), QWindowsVistaStyle::subElementRect(), QWindowsXPStyle::subElementRect(), QMacStyle::subElementRect(), QCommonStylePrivate::tabLayout(), QMdiSubWindowPrivate::titleBarOptions(), QStyleHelper::uniqueName(), and QAbstractItemView::viewOptions().

◆ type

QStyleOption::type

the option type of the style option

The default value is SO_Default.

See also
OptionType

Definition at line 87 of file qstyleoption.h.

Referenced by operator<<(), and qstyleoption_cast().

◆ version

QStyleOption::version

the version of the style option

This value can be used by subclasses to implement extensions without breaking compatibility. If you use the qstyleoption_cast() function, you normally do not need to check it.

The default value is 1.

Definition at line 86 of file qstyleoption.h.

Referenced by QStyleOptionFrameV2::operator=(), QStyleOptionFrameV3::operator=(), QStyleOptionToolBoxV2::operator=(), qstyleoption_cast(), QStyleOptionFrameV2::QStyleOptionFrameV2(), QStyleOptionTabV2::QStyleOptionTabV2(), QStyleOptionTabV3::QStyleOptionTabV3(), and QStyleOptionToolBoxV2::QStyleOptionToolBoxV2().


The documentation for this class was generated from the following files: