| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qprogressbar.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | - | |||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | class QProgressBarPrivate : public QWidgetPrivate | - | ||||||||||||||||||
| 8 | { | - | ||||||||||||||||||
| 9 | inline QProgressBar* q_func() { return static_cast<QProgressBar *>(q_ptr); } inline const QProgressBar* q_func() const { return static_cast<const QProgressBar *>(q_ptr); } friend class QProgressBar; | - | ||||||||||||||||||
| 10 | - | |||||||||||||||||||
| 11 | public: | - | ||||||||||||||||||
| 12 | QProgressBarPrivate(); | - | ||||||||||||||||||
| 13 | - | |||||||||||||||||||
| 14 | void init(); | - | ||||||||||||||||||
| 15 | void initDefaultFormat(); | - | ||||||||||||||||||
| 16 | inline void resetLayoutItemMargins(); | - | ||||||||||||||||||
| 17 | - | |||||||||||||||||||
| 18 | int minimum; | - | ||||||||||||||||||
| 19 | int maximum; | - | ||||||||||||||||||
| 20 | int value; | - | ||||||||||||||||||
| 21 | Qt::Alignment alignment; | - | ||||||||||||||||||
| 22 | uint textVisible : 1; | - | ||||||||||||||||||
| 23 | uint defaultFormat: 1; | - | ||||||||||||||||||
| 24 | int lastPaintedValue; | - | ||||||||||||||||||
| 25 | Qt::Orientation orientation; | - | ||||||||||||||||||
| 26 | bool invertedAppearance; | - | ||||||||||||||||||
| 27 | QProgressBar::Direction textDirection; | - | ||||||||||||||||||
| 28 | QString format; | - | ||||||||||||||||||
| 29 | inline int bound(int val) const { return never executed: qMax(minimum-1, qMin(maximum, val));return qMax(minimum-1, qMin(maximum, val));never executed: }return qMax(minimum-1, qMin(maximum, val)); | 0 | ||||||||||||||||||
| 30 | bool repaintRequired() const; | - | ||||||||||||||||||
| 31 | }; | - | ||||||||||||||||||
| 32 | - | |||||||||||||||||||
| 33 | QProgressBarPrivate::QProgressBarPrivate() | - | ||||||||||||||||||
| 34 | : minimum(0), maximum(100), value(-1), alignment(Qt::AlignLeft), textVisible(true), | - | ||||||||||||||||||
| 35 | defaultFormat(true), lastPaintedValue(-1), orientation(Qt::Horizontal), invertedAppearance(false), | - | ||||||||||||||||||
| 36 | textDirection(QProgressBar::TopToBottom) | - | ||||||||||||||||||
| 37 | { | - | ||||||||||||||||||
| 38 | initDefaultFormat(); | - | ||||||||||||||||||
| 39 | } never executed: end of block | 0 | ||||||||||||||||||
| 40 | - | |||||||||||||||||||
| 41 | void QProgressBarPrivate::initDefaultFormat() | - | ||||||||||||||||||
| 42 | { | - | ||||||||||||||||||
| 43 | if (defaultFormat
| 0 | ||||||||||||||||||
| 44 | format = QLatin1String("%p") + locale.percent(); never executed: format = QLatin1String("%p") + locale.percent(); | 0 | ||||||||||||||||||
| 45 | } never executed: end of block | 0 | ||||||||||||||||||
| 46 | - | |||||||||||||||||||
| 47 | void QProgressBarPrivate::init() | - | ||||||||||||||||||
| 48 | { | - | ||||||||||||||||||
| 49 | QProgressBar * const q = q_func(); | - | ||||||||||||||||||
| 50 | QSizePolicy sp(QSizePolicy::Expanding, QSizePolicy::Fixed); | - | ||||||||||||||||||
| 51 | if (orientation == Qt::Vertical
| 0 | ||||||||||||||||||
| 52 | sp.transpose(); never executed: sp.transpose(); | 0 | ||||||||||||||||||
| 53 | q->setSizePolicy(sp); | - | ||||||||||||||||||
| 54 | q->setAttribute(Qt::WA_WState_OwnSizePolicy, false); | - | ||||||||||||||||||
| 55 | resetLayoutItemMargins(); | - | ||||||||||||||||||
| 56 | } never executed: end of block | 0 | ||||||||||||||||||
| 57 | - | |||||||||||||||||||
| 58 | void QProgressBarPrivate::resetLayoutItemMargins() | - | ||||||||||||||||||
| 59 | { | - | ||||||||||||||||||
| 60 | QProgressBar * const q = q_func(); | - | ||||||||||||||||||
| 61 | QStyleOptionProgressBar option; | - | ||||||||||||||||||
| 62 | q->initStyleOption(&option); | - | ||||||||||||||||||
| 63 | setLayoutItemMargins(QStyle::SE_ProgressBarLayoutItem, &option); | - | ||||||||||||||||||
| 64 | } never executed: end of block | 0 | ||||||||||||||||||
| 65 | void QProgressBar::initStyleOption(QStyleOptionProgressBar *option) const | - | ||||||||||||||||||
| 66 | { | - | ||||||||||||||||||
| 67 | if (!option
| 0 | ||||||||||||||||||
| 68 | return; never executed: return; | 0 | ||||||||||||||||||
| 69 | const QProgressBarPrivate * const d = d_func(); | - | ||||||||||||||||||
| 70 | option->initFrom(this); | - | ||||||||||||||||||
| 71 | - | |||||||||||||||||||
| 72 | if (d->orientation == Qt::Horizontal
| 0 | ||||||||||||||||||
| 73 | option->state |= QStyle::State_Horizontal; never executed: option->state |= QStyle::State_Horizontal; | 0 | ||||||||||||||||||
| 74 | option->minimum = d->minimum; | - | ||||||||||||||||||
| 75 | option->maximum = d->maximum; | - | ||||||||||||||||||
| 76 | option->progress = d->value; | - | ||||||||||||||||||
| 77 | option->textAlignment = d->alignment; | - | ||||||||||||||||||
| 78 | option->textVisible = d->textVisible; | - | ||||||||||||||||||
| 79 | option->text = text(); | - | ||||||||||||||||||
| 80 | option->orientation = d->orientation; | - | ||||||||||||||||||
| 81 | option->invertedAppearance = d->invertedAppearance; | - | ||||||||||||||||||
| 82 | option->bottomToTop = d->textDirection == QProgressBar::BottomToTop; | - | ||||||||||||||||||
| 83 | } never executed: end of block | 0 | ||||||||||||||||||
| 84 | - | |||||||||||||||||||
| 85 | bool QProgressBarPrivate::repaintRequired() const | - | ||||||||||||||||||
| 86 | { | - | ||||||||||||||||||
| 87 | const QProgressBar * const q = q_func(); | - | ||||||||||||||||||
| 88 | if (value == lastPaintedValue
| 0 | ||||||||||||||||||
| 89 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 90 | - | |||||||||||||||||||
| 91 | int valueDifference = qAbs(value - lastPaintedValue); | - | ||||||||||||||||||
| 92 | - | |||||||||||||||||||
| 93 | - | |||||||||||||||||||
| 94 | if (value == minimum
| 0 | ||||||||||||||||||
| 95 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||
| 96 | if (textVisible
| 0 | ||||||||||||||||||
| 97 | if ((
| 0 | ||||||||||||||||||
| 98 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||
| 99 | if ((format.contains(QLatin1String("%p"))
| 0 | ||||||||||||||||||
| 100 | && valueDifference >= qAbs((maximum - minimum) / 100)
| 0 | ||||||||||||||||||
| 101 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||
| 102 | } never executed: end of block | 0 | ||||||||||||||||||
| 103 | - | |||||||||||||||||||
| 104 | - | |||||||||||||||||||
| 105 | QStyleOptionProgressBar opt; | - | ||||||||||||||||||
| 106 | q->initStyleOption(&opt); | - | ||||||||||||||||||
| 107 | int cw = q->style()->pixelMetric(QStyle::PM_ProgressBarChunkWidth, &opt, q); | - | ||||||||||||||||||
| 108 | QRect groove = q->style()->subElementRect(QStyle::SE_ProgressBarGroove, &opt, q); | - | ||||||||||||||||||
| 109 | - | |||||||||||||||||||
| 110 | - | |||||||||||||||||||
| 111 | - | |||||||||||||||||||
| 112 | int grooveBlock = (
| 0 | ||||||||||||||||||
| 113 | return never executed: (valueDifference * grooveBlock > cw * (maximum - minimum));return (valueDifference * grooveBlock > cw * (maximum - minimum));never executed: return (valueDifference * grooveBlock > cw * (maximum - minimum)); | 0 | ||||||||||||||||||
| 114 | } | - | ||||||||||||||||||
| 115 | QProgressBar::QProgressBar(QWidget *parent) | - | ||||||||||||||||||
| 116 | : QWidget(*(new QProgressBarPrivate), parent, 0) | - | ||||||||||||||||||
| 117 | { | - | ||||||||||||||||||
| 118 | d_func()->init(); | - | ||||||||||||||||||
| 119 | } never executed: end of block | 0 | ||||||||||||||||||
| 120 | - | |||||||||||||||||||
| 121 | - | |||||||||||||||||||
| 122 | - | |||||||||||||||||||
| 123 | - | |||||||||||||||||||
| 124 | QProgressBar::~QProgressBar() | - | ||||||||||||||||||
| 125 | { | - | ||||||||||||||||||
| 126 | } | - | ||||||||||||||||||
| 127 | - | |||||||||||||||||||
| 128 | - | |||||||||||||||||||
| 129 | - | |||||||||||||||||||
| 130 | - | |||||||||||||||||||
| 131 | - | |||||||||||||||||||
| 132 | - | |||||||||||||||||||
| 133 | void QProgressBar::reset() | - | ||||||||||||||||||
| 134 | { | - | ||||||||||||||||||
| 135 | QProgressBarPrivate * const d = d_func(); | - | ||||||||||||||||||
| 136 | d->value = d->minimum - 1; | - | ||||||||||||||||||
| 137 | if (d->minimum == (-2147483647 - 1)
| 0 | ||||||||||||||||||
| 138 | d->value = (-2147483647 - 1); never executed: d->value = (-2147483647 - 1); | 0 | ||||||||||||||||||
| 139 | repaint(); | - | ||||||||||||||||||
| 140 | } never executed: end of block | 0 | ||||||||||||||||||
| 141 | void QProgressBar::setMinimum(int minimum) | - | ||||||||||||||||||
| 142 | { | - | ||||||||||||||||||
| 143 | setRange(minimum, qMax(d_func()->maximum, minimum)); | - | ||||||||||||||||||
| 144 | } never executed: end of block | 0 | ||||||||||||||||||
| 145 | - | |||||||||||||||||||
| 146 | int QProgressBar::minimum() const | - | ||||||||||||||||||
| 147 | { | - | ||||||||||||||||||
| 148 | return never executed: d_func()->minimum;return d_func()->minimum;never executed: return d_func()->minimum; | 0 | ||||||||||||||||||
| 149 | } | - | ||||||||||||||||||
| 150 | void QProgressBar::setMaximum(int maximum) | - | ||||||||||||||||||
| 151 | { | - | ||||||||||||||||||
| 152 | setRange(qMin(d_func()->minimum, maximum), maximum); | - | ||||||||||||||||||
| 153 | } never executed: end of block | 0 | ||||||||||||||||||
| 154 | - | |||||||||||||||||||
| 155 | int QProgressBar::maximum() const | - | ||||||||||||||||||
| 156 | { | - | ||||||||||||||||||
| 157 | return never executed: d_func()->maximum;return d_func()->maximum;never executed: return d_func()->maximum; | 0 | ||||||||||||||||||
| 158 | } | - | ||||||||||||||||||
| 159 | void QProgressBar::setValue(int value) | - | ||||||||||||||||||
| 160 | { | - | ||||||||||||||||||
| 161 | QProgressBarPrivate * const d = d_func(); | - | ||||||||||||||||||
| 162 | if (d->value == value
| 0 | ||||||||||||||||||
| 163 | || ((value > d->maximum
| 0 | ||||||||||||||||||
| 164 | && (d->maximum != 0
| 0 | ||||||||||||||||||
| 165 | return; never executed: return; | 0 | ||||||||||||||||||
| 166 | d->value = value; | - | ||||||||||||||||||
| 167 | valueChanged(value); | - | ||||||||||||||||||
| 168 | - | |||||||||||||||||||
| 169 | if (isVisible()
| 0 | ||||||||||||||||||
| 170 | QAccessibleValueChangeEvent event(this, value); | - | ||||||||||||||||||
| 171 | QAccessible::updateAccessibility(&event); | - | ||||||||||||||||||
| 172 | } never executed: end of block | 0 | ||||||||||||||||||
| 173 | - | |||||||||||||||||||
| 174 | if (d->repaintRequired()
| 0 | ||||||||||||||||||
| 175 | repaint(); never executed: repaint(); | 0 | ||||||||||||||||||
| 176 | } never executed: end of block | 0 | ||||||||||||||||||
| 177 | - | |||||||||||||||||||
| 178 | int QProgressBar::value() const | - | ||||||||||||||||||
| 179 | { | - | ||||||||||||||||||
| 180 | return never executed: d_func()->value;return d_func()->value;never executed: return d_func()->value; | 0 | ||||||||||||||||||
| 181 | } | - | ||||||||||||||||||
| 182 | void QProgressBar::setRange(int minimum, int maximum) | - | ||||||||||||||||||
| 183 | { | - | ||||||||||||||||||
| 184 | QProgressBarPrivate * const d = d_func(); | - | ||||||||||||||||||
| 185 | if (minimum != d->minimum
| 0 | ||||||||||||||||||
| 186 | d->minimum = minimum; | - | ||||||||||||||||||
| 187 | d->maximum = qMax(minimum, maximum); | - | ||||||||||||||||||
| 188 | - | |||||||||||||||||||
| 189 | if (d->value < (d->minimum - 1)
| 0 | ||||||||||||||||||
| 190 | reset(); never executed: reset(); | 0 | ||||||||||||||||||
| 191 | else | - | ||||||||||||||||||
| 192 | update(); never executed: update(); | 0 | ||||||||||||||||||
| 193 | } | - | ||||||||||||||||||
| 194 | } never executed: end of block | 0 | ||||||||||||||||||
| 195 | void QProgressBar::setTextVisible(bool visible) | - | ||||||||||||||||||
| 196 | { | - | ||||||||||||||||||
| 197 | QProgressBarPrivate * const d = d_func(); | - | ||||||||||||||||||
| 198 | if (d->textVisible != visible
| 0 | ||||||||||||||||||
| 199 | d->textVisible = visible; | - | ||||||||||||||||||
| 200 | repaint(); | - | ||||||||||||||||||
| 201 | } never executed: end of block | 0 | ||||||||||||||||||
| 202 | } never executed: end of block | 0 | ||||||||||||||||||
| 203 | - | |||||||||||||||||||
| 204 | bool QProgressBar::isTextVisible() const | - | ||||||||||||||||||
| 205 | { | - | ||||||||||||||||||
| 206 | return never executed: d_func()->textVisible;return d_func()->textVisible;never executed: return d_func()->textVisible; | 0 | ||||||||||||||||||
| 207 | } | - | ||||||||||||||||||
| 208 | - | |||||||||||||||||||
| 209 | - | |||||||||||||||||||
| 210 | - | |||||||||||||||||||
| 211 | - | |||||||||||||||||||
| 212 | - | |||||||||||||||||||
| 213 | void QProgressBar::setAlignment(Qt::Alignment alignment) | - | ||||||||||||||||||
| 214 | { | - | ||||||||||||||||||
| 215 | if (d_func()->alignment != alignment
| 0 | ||||||||||||||||||
| 216 | d_func()->alignment = alignment; | - | ||||||||||||||||||
| 217 | repaint(); | - | ||||||||||||||||||
| 218 | } never executed: end of block | 0 | ||||||||||||||||||
| 219 | } never executed: end of block | 0 | ||||||||||||||||||
| 220 | - | |||||||||||||||||||
| 221 | Qt::Alignment QProgressBar::alignment() const | - | ||||||||||||||||||
| 222 | { | - | ||||||||||||||||||
| 223 | return never executed: d_func()->alignment;return d_func()->alignment;never executed: return d_func()->alignment; | 0 | ||||||||||||||||||
| 224 | } | - | ||||||||||||||||||
| 225 | - | |||||||||||||||||||
| 226 | - | |||||||||||||||||||
| 227 | - | |||||||||||||||||||
| 228 | - | |||||||||||||||||||
| 229 | void QProgressBar::paintEvent(QPaintEvent *) | - | ||||||||||||||||||
| 230 | { | - | ||||||||||||||||||
| 231 | QStylePainter paint(this); | - | ||||||||||||||||||
| 232 | QStyleOptionProgressBar opt; | - | ||||||||||||||||||
| 233 | initStyleOption(&opt); | - | ||||||||||||||||||
| 234 | paint.drawControl(QStyle::CE_ProgressBar, opt); | - | ||||||||||||||||||
| 235 | d_func()->lastPaintedValue = d_func()->value; | - | ||||||||||||||||||
| 236 | } never executed: end of block | 0 | ||||||||||||||||||
| 237 | - | |||||||||||||||||||
| 238 | - | |||||||||||||||||||
| 239 | - | |||||||||||||||||||
| 240 | - | |||||||||||||||||||
| 241 | QSize QProgressBar::sizeHint() const | - | ||||||||||||||||||
| 242 | { | - | ||||||||||||||||||
| 243 | ensurePolished(); | - | ||||||||||||||||||
| 244 | QFontMetrics fm = fontMetrics(); | - | ||||||||||||||||||
| 245 | QStyleOptionProgressBar opt; | - | ||||||||||||||||||
| 246 | initStyleOption(&opt); | - | ||||||||||||||||||
| 247 | int cw = style()->pixelMetric(QStyle::PM_ProgressBarChunkWidth, &opt, this); | - | ||||||||||||||||||
| 248 | QSize size = QSize(qMax(9, cw) * 7 + fm.width(QLatin1Char('0')) * 4, fm.height() + 8); | - | ||||||||||||||||||
| 249 | if (opt.orientation == Qt::Vertical
| 0 | ||||||||||||||||||
| 250 | size = size.transposed(); never executed: size = size.transposed(); | 0 | ||||||||||||||||||
| 251 | return never executed: style()->sizeFromContents(QStyle::CT_ProgressBar, &opt, size, this);return style()->sizeFromContents(QStyle::CT_ProgressBar, &opt, size, this);never executed: return style()->sizeFromContents(QStyle::CT_ProgressBar, &opt, size, this); | 0 | ||||||||||||||||||
| 252 | } | - | ||||||||||||||||||
| 253 | - | |||||||||||||||||||
| 254 | - | |||||||||||||||||||
| 255 | - | |||||||||||||||||||
| 256 | - | |||||||||||||||||||
| 257 | QSize QProgressBar::minimumSizeHint() const | - | ||||||||||||||||||
| 258 | { | - | ||||||||||||||||||
| 259 | QSize size; | - | ||||||||||||||||||
| 260 | if (orientation() == Qt::Horizontal
| 0 | ||||||||||||||||||
| 261 | size = QSize(sizeHint().width(), fontMetrics().height() + 2); never executed: size = QSize(sizeHint().width(), fontMetrics().height() + 2); | 0 | ||||||||||||||||||
| 262 | else | - | ||||||||||||||||||
| 263 | size = QSize(fontMetrics().height() + 2, sizeHint().height()); never executed: size = QSize(fontMetrics().height() + 2, sizeHint().height()); | 0 | ||||||||||||||||||
| 264 | return never executed: size;return size;never executed: return size; | 0 | ||||||||||||||||||
| 265 | } | - | ||||||||||||||||||
| 266 | QString QProgressBar::text() const | - | ||||||||||||||||||
| 267 | { | - | ||||||||||||||||||
| 268 | const QProgressBarPrivate * const d = d_func(); | - | ||||||||||||||||||
| 269 | if ((d->maximum == 0
| 0 | ||||||||||||||||||
| 270 | || (d->value == (-2147483647 - 1)
| 0 | ||||||||||||||||||
| 271 | return never executed: QString();return QString();never executed: return QString(); | 0 | ||||||||||||||||||
| 272 | - | |||||||||||||||||||
| 273 | qint64 totalSteps = qint64(d->maximum) - d->minimum; | - | ||||||||||||||||||
| 274 | - | |||||||||||||||||||
| 275 | QString result = d->format; | - | ||||||||||||||||||
| 276 | QLocale locale = d->locale; | - | ||||||||||||||||||
| 277 | locale.setNumberOptions(locale.numberOptions() | QLocale::OmitGroupSeparator); | - | ||||||||||||||||||
| 278 | result.replace(QLatin1String("%m"), locale.toString(totalSteps)); | - | ||||||||||||||||||
| 279 | result.replace(QLatin1String("%v"), locale.toString(d->value)); | - | ||||||||||||||||||
| 280 | - | |||||||||||||||||||
| 281 | - | |||||||||||||||||||
| 282 | - | |||||||||||||||||||
| 283 | - | |||||||||||||||||||
| 284 | if (totalSteps == 0
| 0 | ||||||||||||||||||
| 285 | result.replace(QLatin1String("%p"), locale.toString(int(100))); | - | ||||||||||||||||||
| 286 | return never executed: result;return result;never executed: return result; | 0 | ||||||||||||||||||
| 287 | } | - | ||||||||||||||||||
| 288 | - | |||||||||||||||||||
| 289 | int progress = (qreal(d->value) - d->minimum) * 100.0 / totalSteps; | - | ||||||||||||||||||
| 290 | result.replace(QLatin1String("%p"), locale.toString(progress)); | - | ||||||||||||||||||
| 291 | return never executed: result;return result;never executed: return result; | 0 | ||||||||||||||||||
| 292 | } | - | ||||||||||||||||||
| 293 | void QProgressBar::setOrientation(Qt::Orientation orientation) | - | ||||||||||||||||||
| 294 | { | - | ||||||||||||||||||
| 295 | QProgressBarPrivate * const d = d_func(); | - | ||||||||||||||||||
| 296 | if (d->orientation == orientation
| 0 | ||||||||||||||||||
| 297 | return; never executed: return; | 0 | ||||||||||||||||||
| 298 | d->orientation = orientation; | - | ||||||||||||||||||
| 299 | if (!testAttribute(Qt::WA_WState_OwnSizePolicy)
| 0 | ||||||||||||||||||
| 300 | QSizePolicy sp = sizePolicy(); | - | ||||||||||||||||||
| 301 | sp.transpose(); | - | ||||||||||||||||||
| 302 | setSizePolicy(sp); | - | ||||||||||||||||||
| 303 | setAttribute(Qt::WA_WState_OwnSizePolicy, false); | - | ||||||||||||||||||
| 304 | } never executed: end of block | 0 | ||||||||||||||||||
| 305 | d->resetLayoutItemMargins(); | - | ||||||||||||||||||
| 306 | update(); | - | ||||||||||||||||||
| 307 | updateGeometry(); | - | ||||||||||||||||||
| 308 | } never executed: end of block | 0 | ||||||||||||||||||
| 309 | - | |||||||||||||||||||
| 310 | Qt::Orientation QProgressBar::orientation() const | - | ||||||||||||||||||
| 311 | { | - | ||||||||||||||||||
| 312 | const QProgressBarPrivate * const d = d_func(); | - | ||||||||||||||||||
| 313 | return never executed: d->orientation;return d->orientation;never executed: return d->orientation; | 0 | ||||||||||||||||||
| 314 | } | - | ||||||||||||||||||
| 315 | void QProgressBar::setInvertedAppearance(bool invert) | - | ||||||||||||||||||
| 316 | { | - | ||||||||||||||||||
| 317 | QProgressBarPrivate * const d = d_func(); | - | ||||||||||||||||||
| 318 | d->invertedAppearance = invert; | - | ||||||||||||||||||
| 319 | update(); | - | ||||||||||||||||||
| 320 | } never executed: end of block | 0 | ||||||||||||||||||
| 321 | - | |||||||||||||||||||
| 322 | bool QProgressBar::invertedAppearance() const | - | ||||||||||||||||||
| 323 | { | - | ||||||||||||||||||
| 324 | const QProgressBarPrivate * const d = d_func(); | - | ||||||||||||||||||
| 325 | return never executed: d->invertedAppearance;return d->invertedAppearance;never executed: return d->invertedAppearance; | 0 | ||||||||||||||||||
| 326 | } | - | ||||||||||||||||||
| 327 | void QProgressBar::setTextDirection(QProgressBar::Direction textDirection) | - | ||||||||||||||||||
| 328 | { | - | ||||||||||||||||||
| 329 | QProgressBarPrivate * const d = d_func(); | - | ||||||||||||||||||
| 330 | d->textDirection = textDirection; | - | ||||||||||||||||||
| 331 | update(); | - | ||||||||||||||||||
| 332 | } never executed: end of block | 0 | ||||||||||||||||||
| 333 | - | |||||||||||||||||||
| 334 | QProgressBar::Direction QProgressBar::textDirection() const | - | ||||||||||||||||||
| 335 | { | - | ||||||||||||||||||
| 336 | const QProgressBarPrivate * const d = d_func(); | - | ||||||||||||||||||
| 337 | return never executed: d->textDirection;return d->textDirection;never executed: return d->textDirection; | 0 | ||||||||||||||||||
| 338 | } | - | ||||||||||||||||||
| 339 | - | |||||||||||||||||||
| 340 | - | |||||||||||||||||||
| 341 | bool QProgressBar::event(QEvent *e) | - | ||||||||||||||||||
| 342 | { | - | ||||||||||||||||||
| 343 | QProgressBarPrivate * const d = d_func(); | - | ||||||||||||||||||
| 344 | switch (e->type()) { | - | ||||||||||||||||||
| 345 | case never executed: QEvent::StyleChange:case QEvent::StyleChange:never executed: case QEvent::StyleChange: | 0 | ||||||||||||||||||
| 346 | - | |||||||||||||||||||
| 347 | - | |||||||||||||||||||
| 348 | - | |||||||||||||||||||
| 349 | d->resetLayoutItemMargins(); | - | ||||||||||||||||||
| 350 | break; never executed: break; | 0 | ||||||||||||||||||
| 351 | case never executed: QEvent::LocaleChange:case QEvent::LocaleChange:never executed: case QEvent::LocaleChange: | 0 | ||||||||||||||||||
| 352 | d->initDefaultFormat(); | - | ||||||||||||||||||
| 353 | break; never executed: break; | 0 | ||||||||||||||||||
| 354 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 355 | break; never executed: break; | 0 | ||||||||||||||||||
| 356 | } | - | ||||||||||||||||||
| 357 | return never executed: QWidget::event(e);return QWidget::event(e);never executed: return QWidget::event(e); | 0 | ||||||||||||||||||
| 358 | } | - | ||||||||||||||||||
| 359 | void QProgressBar::setFormat(const QString &format) | - | ||||||||||||||||||
| 360 | { | - | ||||||||||||||||||
| 361 | QProgressBarPrivate * const d = d_func(); | - | ||||||||||||||||||
| 362 | if (d->format == format
| 0 | ||||||||||||||||||
| 363 | return; never executed: return; | 0 | ||||||||||||||||||
| 364 | d->format = format; | - | ||||||||||||||||||
| 365 | d->defaultFormat = false; | - | ||||||||||||||||||
| 366 | update(); | - | ||||||||||||||||||
| 367 | } never executed: end of block | 0 | ||||||||||||||||||
| 368 | - | |||||||||||||||||||
| 369 | void QProgressBar::resetFormat() | - | ||||||||||||||||||
| 370 | { | - | ||||||||||||||||||
| 371 | QProgressBarPrivate * const d = d_func(); | - | ||||||||||||||||||
| 372 | d->defaultFormat = true; | - | ||||||||||||||||||
| 373 | d->initDefaultFormat(); | - | ||||||||||||||||||
| 374 | update(); | - | ||||||||||||||||||
| 375 | } never executed: end of block | 0 | ||||||||||||||||||
| 376 | - | |||||||||||||||||||
| 377 | QString QProgressBar::format() const | - | ||||||||||||||||||
| 378 | { | - | ||||||||||||||||||
| 379 | const QProgressBarPrivate * const d = d_func(); | - | ||||||||||||||||||
| 380 | return never executed: d->format;return d->format;never executed: return d->format; | 0 | ||||||||||||||||||
| 381 | } | - | ||||||||||||||||||
| 382 | - | |||||||||||||||||||
| 383 | - | |||||||||||||||||||
| 384 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |