QStyleOptionProgressBarV2 Class Reference

#include <qstyleoption.h>

Inheritance diagram for QStyleOptionProgressBarV2:

Inheritance graph
[legend]
Collaboration diagram for QStyleOptionProgressBarV2:

Collaboration graph
[legend]
List of all members.

Detailed Description

the minimum value for the progress barthe maximum value for the progress barthe text for the progress bara flag indicating whether or not text is visiblethe text alignment for the text in the QProgressBarthe current progress for the progress barThe QStyleOptionProgressBarV2 class is used to describe the parameters necessary for drawing a progress bar in Qt 4.1 or above.

Since:
4.1
An instance of this class has type SO_ProgressBar 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 QStyleOptionProgressBar and QStyleOptionProgressBarV2. One way to achieve this is to use the QStyleOptionProgressBarV2 copy constructor. For example:

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

In the example above: If the progressBarOption's version is 1, the extra members ( orientation, invertedAppearance, and bottomToTop) are set to default values for progressBarV2. If the progressBarOption's version is 2, the constructor will simply copy the extra members to progressBarV2.

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

See also:
QStyleOptionProgressBar, QStyleOption

Definition at line 322 of file qstyleoption.h.

Public Types

enum  StyleOptionType
enum  StyleOptionVersion

Public Member Functions

 QStyleOptionProgressBarV2 ()
 QStyleOptionProgressBarV2 (const QStyleOptionProgressBar &other)
 QStyleOptionProgressBarV2 (const QStyleOptionProgressBarV2 &other)
QStyleOptionProgressBarV2operator= (const QStyleOptionProgressBar &other)

Public Attributes

Qt::Orientation orientation
bool invertedAppearance
bool bottomToTop

Protected Member Functions

 QStyleOptionProgressBarV2 (int version)


Member Enumeration Documentation

enum QStyleOptionProgressBarV2::StyleOptionType

the progress bar's orientation (horizontal or vertical); the default orentation is Qt::Horizontalwhether the progress bar's appearance is invertedwhether the text reads from bottom to top when the progress bar is vertical

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

Type The type of style option provided ({SO_ProgressBar} for this class).

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.

See also:
StyleOptionVersion

Reimplemented from QStyleOptionProgressBar.

Definition at line 325 of file qstyleoption.h.

00325 { Type = SO_ProgressBar };

enum QStyleOptionProgressBarV2::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 QStyleOptionProgressBar.

Definition at line 326 of file qstyleoption.h.

00326 { Version = 2 };


Constructor & Destructor Documentation

QStyleOptionProgressBarV2::QStyleOptionProgressBarV2 (  ) 

Constructs a QStyleOptionProgressBarV2, initializing he members variables to their default values.

Definition at line 1888 of file qstyleoption.cpp.

01889     : QStyleOptionProgressBar(2),
01890       orientation(Qt::Horizontal), invertedAppearance(false), bottomToTop(false)
01891 {
01892 }

QStyleOptionProgressBarV2::QStyleOptionProgressBarV2 ( const QStyleOptionProgressBar other  ) 

Constructs a copy of the other style option which can be either of the QStyleOptionProgressBar and QStyleOptionProgressBarV2 types.

If the {other} style option's version is 1, the extra members ( orientation, invertedAppearance, and bottomToTop) are set to default values for the new style option. If {other}'s version is 2, the extra members are simply copied.

See also:
version

Definition at line 1915 of file qstyleoption.cpp.

01916     : QStyleOptionProgressBar(2), orientation(Qt::Horizontal), invertedAppearance(false), bottomToTop(false)
01917 {
01918     const QStyleOptionProgressBarV2 *pb2 = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(&other);
01919     if (pb2)
01920         *this = *pb2;
01921     else
01922         *((QStyleOptionProgressBar *)this) = other;
01923 }

QStyleOptionProgressBarV2::QStyleOptionProgressBarV2 ( const QStyleOptionProgressBarV2 other  ) 

Constructs a copy of the other style option.

Definition at line 1928 of file qstyleoption.cpp.

01929     : QStyleOptionProgressBar(2), orientation(Qt::Horizontal), invertedAppearance(false), bottomToTop(false)
01930 {
01931     *this = other;
01932 }

QStyleOptionProgressBarV2::QStyleOptionProgressBarV2 ( int  version  )  [protected]

Definition at line 1897 of file qstyleoption.cpp.


Member Function Documentation

QStyleOptionProgressBarV2 & QStyleOptionProgressBarV2::operator= ( const QStyleOptionProgressBar other  ) 

Assigns the other style option to this style option. The other style option can be either of the QStyleOptionProgressBarV2 or QStyleOptionProgressBar types.

If the {other} style option's version is 1, the extra members ( orientation, invertedAppearance, and bottomToTop) are set to default values for this style option. If {other}'s version is 2, the extra members are simply copied to this style option.

Definition at line 1945 of file qstyleoption.cpp.

References bottomToTop, Qt::Horizontal, invertedAppearance, QStyleOption::operator=(), and orientation.

01946 {
01947     QStyleOptionProgressBar::operator=(other);
01948 
01949     const QStyleOptionProgressBarV2 *pb2 = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(&other);
01950     orientation = pb2 ? pb2->orientation : Qt::Horizontal;
01951     invertedAppearance = pb2 ? pb2->invertedAppearance : false;
01952     bottomToTop = pb2 ? pb2->bottomToTop : false;
01953     return *this;
01954 }

Here is the call graph for this function:


Member Data Documentation

Qt::Orientation QStyleOptionProgressBarV2::orientation

Definition at line 327 of file qstyleoption.h.

Referenced by QMotifStyle::drawControl(), QWindowsStyle::drawControl(), QCommonStyle::drawControl(), QProgressBarPrivate::getStyleOption(), operator=(), and QProgressBar::sizeHint().

bool QStyleOptionProgressBarV2::invertedAppearance

Definition at line 328 of file qstyleoption.h.

Referenced by QMotifStyle::drawControl(), QWindowsStyle::drawControl(), QCommonStyle::drawControl(), QProgressBarPrivate::getStyleOption(), and operator=().

bool QStyleOptionProgressBarV2::bottomToTop

Definition at line 329 of file qstyleoption.h.

Referenced by QProgressBarPrivate::getStyleOption(), and operator=().


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