|  | Home · All Classes · Modules

# QStyleOptionViewItemV4 Class Reference
[QtGui module]

The QStyleOptionViewItemV4 class is used to describe the parameters necessary for drawing a frame in Qt 4.4 or above. More...

Inherits QStyleOptionViewItemV3.

### Types

- enum StyleOptionVersion { Version }
- enum ViewItemPosition { Invalid, Beginning, Middle, End, OnlyOne }

### Methods

- __init__ (self)
- __init__ (self, QStyleOptionViewItemV4)
- __init__ (self, QStyleOptionViewItem)

### Members

- QBrush backgroundBrush
- Qt.CheckState checkState
- QIcon icon
- QModelIndex index
- QStringQString text
- ViewItemPosition viewItemPosition

## Detailed Description

The QStyleOptionViewItemV4 class is used to describe the parameters necessary for drawing a frame in Qt 4.4 or above.

QStyleOptionViewItemV4 inherits QStyleOptionViewItemV3.

An instance of the QStyleOptionViewItemV4 class has type SO_ViewItem and version 4. 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. 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 QStyleOptionViewItemV3's detailed description for a discussion of how to handle "V3" classes.

See also QStyleOptionViewItem and QStyleOption.

## Type Documentation

### QStyleOptionViewItemV4.StyleOptionVersion

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

Constant | Value | Description
--- | --- | ---
`QStyleOptionViewItemV4.Version` | `4` | 4

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.

### QStyleOptionViewItemV4.ViewItemPosition

This enum is used to represent the placement of the item on a row. This can be used to draw items differently depending on their placement, for example by putting rounded edges at the beginning and end, and straight edges in between.

Constant | Value | Description
--- | --- | ---
`QStyleOptionViewItemV4.Invalid` | `0` | The ViewItemPosition is unknown and should be disregarded.
`QStyleOptionViewItemV4.Beginning` | `1` | The item appears at the beginning of the row.
`QStyleOptionViewItemV4.Middle` | `2` | The item appears in the middle of the row.
`QStyleOptionViewItemV4.End` | `3` | The item appears at the end of the row.
`QStyleOptionViewItemV4.OnlyOne` | `4` | The item is the only one on the row, and is therefore both at the beginning and the end.

## Method Documentation

### QStyleOptionViewItemV4.__init__ (self)

Constructs a QStyleOptionViewItemV4 object.

### QStyleOptionViewItemV4.__init__ (self, QStyleOptionViewItemV4)

Constructs a copy of other.

### QStyleOptionViewItemV4.__init__ (self, QStyleOptionViewItem)

Constructs a QStyleOptionViewItemV4 copy of the other style option which can be either of the QStyleOptionViewItemV3 or QStyleOptionViewItem types.

See also version.

## Member Documentation

### QBrush backgroundBrush

The QBrush that should be used to paint the view items background.

### Qt.CheckState checkState

If this view item is checkable, i.e., ViewItemFeature.HasCheckIndicator is true, `checkState` is true if the item is checked; otherwise, it is false.

### QIcon icon

The icon (if any) to be drawn in the view item.

### QModelIndex index

The model index that is to be drawn.

### QStringQString text

The text (if any) to be drawn in the view item.

### ViewItemPosition viewItemPosition

Gives the position of this view item relative to other items. See the ViewItemPosition enum for the details.