QStyleOptionFrameV2 Class

The QStyleOptionFrameV2 class is used to describe the parameters necessary for drawing a frame in Qt 4.1 or above. 更多...

头: #include <QStyleOptionFrameV2>
Since: Qt 4.1
继承: QStyleOptionFrame
继承者: QStyleOptionFrameV3

公共类型

enum FrameFeature { None, Flat }
flags FrameFeatures
enum StyleOptionVersion { Version }

公共函数

QStyleOptionFrameV2 ()
QStyleOptionFrameV2 (const QStyleOptionFrameV2 & other )
QStyleOptionFrameV2 (const QStyleOptionFrame & other )
QStyleOptionFrameV2 & operator= (const QStyleOptionFrame & other )

公共变量

FrameFeatures features

详细描述

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

QStyleOptionFrameV2 继承 QStyleOptionFrame which is used for drawing several built-in Qt widgets, including QFrame , QGroupBox , QLineEdit ,和 QMenu .

An instance of the QStyleOptionFrameV2 class has type SO_Frame and version 2. The type is used internally by 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. The version is used by QStyleOption 子类以实现扩展在不破坏兼容性的情况下。若使用 qstyleoption_cast (),通常不需要校验它。

If you create your own QStyle subclass, you should handle both QStyleOptionFrame and QStyleOptionFrameV2 . One way to achieve this is to use the QStyleOptionFrameV2 copy constructor. For example:

    QStyleOptionFrame *option;
    if (const QStyleOptionFrame *frameOption =
           qstyleoption_cast<const QStyleOptionFrame *>(option)) {
        QStyleOptionFrameV2 frameOptionV2(*frameOption);
        // draw the frame using frameOptionV2
    }
					

In the example above: If the frameOption 's version is 1, FrameFeature 被设为 None for frameOptionV2 。若 frameOption 's version is 2, the constructor will simply copy the frameOption 's FrameFeature 值。

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

另请参阅 QStyleOptionFrame and QStyleOption .

成员类型文档编制

enum QStyleOptionFrameV2:: FrameFeature
flags QStyleOptionFrameV2:: FrameFeatures

This enum describes the different types of features a frame can have.

常量 描述
QStyleOptionFrameV2::None 0x00 Indicates a normal frame.
QStyleOptionFrameV2::Flat 0x01 Indicates a flat frame.

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

enum QStyleOptionFrameV2:: StyleOptionVersion

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

常量 描述
QStyleOptionFrameV2::Version 2 2

版本的使用通过 QStyleOption 子类以实现扩展在不破坏兼容性的情况下。若使用 qstyleoption_cast (),通常不需要校验它。

另请参阅 StyleOptionType .

成员函数文档编制

QStyleOptionFrameV2:: QStyleOptionFrameV2 ()

构造 QStyleOptionFrameV2 对象。

QStyleOptionFrameV2:: QStyleOptionFrameV2 (const QStyleOptionFrameV2 & other )

构造 QStyleOptionFrameV2 copy of the other 样式选项。

QStyleOptionFrameV2:: QStyleOptionFrameV2 (const QStyleOptionFrame & other )

构造 QStyleOptionFrameV2 copy of the other style option which can be either of the QStyleOptionFrameV2 or QStyleOptionFrame 类型。

other style option's version is 1, the new style option's FrameFeature value is set to QStyleOptionFrameV2::None . If its version is 2, its FrameFeature value is simply copied to the new style option.

另请参阅 version .

QStyleOptionFrameV2 & QStyleOptionFrameV2:: operator= (const QStyleOptionFrame & other )

赋值 other style option to this style option. The other style option can be either of the QStyleOptionFrameV2 or QStyleOptionFrame 类型。

other style option's version is 1, this style option's FrameFeature value is set to QStyleOptionFrameV2::None . If its version is 2, its FrameFeature value is simply copied to this style option.

成员变量文档编制

FrameFeatures QStyleOptionFrameV2:: features

This variable holds a bitwise OR of the features that describe this frame.

另请参阅 FrameFeature .