QStyleOptionTab Class Reference

[ QtGui module]

The QStyleOptionTab class is used to describe the parameters for drawing a tab bar. 更多...

继承 QStyleOption .

Inherited by QStyleOptionTabV2 .

类型

方法

Members


详细描述

The QStyleOptionTab class is used to describe the parameters for drawing a tab bar.

The QStyleOptionTab class is used for drawing several built-in Qt widgets including QTabBar 和 panel for QTabWidget . Note that to describe the parameters necessary for drawing a frame in Qt 4.1 or above, you must use the QStyleOptionFrameV2 子类。

An instance of the QStyleOptiontabV2 class has type SO_Tab and version 1. The type is used internally by QStyleOption , its subclasses, and qstyleoption_cast () 到 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. 若使用 qstyleoption_cast (), you normally do not need to check it.

If you create your own QStyle subclass, you should handle both QStyleOptionTab and QStyleOptionTabV2 .

For an example demonstrating how style options can be used, see the 样式 范例。


类型文档编制

QStyleOptionTab.CornerWidget

这些标志指示选项卡的角落小部件。

常量 描述
QStyleOptionTab.NoCornerWidgets 0x00 没有角落 Widget
QStyleOptionTab.LeftCornerWidget 0x01 左上角 Widget
QStyleOptionTab.RightCornerWidget 0x02 右上角 Widget

The CornerWidgets type is a typedef for QFlags <CornerWidget>. It stores an OR combination of CornerWidget values.

另请参阅 cornerWidgets .

QStyleOptionTab.SelectedPosition

This enum describes the position of the selected tab. Some styles need to draw a tab differently depending on whether or not it is adjacent to the selected tab.

常量 描述
QStyleOptionTab.NotAdjacent 0 The tab is not adjacent to a selected tab (or is the selected tab).
QStyleOptionTab.NextIsSelected 1 The next tab (typically the tab on the right) is selected.
QStyleOptionTab.PreviousIsSelected 2 The previous tab (typically the tab on the left) is selected.

另请参阅 selectedPosition .

QStyleOptionTab.StyleOptionType

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

常量 描述
QStyleOptionTab.Type SO_Tab The type of style option provided ( SO_Tab for this class).

The type is used internally by QStyleOption , its subclasses, and qstyleoption_cast () 到 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 .

QStyleOptionTab.StyleOptionVersion

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

常量 描述
QStyleOptionTab.Version 1 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.

另请参阅 StyleOptionType .

QStyleOptionTab.TabPosition

This enum describes the position of the tab.

常量 描述
QStyleOptionTab.Beginning 0 The tab is the first tab in the tab bar.
QStyleOptionTab.Middle 1 The tab is neither the first nor the last tab in the tab bar.
QStyleOptionTab.End 2 The tab is the last tab in the tab bar.
QStyleOptionTab.OnlyOneTab 3 The tab is both the first and the last tab in the tab bar.

另请参阅 position .


方法文档编制

QStyleOptionTab.__init__ ( self )

构造 QStyleOptionTab object, initializing the members variables to their default 值。

QStyleOptionTab.__init__ ( self , QStyleOptionTab   other )

构造副本为 other 样式选项。


Member Documentation

CornerWidgets cornerWidgets

This variable holds an OR combination of CornerWidget values indicating the corner widgets of the tab bar.

默认值为 NoCornerWidgets .

另请参阅 CornerWidget .

QIcon icon

This variable holds the icon for the tab.

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

TabPosition position

This variable holds the position of the tab in the tab bar.

默认值为 Beginning , i.e. the tab is the first tab in the tab bar.

int row

This variable holds which row the tab is currently in.

The default value is 0, indicating the front row. Currently this property can only be 0.

SelectedPosition selectedPosition

This variable holds the position of the selected tab in relation to this tab.

默认值为 NotAdjacent , i.e. the tab is not adjacent to a selected tab nor is it the selected tab.

QTabBar.Shape shape

This variable holds the tab shape used to draw the tab; by default QTabBar.RoundedNorth.

另请参阅 QTabBar.Shape .

QString text

This variable holds the text of the tab.

默认值为空字符串。