QProgressBarPrivate Class Reference

Inheritance diagram for QProgressBarPrivate:

Inheritance graph
[legend]
Collaboration diagram for QProgressBarPrivate:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 36 of file qprogressbar.cpp.

Public Member Functions

 QProgressBarPrivate ()
void init ()
QStyleOptionProgressBarV2 getStyleOption () const
int bound (int val) const
bool repaintRequired () const

Public Attributes

int minimum
int maximum
int value
Qt::Alignment alignment
uint textVisible: 1
int lastPaintedValue
Qt::Orientation orientation
bool invertedAppearance
QProgressBar::Direction textDirection
QString format


Constructor & Destructor Documentation

QProgressBarPrivate::QProgressBarPrivate (  ) 

Definition at line 58 of file qprogressbar.cpp.


Member Function Documentation

void QProgressBarPrivate::init (  ) 

Definition at line 65 of file qprogressbar.cpp.

References QSizePolicy::Expanding, QSizePolicy::Fixed, orientation, QSizePolicy::transpose(), Qt::Vertical, and Qt::WA_WState_OwnSizePolicy.

00066 {
00067     Q_Q(QProgressBar);
00068     QSizePolicy sp(QSizePolicy::Expanding, QSizePolicy::Fixed);
00069     if (orientation == Qt::Vertical)
00070         sp.transpose();
00071     q->setSizePolicy(sp);
00072     q->setAttribute(Qt::WA_WState_OwnSizePolicy, false);
00073 }

Here is the call graph for this function:

QStyleOptionProgressBarV2 QProgressBarPrivate::getStyleOption (  )  const

Definition at line 75 of file qprogressbar.cpp.

References alignment, QStyleOptionProgressBarV2::bottomToTop, QProgressBar::BottomToTop, QStyleOption::init(), invertedAppearance, QStyleOptionProgressBarV2::invertedAppearance, maximum, QStyleOptionProgressBar::maximum, minimum, QStyleOptionProgressBar::minimum, orientation, QStyleOptionProgressBarV2::orientation, QStyleOptionProgressBar::progress, QStyleOptionProgressBar::text, QStyleOptionProgressBar::textAlignment, textDirection, textVisible, QStyleOptionProgressBar::textVisible, and value.

Referenced by repaintRequired().

00076 {
00077     QStyleOptionProgressBarV2 opt;
00078     opt.init(q_func());
00079 
00080     opt.minimum = minimum;
00081     opt.maximum = maximum;
00082     opt.progress = value;
00083     opt.textAlignment = alignment;
00084     opt.textVisible = textVisible;
00085     opt.text = q_func()->text();
00086     opt.orientation = orientation;
00087     opt.invertedAppearance = invertedAppearance;
00088     opt.bottomToTop = (textDirection == QProgressBar::BottomToTop);
00089 
00090     return opt;
00091 }

Here is the call graph for this function:

int QProgressBarPrivate::bound ( int  val  )  const [inline]

Definition at line 54 of file qprogressbar.cpp.

References maximum, minimum, qMax(), and qMin().

00054 { return qMax(minimum-1, qMin(maximum, val)); }

Here is the call graph for this function:

bool QProgressBarPrivate::repaintRequired (  )  const

Definition at line 93 of file qprogressbar.cpp.

References getStyleOption(), lastPaintedValue, maximum, minimum, QStyle::PM_ProgressBarChunkWidth, QStyle::SE_ProgressBarGroove, textVisible, value, and QRect::width().

00094 {
00095     Q_Q(const QProgressBar);
00096     if (value == lastPaintedValue)
00097         return false;
00098 
00099     int valueDifference = qAbs(value - lastPaintedValue);
00100 
00101     // Check if the text needs to be repainted
00102     if ((value == minimum || value == maximum)
00103             || (textVisible && valueDifference >= qAbs((maximum - minimum) / 100)))
00104         return true;
00105 
00106     // Check if the bar needs to be repainted
00107     QStyleOptionProgressBarV2 opt = getStyleOption();
00108     int cw = q->style()->pixelMetric(QStyle::PM_ProgressBarChunkWidth, &opt, q);
00109     QRect groove  = q->style()->subElementRect(QStyle::SE_ProgressBarGroove, &opt, q);
00110     // This expression is basically
00111     // (valueDifference / (maximum - minimum) > cw / groove.width())
00112     // transformed to avoid integer division.
00113     return (valueDifference * groove.width() > cw * (maximum - minimum));
00114 }

Here is the call graph for this function:


Member Data Documentation

int QProgressBarPrivate::minimum

Definition at line 43 of file qprogressbar.cpp.

Referenced by bound(), getStyleOption(), and repaintRequired().

int QProgressBarPrivate::maximum

Definition at line 44 of file qprogressbar.cpp.

Referenced by bound(), getStyleOption(), and repaintRequired().

int QProgressBarPrivate::value

Definition at line 45 of file qprogressbar.cpp.

Referenced by getStyleOption(), and repaintRequired().

Qt::Alignment QProgressBarPrivate::alignment

Definition at line 46 of file qprogressbar.cpp.

Referenced by getStyleOption().

uint QProgressBarPrivate::textVisible

Definition at line 47 of file qprogressbar.cpp.

Referenced by getStyleOption(), and repaintRequired().

int QProgressBarPrivate::lastPaintedValue

Definition at line 48 of file qprogressbar.cpp.

Referenced by repaintRequired().

Qt::Orientation QProgressBarPrivate::orientation

Definition at line 49 of file qprogressbar.cpp.

Referenced by getStyleOption(), and init().

bool QProgressBarPrivate::invertedAppearance

Definition at line 50 of file qprogressbar.cpp.

Referenced by getStyleOption().

QProgressBar::Direction QProgressBarPrivate::textDirection

Definition at line 51 of file qprogressbar.cpp.

Referenced by getStyleOption().

QString QProgressBarPrivate::format

Definition at line 52 of file qprogressbar.cpp.


The documentation for this class was generated from the following file:
Generated on Thu Mar 15 18:44:48 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1