QStyleOptionTabV2 Class Reference

#include <qstyleoption.h>

Inheritance diagram for QStyleOptionTabV2:

Inheritance graph
[legend]
Collaboration diagram for QStyleOptionTabV2:

Collaboration graph
[legend]
List of all members.

Detailed Description

the position of the selected tab in relation to this taban OR combination of CornerWidget values indicating the corner widgets of the tab barthe tab shape used to draw the tab; by default QTabBar::RoundedNorththe text of the tabthe icon for the tabwhich row the tab is currently inthe position of the tab in the tab barThe QStyleOptionTabV2 class is used to describe the parameters necessary for drawing a tabs in Qt 4.1 or above.

Since:
4.1
An instance of the QStyleOptionTabV2 class has type SO_Tab and version 2. The type is used internally by QStyleOption, its subclasses, and 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 subclasses to implement extensions without breaking compatibility. If you use qstyleoption_cast(), you normally don't need to check it.

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

snippets/qstyleoption/main.cpp MyStyle::MyStyle() *tabOption }

In the example above: If tabOption's version is 1, the extra member ( iconSize) will be set to an invalid size for tabV2. If tabOption's version is 2, the constructor will simply copy the tab's iconSize.

For an example demonstrating how style options can be used, see the {widgets/styles}{Styles} example.

See also:
QStyleOptionTab, QStyleOption

Definition at line 255 of file qstyleoption.h.

Public Types

enum  StyleOptionVersion

Public Member Functions

 QStyleOptionTabV2 ()
 QStyleOptionTabV2 (const QStyleOptionTabV2 &other)
 QStyleOptionTabV2 (const QStyleOptionTab &other)
QStyleOptionTabV2operator= (const QStyleOptionTab &other)

Public Attributes

QSize iconSize

Protected Member Functions

 QStyleOptionTabV2 (int version)


Member Enumeration Documentation

enum QStyleOptionTabV2::StyleOptionVersion

This enum is used to hold information about the version of the style option, and is defined for each QStyleOption subclass.

Version 2

The version is used by QStyleOption subclasses to implement extensions without breaking compatibility. If you use qstyleoption_cast(), you normally don't need to check it.

See also:
StyleOptionType

Reimplemented from QStyleOptionTab.

Definition at line 258 of file qstyleoption.h.

00258 { Version = 2 };


Constructor & Destructor Documentation

QStyleOptionTabV2::QStyleOptionTabV2 (  ) 

the size for the icons

Constructs a QStyleOptionTabV2.

Definition at line 1635 of file qstyleoption.cpp.

01636     : QStyleOptionTab(Version)
01637 {
01638 }

QStyleOptionTabV2::QStyleOptionTabV2 ( const QStyleOptionTabV2 other  )  [inline]

Constructs a copy of the other style option.

Definition at line 261 of file qstyleoption.h.

00261 : QStyleOptionTab(Version) { *this = other; }

QStyleOptionTabV2::QStyleOptionTabV2 ( const QStyleOptionTab other  ) 

Constructs a QStyleOptionTabV2 copy of the other style option which can be either of the QStyleOptionTabV2 or QStyleOptionTab types.

If the other style option's version is 1, the new style option's iconSize is set to an invalid value. If its version is 2, its iconSize value is simply copied to the new style option.

Definition at line 1663 of file qstyleoption.cpp.

References QStyleOption::version, and Version.

01664     : QStyleOptionTab(Version)
01665 {
01666     if (const QStyleOptionTabV2 *tab = qstyleoption_cast<const QStyleOptionTabV2 *>(&other)) {
01667         *this = *tab;
01668     } else {
01669         *((QStyleOptionTab *)this) = other;
01670         version = Version;
01671     }
01672 }

QStyleOptionTabV2::QStyleOptionTabV2 ( int  version  )  [protected]

Definition at line 1643 of file qstyleoption.cpp.

01644     : QStyleOptionTab(version)
01645 {
01646 }


Member Function Documentation

QStyleOptionTabV2 & QStyleOptionTabV2::operator= ( const QStyleOptionTab other  ) 

Assigns the other style option to this QStyleOptionTabV2. The other style option can be either of the QStyleOptionTabV2 or QStyleOptionTab types.

If the other style option's version is 1, this style option's iconSize is set to an invalid size. If its version is 2, its iconSize value is simply copied to this style option.

Definition at line 1683 of file qstyleoption.cpp.

References iconSize, and QStyleOption::operator=().

01684 {
01685     QStyleOptionTab::operator=(other);
01686 
01687     if (const QStyleOptionTabV2 *tab = qstyleoption_cast<const QStyleOptionTabV2 *>(&other))
01688         iconSize = tab->iconSize;
01689     else
01690         iconSize = QSize();
01691     return *this;
01692 }

Here is the call graph for this function:


Member Data Documentation

QSize QStyleOptionTabV2::iconSize

Definition at line 259 of file qstyleoption.h.

Referenced by QCommonStyle::drawControl(), QTabBarPrivate::getStyleOption(), and operator=().


The documentation for this class was generated from the following files:
Generated on Thu Mar 15 19:10:53 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1