QStyleOptionHeader 类

QStyleOptionHeader class is used to describe the parameters for drawing a header. 更多...

头: #include <QStyleOptionHeader>
qmake: QT += widgets
继承: QStyleOption

公共类型

enum SectionPosition { Beginning, Middle, End, OnlyOneSection }
enum SelectedPosition { NotAdjacent, NextIsSelected, PreviousIsSelected, NextAndPreviousAreSelected }
enum SortIndicator { None, SortUp, SortDown }
enum StyleOptionType { Type }
enum StyleOptionVersion { Version }

公共函数

QStyleOptionHeader ()
QStyleOptionHeader (const QStyleOptionHeader & other )

公共变量

QIcon icon
Qt::Alignment iconAlignment
Qt::Orientation orientation
SectionPosition position
int section
SelectedPosition selectedPosition
SortIndicator sortIndicator
QString text
Qt::Alignment textAlignment

详细描述

QStyleOptionHeader class is used to describe the parameters for drawing a header.

QStyleOptionHeader contains all the information that QStyle functions need to draw the item views' header pane, header sort arrow, and header label.

For performance reasons, 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.

对于可以如何使用样式选项的演示范例,见 样式 范例。

另请参阅 QStyleOption .

成员类型文档编制

enum QStyleOptionHeader:: SectionPosition

This enum lets you know where the section's position is in relation to the other sections.

常量 描述
QStyleOptionHeader::Beginning 0 At the beginining of the header
QStyleOptionHeader::Middle 1 In the middle of the header
QStyleOptionHeader::End 2 At the end of the header
QStyleOptionHeader::OnlyOneSection 3 Only one header section

另请参阅 position .

enum QStyleOptionHeader:: SelectedPosition

This enum lets you know where the section's position is in relation to the selected section.

常量 描述
QStyleOptionHeader::NotAdjacent 0 Not adjacent to the selected section
QStyleOptionHeader::NextIsSelected 1 The next section is selected
QStyleOptionHeader::PreviousIsSelected 2 The previous section is selected
QStyleOptionHeader::NextAndPreviousAreSelected 3 Both the next and previous section are selected

另请参阅 selectedPosition .

enum QStyleOptionHeader:: SortIndicator

Indicates which direction the sort indicator should be drawn

常量 描述
QStyleOptionHeader::None 0 No sort indicator is needed
QStyleOptionHeader::SortUp 1 Draw an up indicator
QStyleOptionHeader::SortDown 2 Draw a down indicator

另请参阅 sortIndicator .

enum QStyleOptionHeader:: StyleOptionType

This enum is used to hold information about the type of the style option, and is defined for each QStyleOption 子类。

常量 描述
QStyleOptionHeader::Type SO_Header 提供样式选项的类型 ( SO_Header 对于此类)。

类型内部使用通过 QStyleOption ,其子类,和 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.

另请参阅 StyleOptionVersion .

enum QStyleOptionHeader:: StyleOptionVersion

This enum is used to hold information about the version of the style option, and is defined for each QStyleOption 子类。

常量 描述
QStyleOptionHeader::Version 1 1

版本的使用通过 QStyleOption 子类以实现扩展在不破坏兼容性的情况下。若使用 qstyleoption_cast (), you normally do not need to check it.

另请参阅 StyleOptionType .

成员函数文档编制

QStyleOptionHeader:: QStyleOptionHeader ()

构造 QStyleOptionHeader , initializing the members variables to their default values.

QStyleOptionHeader:: QStyleOptionHeader (const QStyleOptionHeader & other )

构造副本为 other 样式选项。

成员变量文档编制

QIcon QStyleOptionHeader:: icon

This variable holds the icon of the header

The default value is an empty icon, i.e. an icon with neither a pixmap nor a filename.

Qt::Alignment QStyleOptionHeader:: iconAlignment

This variable holds the alignment flags for the icon of the header

默认值为 Qt::AlignLeft .

Qt::Orientation QStyleOptionHeader:: orientation

This variable holds the header's orientation (horizontal or vertical)

The default orientation is Qt::Horizontal

SectionPosition QStyleOptionHeader:: position

This variable holds the section's position in relation to the other sections

默认值为 QStyleOptionHeader::Beginning .

int QStyleOptionHeader:: section

This variable holds which section of the header is being painted

默认值为 0。

SelectedPosition QStyleOptionHeader:: selectedPosition

This variable holds the section's position in relation to the selected section

默认值为 QStyleOptionHeader::NotAdjacent

SortIndicator QStyleOptionHeader:: sortIndicator

This variable holds the direction the sort indicator should be drawn

默认值为 QStyleOptionHeader::None .

QString QStyleOptionHeader:: text

This variable holds the text of the header

默认值为空字符串。

Qt::Alignment QStyleOptionHeader:: textAlignment

This variable holds the alignment flags for the text of the header

默认值为 Qt::AlignLeft .