QStyleOptionViewItem Class
The QStyleOptionViewItem class describes how an item of an item view is drawn. More…
| Header | #include <QStyleOptionViewItem> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::Widgets) |
| Module | Nt Widgets C++ Classes |
| Inherits | QStyleOption |
List of all members, including inherited members
Public Types
| enum | ViewItemFeature |
| typedef | ViewItemFeatures |
Public Functions
Public Variables
Detailed Description
A view fills one of these in for each item that it draws and passes it to its delegate; QStyledItemDelegate::initStyleOption() adds what the model says about the item: its text, check state, decoration, font and colors.
See also QStyledItemDelegate and QAbstractItemView.
Differences from Qt
The decoration is a QPixmap in decoration, where Qt has a QIcon in icon, as Nt has no QIcon. There is no viewItemPosition and no decorationPosition: the decoration is on the left.
Member Type Documentation
enum QStyleOptionViewItem::ViewItemFeature
What an item has and how it is drawn.
| Constant | Description |
|---|---|
QStyleOptionViewItem::None | Nothing special. |
QStyleOptionViewItem::WrapText | The text may be broken into lines. Nt draws one line. |
QStyleOptionViewItem::Alternate | The item is in a row that has the alternate background. |
QStyleOptionViewItem::HasCheckIndicator | The item has a check box. |
QStyleOptionViewItem::HasDisplay | The item has text. |
QStyleOptionViewItem::HasDecoration | The item has a decoration. |
typedef QStyleOptionViewItem::ViewItemFeatures
The ViewItemFeatures type is a typedef for QFlags<ViewItemFeature>. It stores an OR combination of ViewItemFeature values.
Member Function Documentation
QStyleOptionViewItem::QStyleOptionViewItem()
Constructs an option for an item, with the type SO_ViewItem.
Member Variable Documentation
QBrush QStyleOptionViewItem::backgroundBrush
The background of the item, if the model gives it one.
Qt::CheckState QStyleOptionViewItem::checkState
The check state of the item, if it has a check box.
QPixmap QStyleOptionViewItem::decoration
The decoration of the item, drawn left of its text; null if it has none.
QSize QStyleOptionViewItem::decorationSize
The size that the decoration is drawn in; the size of decoration if it is empty.
Qt::Alignment QStyleOptionViewItem::displayAlignment
How the text is aligned in its part of the item; left and vertically centered by default.
ViewItemFeatures QStyleOptionViewItem::features
What the item has; see ViewItemFeature.
QFont QStyleOptionViewItem::font
The font of the text.
QModelIndex QStyleOptionViewItem::index
The model index of the item.
QLocale QStyleOptionViewItem::locale
The locale that numbers and dates are written with.
bool QStyleOptionViewItem::showDecorationSelected
Whether the decoration is part of what shows the selection.
QString QStyleOptionViewItem::text
The text of the item.
Qt::TextElideMode QStyleOptionViewItem::textElideMode
Where the text gets its ellipsis when it does not fit; at the end by default.
const QWidget * QStyleOptionViewItem::widget
The widget that the item is drawn on: the view, or nullptr.