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 .