CopperSpice API  1.9.2
QStyleOptionViewItem Class Reference

Base version, describes the parameters used to draw an item in a view widget. More...

Inheritance diagram for QStyleOptionViewItem:
QStyleOption

Public Typedefs

using ViewItemFeatures = QFlags< ViewItemFeature >
 

Public Types

enum  Position
 
enum  StyleOptionType
 
enum  StyleOptionVersion
 
enum  ViewItemFeature
 
enum  ViewItemPosition
 
- Public Types inherited from QStyleOption
enum  OptionType
 
enum  StyleOptionType
 
enum  StyleOptionVersion
 

Public Methods

 QStyleOptionViewItem ()
 
 QStyleOptionViewItem (const QStyleOptionViewItem &other)
 
QStyleOptionViewItem & operator= (const QStyleOptionViewItem &other) = default
 
- Public Methods inherited from QStyleOption
 QStyleOption (const QStyleOption &other)
 
 QStyleOption (int version=QStyleOption::Version, int type=SO_Default)
 
 ~QStyleOption ()
 
void initFrom (const QWidget *widget)
 
QStyleOption & operator= (const QStyleOption &other)
 

Public Members

QBrush backgroundBrush
 
Qt::CheckState checkState
 
Qt::Alignment decorationAlignment
 
Position decorationPosition
 
QSize decorationSize
 
Qt::Alignment displayAlignment
 
ViewItemFeatures features
 
QFont font
 
QIcon icon
 
QModelIndex index
 
bool showDecorationSelected
 
QString text
 
Qt::TextElideMode textElideMode
 
ViewItemPosition viewItemPosition
 
- Public Members inherited from QStyleOption
int type
 
int version
 

Additional Inherited Members

Detailed Description

The QStyleOptionViewItem class is used to describe the parameters used to draw an item in a view widget. QStyleOptionViewItem contains all the information that QStyle functions need to draw the items for the model/view classes.

See also
QStyleOption, Model/View Architecture

Member Typedef Documentation

Typedef for QFlags<ViewItemFeature> which contains an OR combination of ViewItemFeature values.

Refer to QStyleOptionViewItem::ViewItemFeature for the enum documentation.

Member Enumeration Documentation

This enum describes the position of the item's decoration.

ConstantValueDescription
QStyleOptionViewItem::Left0 On the left of the text
QStyleOptionViewItem::Right1 On the right of the text
QStyleOptionViewItem::Top2 Above the text
QStyleOptionViewItem::Bottom3 Below the text
See also
decorationPosition

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

ConstantValueDescription
QStyleOptionViewItem::Type SO_ViewItem Type of style option
See also
StyleOptionVersion, qstyleoption_cast()

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

ConstantValueDescription
QStyleOptionViewItem::Version 4 Version 4
See also
StyleOptionType, qstyleoption_cast()

This enum describes the different types of features an item can have.

ConstantValueDescription
QStyleOptionViewItem::None 0x00 Normal item
QStyleOptionViewItem::WrapText 0x01 Item with wrapped text
QStyleOptionViewItem::Alternate 0x02 Background is rendered using alternateBase
QStyleOptionViewItem::HasCheckIndicator 0x04 Item has a check state indicator
QStyleOptionViewItem::HasDisplay 0x08 Item has a display role
QStyleOptionViewItem::HasDecoration 0x10 Item has a decoration role

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.

ConstantValueDescription
QStyleOptionViewItem::Invalid 0 ViewItemPosition is unknown and should be disregarded
QStyleOptionViewItem::Beginning 1 Item appears at the beginning of the row
QStyleOptionViewItem::Middle 2 Item appears at the middle of the row
QStyleOptionViewItem::End 3 Item appears at the end of the row
QStyleOptionViewItem::OnlyOne 4 Item is the only one on the row and is therefore both at the beginning and the end

Constructor & Destructor Documentation

QStyleOptionViewItem::QStyleOptionViewItem ( )

Constructs an empty QStyleOptionViewItem.

QStyleOptionViewItem::QStyleOptionViewItem ( const QStyleOptionViewItem &  other)
inline

Copy constructs a new QStyleOptionViewItem from other.

Method Documentation

QStyleOptionViewItem & QStyleOptionViewItem::operator= ( const QStyleOptionViewItem &  other)
default

Copy assigns from other and returns a reference to this object.

Member Data Documentation

QBrush QStyleOptionViewItem::backgroundBrush

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

Qt::CheckState QStyleOptionViewItem::checkState

This value is true if the item is checked. If ViewItemFeature::HasCheckIndicator is false then the item can not be checked.

Qt::Alignment QStyleOptionViewItem::decorationAlignment

This variable holds the alignment of the decoration for the item. The default value is Qt::AlignLeft.

Position QStyleOptionViewItem::decorationPosition

This variable holds the position of the decoration for the item. The default value is Left.

See also
Position
QSize QStyleOptionViewItem::decorationSize

This variable holds the size of the decoration for the item. The default value is QSize(-1, -1) which is an invalid size.

See also
decorationAlignment, decorationPosition
Qt::Alignment QStyleOptionViewItem::displayAlignment

This variable holds the alignment of the display value for the item. The default value is Qt::AlignLeft.

ViewItemFeatures QStyleOptionViewItem::features

This variable holds a bitwise OR of the features that describe this view item

See also
ViewItemFeature
QFont QStyleOptionViewItem::font

This variable holds the font used for the item. By default the application's default font is used.

See also
QFont
QIcon QStyleOptionViewItem::icon

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

QModelIndex QStyleOptionViewItem::index

The model index which is used when displaying the data.

bool QStyleOptionViewItem::showDecorationSelected

This variable holds whether the decoration should be highlighted on selected items. If this option is true the branch and any decorations on selected items should be highlighted. This indicates the item is selected, otherwise no highlighting is required. The default value is false.

See also
QStyle::SH_ItemView_ShowDecorationSelected, QAbstractItemView
QString QStyleOptionViewItem::text

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

Qt::TextElideMode QStyleOptionViewItem::textElideMode

Location to add an ellipsis when text is too long to fit into an item. The default value is Qt::ElideMiddle, which means the ellipsis appears in the middle of the text.

See also
Qt::TextElideMode, QStyle::SH_ItemView_EllipsisLocation
ViewItemPosition QStyleOptionViewItem::viewItemPosition

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