author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 06 Jul 2010 15:10:48 +0300 | |
changeset 30 | 5dc02b23752f |
parent 18 | 2f34d5167611 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the Qt3Support module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef Q3PROGRESSBAR_H |
|
43 |
#define Q3PROGRESSBAR_H |
|
44 |
||
45 |
#include <QtGui/qframe.h> |
|
46 |
||
47 |
QT_BEGIN_HEADER |
|
48 |
||
49 |
QT_BEGIN_NAMESPACE |
|
50 |
||
51 |
QT_MODULE(Qt3SupportLight) |
|
52 |
||
53 |
#ifndef QT_NO_PROGRESSBAR |
|
54 |
||
55 |
class Q3ProgressBarPrivate; |
|
56 |
||
57 |
class Q_COMPAT_EXPORT Q3ProgressBar : public QFrame |
|
58 |
{ |
|
59 |
Q_OBJECT |
|
60 |
Q_PROPERTY(int totalSteps READ totalSteps WRITE setTotalSteps) |
|
61 |
Q_PROPERTY(int progress READ progress WRITE setProgress) |
|
62 |
Q_PROPERTY(QString progressString READ progressString) |
|
63 |
Q_PROPERTY(bool centerIndicator READ centerIndicator WRITE setCenterIndicator) |
|
64 |
Q_PROPERTY(bool percentageVisible READ percentageVisible WRITE setPercentageVisible) |
|
65 |
||
66 |
public: |
|
67 |
Q3ProgressBar(QWidget *parent, const char *name, Qt::WindowFlags f=0); |
|
68 |
Q3ProgressBar(int totalSteps, QWidget *parent, const char *name, |
|
69 |
Qt::WindowFlags f=0); |
|
70 |
Q3ProgressBar(QWidget *parent = 0, Qt::WindowFlags f = 0); |
|
71 |
Q3ProgressBar(int totalSteps, QWidget *parent = 0, Qt::WindowFlags f=0); |
|
72 |
||
73 |
int totalSteps() const; |
|
74 |
int progress() const; |
|
75 |
const QString &progressString() const; |
|
76 |
||
77 |
QSize sizeHint() const; |
|
78 |
QSize minimumSizeHint() const; |
|
79 |
||
80 |
void setCenterIndicator(bool on); |
|
81 |
bool centerIndicator() const; |
|
82 |
||
83 |
bool percentageVisible() const; |
|
84 |
void setPercentageVisible(bool); |
|
85 |
||
86 |
void setVisible(bool visible); |
|
87 |
||
88 |
void setMargin(int margin) { setContentsMargins(margin, margin, margin, margin); } |
|
89 |
int margin() const |
|
90 |
{ int margin; int dummy; getContentsMargins(&margin, &dummy, &dummy, &dummy); return margin; } |
|
91 |
||
92 |
public Q_SLOTS: |
|
93 |
void reset(); |
|
94 |
virtual void setTotalSteps(int totalSteps); |
|
95 |
virtual void setProgress(int progress); |
|
96 |
void setProgress(int progress, int totalSteps); |
|
97 |
||
98 |
protected: |
|
99 |
void paintEvent(QPaintEvent *); |
|
100 |
virtual bool setIndicator(QString &progress_str, int progress, int totalSteps); |
|
101 |
void changeEvent(QEvent *); |
|
102 |
||
103 |
private: |
|
104 |
Q_DISABLE_COPY(Q3ProgressBar) |
|
105 |
||
106 |
int total_steps; |
|
107 |
int progress_val; |
|
108 |
int percentage; |
|
109 |
QString progress_str; |
|
110 |
bool center_indicator : 1; |
|
111 |
bool percentage_visible : 1; |
|
112 |
Q3ProgressBarPrivate *d; |
|
113 |
void initFrame(); |
|
114 |
}; |
|
115 |
||
116 |
||
117 |
inline int Q3ProgressBar::totalSteps() const |
|
118 |
{ |
|
119 |
return total_steps; |
|
120 |
} |
|
121 |
||
122 |
inline int Q3ProgressBar::progress() const |
|
123 |
{ |
|
124 |
return progress_val; |
|
125 |
} |
|
126 |
||
127 |
inline const QString &Q3ProgressBar::progressString() const |
|
128 |
{ |
|
129 |
return progress_str; |
|
130 |
} |
|
131 |
||
132 |
inline bool Q3ProgressBar::centerIndicator() const |
|
133 |
{ |
|
134 |
return center_indicator; |
|
135 |
} |
|
136 |
||
137 |
inline bool Q3ProgressBar::percentageVisible() const |
|
138 |
{ |
|
139 |
return percentage_visible; |
|
140 |
} |
|
141 |
||
142 |
#endif // QT_NO_PROGRESSBAR |
|
143 |
||
144 |
QT_END_NAMESPACE |
|
145 |
||
146 |
QT_END_HEADER |
|
147 |
||
148 |
#endif // Q3PROGRESSBAR_H |