00001 /**************************************************************************** 00002 ** 00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 00004 ** All rights reserved. 00005 ** Contact: Nokia Corporation (qt-info@nokia.com) 00006 ** 00007 ** This file is part of the QtGui module of the Qt Toolkit. 00008 ** 00009 ** $QT_BEGIN_LICENSE:LGPL$ 00010 ** Commercial Usage 00011 ** Licensees holding valid Qt Commercial licenses may use this file in 00012 ** accordance with the Qt Commercial License Agreement provided with the 00013 ** Software or, alternatively, in accordance with the terms contained in 00014 ** a written agreement between you and Nokia. 00015 ** 00016 ** GNU Lesser General Public License Usage 00017 ** Alternatively, this file may be used under the terms of the GNU Lesser 00018 ** General Public License version 2.1 as published by the Free Software 00019 ** Foundation and appearing in the file LICENSE.LGPL included in the 00020 ** packaging of this file. Please review the following information to 00021 ** ensure the GNU Lesser General Public License version 2.1 requirements 00022 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 00023 ** 00024 ** In addition, as a special exception, Nokia gives you certain additional 00025 ** rights. These rights are described in the Nokia Qt LGPL Exception 00026 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this module. 00027 ** 00028 ** GNU General Public License Usage 00029 ** Alternatively, this file may be used under the terms of the GNU 00030 ** General Public License version 3.0 as published by the Free Software 00031 ** Foundation and appearing in the file LICENSE.GPL included in the 00032 ** packaging of this file. Please review the following information to 00033 ** ensure the GNU General Public License version 3.0 requirements will be 00034 ** met: http://www.gnu.org/copyleft/gpl.html. 00035 ** 00036 ** If you have questions regarding the use of this file, please contact 00037 ** Nokia at qt-info@nokia.com. 00038 ** $QT_END_LICENSE$ 00039 ** 00040 ****************************************************************************/ 00041 00042 #ifndef QPROGRESSBAR_H 00043 #define QPROGRESSBAR_H 00044 00045 #include <QtGui/qframe.h> 00046 00047 QT_BEGIN_HEADER 00048 00049 QT_BEGIN_NAMESPACE 00050 00051 QT_MODULE(Gui) 00052 00053 #ifndef QT_NO_PROGRESSBAR 00054 00055 class QProgressBarPrivate; 00056 class QStyleOptionProgressBar; 00057 00058 class Q_GUI_EXPORT QProgressBar : public QWidget 00059 { 00060 Q_OBJECT 00061 Q_ENUMS(Direction) 00062 Q_PROPERTY(int minimum READ minimum WRITE setMinimum) 00063 Q_PROPERTY(int maximum READ maximum WRITE setMaximum) 00064 Q_PROPERTY(QString text READ text) 00065 Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged) 00066 Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) 00067 Q_PROPERTY(bool textVisible READ isTextVisible WRITE setTextVisible) 00068 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation) 00069 Q_PROPERTY(bool invertedAppearance READ invertedAppearance WRITE setInvertedAppearance) 00070 Q_PROPERTY(Direction textDirection READ textDirection WRITE setTextDirection) 00071 Q_PROPERTY(QString format READ format WRITE setFormat) 00072 00073 public: 00074 enum Direction { TopToBottom, BottomToTop }; 00075 00076 explicit QProgressBar(QWidget *parent = 0); 00077 00078 int minimum() const; 00079 int maximum() const; 00080 00081 int value() const; 00082 00083 virtual QString text() const; 00084 void setTextVisible(bool visible); 00085 bool isTextVisible() const; 00086 00087 Qt::Alignment alignment() const; 00088 void setAlignment(Qt::Alignment alignment); 00089 00090 QSize sizeHint() const; 00091 QSize minimumSizeHint() const; 00092 00093 Qt::Orientation orientation() const; 00094 00095 void setInvertedAppearance(bool invert); 00096 bool invertedAppearance(); //### Qt5 make const 00097 bool invertedAppearance() const { return const_cast<QProgressBar *>(this)->invertedAppearance(); } 00098 void setTextDirection(QProgressBar::Direction textDirection); 00099 QProgressBar::Direction textDirection(); //### Qt5 make const 00100 QProgressBar::Direction textDirection() const { return const_cast<QProgressBar *>(this)->textDirection(); } 00101 00102 void setFormat(const QString &format); 00103 QString format() const; 00104 00105 public Q_SLOTS: 00106 void reset(); 00107 void setRange(int minimum, int maximum); 00108 void setMinimum(int minimum); 00109 void setMaximum(int maximum); 00110 void setValue(int value); 00111 void setOrientation(Qt::Orientation); 00112 00113 Q_SIGNALS: 00114 void valueChanged(int value); 00115 00116 protected: 00117 bool event(QEvent *e); 00118 void paintEvent(QPaintEvent *); 00119 void initStyleOption(QStyleOptionProgressBar *option) const; 00120 00121 private: 00122 Q_DECLARE_PRIVATE(QProgressBar) 00123 Q_DISABLE_COPY(QProgressBar) 00124 }; 00125 00126 #endif // QT_NO_PROGRESSBAR 00127 00128 QT_END_NAMESPACE 00129 00130 QT_END_HEADER 00131 00132 #endif // QPROGRESSBAR_H