157 Q_Q(HbProgressBar); |
159 Q_Q(HbProgressBar); |
158 |
160 |
159 mMinTextItem = q->style()->createPrimitive(HbStyle::P_ProgressBar_mintext,q); |
161 mMinTextItem = q->style()->createPrimitive(HbStyle::P_ProgressBar_mintext,q); |
160 mMaxTextItem = q->style()->createPrimitive(HbStyle::P_ProgressBar_maxtext,q); |
162 mMaxTextItem = q->style()->createPrimitive(HbStyle::P_ProgressBar_maxtext,q); |
161 } |
163 } |
162 |
164 void HbProgressBarPrivate::setProgressValue(int value) |
163 /*! |
165 { |
|
166 Q_Q(HbProgressBar); |
|
167 if (mProgressValue == value) { |
|
168 return; |
|
169 } |
|
170 if (value >= mMaximum) { |
|
171 value = mMaximum; |
|
172 #ifdef HB_EFFECTS |
|
173 HbEffect::start(mTrack, HB_PRGRESSBAR_ITEM_TYPE, "progressbar_progress_complete"); |
|
174 #endif |
|
175 } |
|
176 else if (value < mMinimum) { |
|
177 value = mMinimum; |
|
178 } |
|
179 |
|
180 mProgressValue=value; |
|
181 |
|
182 //redraw track |
|
183 HbStyleOptionProgressBar progressBarOption; |
|
184 q->initStyleOption(&progressBarOption); |
|
185 if(mTrack) { |
|
186 q->style()->updatePrimitive(mTrack, HbStyle::P_ProgressBar_track, &progressBarOption); |
|
187 } |
|
188 |
|
189 emit q->valueChanged(value); |
|
190 |
|
191 } |
|
192 /* |
|
193 \internal |
|
194 Sets the progressbar enabling/disabling |
|
195 */ |
|
196 void HbProgressBarPrivate::setEnableFlag(bool flag) |
|
197 { |
|
198 Q_Q(HbProgressBar); |
|
199 if(!flag) { |
|
200 q->setProgressValue(q->minimum()); |
|
201 |
|
202 } |
|
203 } |
|
204 /* |
164 \internal |
205 \internal |
165 Sets the progressbar range |
206 Sets the progressbar range |
166 */ |
207 */ |
167 void HbProgressBarPrivate::setRange(int minimum, int maximum) |
208 void HbProgressBarPrivate::setRange(int minimum, int maximum) |
168 { |
209 { |
217 |
258 |
218 if (status.reason != Hb::EffectNotStarted) { |
259 if (status.reason != Hb::EffectNotStarted) { |
219 q->setVisible(false); |
260 q->setVisible(false); |
220 } |
261 } |
221 } |
262 } |
|
263 |
|
264 /*! |
|
265 \internal |
|
266 Private slot which delays the show effect. |
|
267 */ |
|
268 void HbProgressBarPrivate::_q_delayedShow(HbEffect::EffectStatus status) |
|
269 { |
|
270 Q_UNUSED(status); |
|
271 mShowEffectInProgress = false; |
|
272 } |
222 #endif |
273 #endif |
223 |
274 |
224 /*! |
275 /*! |
225 Constructs a progressbar of a given \a type and \a parent. The default type is SimpleProgressBar. |
276 Constructs a progressbar of a given \a type and \a parent. The default type is SimpleProgressBar. |
226 |
277 |
227 \deprecated HbProgressBar::HbProgressBar(HbProgressBar::ProgressBarType, QGraphicsItem*) |
278 \deprecated HbProgressBar::HbProgressBar(HbProgressBar::ProgressBarType, QGraphicsItem*) |
228 is deprecated. Please use HbProgressBar::HbProgressBar(QGraphicsItem *parent) instead. |
279 is deprecated. Please use HbProgressBar::HbProgressBar(QGraphicsItem *parent) instead. |
|
280 |
229 */ |
281 */ |
230 HbProgressBar::HbProgressBar(ProgressBarType type, QGraphicsItem *parent) : |
282 HbProgressBar::HbProgressBar(ProgressBarType type, QGraphicsItem *parent) : |
231 HbWidget(*new HbProgressBarPrivate, parent) |
283 HbWidget(*new HbProgressBarPrivate, parent) |
232 { |
284 { |
|
285 HB_DEPRECATED("HbProgressBar::HbProgressBar(HbProgressBar::ProgressBarType, QGraphicsItem*) is deprecated. Use HbProgressBar::HbProgressBar(QGraphicsItem *parent) instead."); |
|
286 |
233 Q_D( HbProgressBar ); |
287 Q_D( HbProgressBar ); |
234 d->q_ptr = this; |
288 d->q_ptr = this; |
235 d->init(); |
289 d->init(); |
236 d->mType = type; |
290 d->mType = type; |
237 } |
291 } |
238 |
292 |
239 /*! |
293 /*! |
240 @beta |
294 @beta |
241 Constructs a progressbar of a given \a parent. |
295 Constructor of Progressbar. |
|
296 \param parent. Parent widget |
|
297 |
242 */ |
298 */ |
243 HbProgressBar::HbProgressBar(QGraphicsItem *parent) : |
299 HbProgressBar::HbProgressBar(QGraphicsItem *parent) : |
244 HbWidget(*new HbProgressBarPrivate, parent) |
300 HbWidget(*new HbProgressBarPrivate, parent) |
245 { |
301 { |
246 Q_D( HbProgressBar ); |
302 Q_D( HbProgressBar ); |
249 } |
305 } |
250 |
306 |
251 /*! |
307 /*! |
252 \deprecated HbProgressBar::HbProgressBar(HbProgressBarPrivate&, HbProgressBar::ProgressBarType, QGraphicsItem*) |
308 \deprecated HbProgressBar::HbProgressBar(HbProgressBarPrivate&, HbProgressBar::ProgressBarType, QGraphicsItem*) |
253 is deprecated. Please use HbProgressBar::HbProgressBar(HbProgressBarPrivate &dd, QGraphicsItem *parent) instead. |
309 is deprecated. Please use HbProgressBar::HbProgressBar(HbProgressBarPrivate &dd, QGraphicsItem *parent) instead. |
|
310 |
254 */ |
311 */ |
255 HbProgressBar::HbProgressBar(HbProgressBarPrivate &dd, ProgressBarType type, QGraphicsItem *parent) : |
312 HbProgressBar::HbProgressBar(HbProgressBarPrivate &dd, ProgressBarType type, QGraphicsItem *parent) : |
256 HbWidget( dd, parent) |
313 HbWidget( dd, parent) |
257 { |
314 { |
|
315 HB_DEPRECATED("HbProgressBar::HbProgressBar(HbProgressBarPrivate&, HbProgressBar::ProgressBarType, QGraphicsItem*) is deprecated. Use HbProgressBar::HbProgressBar(HbProgressBarPrivate &dd, QGraphicsItem *parent) instead."); |
|
316 |
258 Q_D( HbProgressBar ); |
317 Q_D( HbProgressBar ); |
259 d->init(); |
318 d->init(); |
260 d->mType = type; |
319 d->mType = type; |
261 } |
320 } |
262 |
321 |
277 { |
336 { |
278 } |
337 } |
279 |
338 |
280 /*! |
339 /*! |
281 @beta |
340 @beta |
282 This property holds whether or not a progress bar shows its progress inverted. The function |
341 Return the inverted appearence property. |
283 returns the value of this property. |
342 |
284 |
343 \sa setInvertedAppearance() |
285 Not implemented yet. |
344 */ |
286 |
|
287 \sa setInvertedAppearance() |
|
288 */ |
|
289 bool HbProgressBar::invertedAppearance() const |
345 bool HbProgressBar::invertedAppearance() const |
290 { |
346 { |
291 Q_D( const HbProgressBar ); |
347 Q_D( const HbProgressBar ); |
292 return d->mInvertedAppearance; |
348 return d->mInvertedAppearance; |
293 } |
349 } |
294 |
350 |
295 /*! |
351 /*! |
296 @beta |
352 @beta |
297 This property holds whether or not a progress bar shows its progress inverted. The function |
353 Sets the inverted appearence. If this is true progress grows from right to |
298 sets the property to the \a inverted value. |
354 left otherwise left to right. |
299 |
355 |
300 Not implemented yet. |
356 \param inverted true or false. |
301 |
357 |
302 \sa invertedAppearance() |
358 \sa invertedAppearance() |
303 */ |
359 */ |
304 void HbProgressBar::setInvertedAppearance(bool inverted) |
360 void HbProgressBar::setInvertedAppearance(bool inverted) |
305 { |
361 { |
306 Q_D( HbProgressBar ); |
362 Q_D( HbProgressBar ); |
307 d->mInvertedAppearance=inverted; |
363 d->mInvertedAppearance=inverted; |
308 updatePrimitives(); |
364 updatePrimitives(); |
309 } |
365 } |
310 |
366 |
311 /*! |
367 /*! |
312 @beta |
368 @beta |
313 Returns the maximum value of the progress bar. |
369 Returns the maximum value of the progressbar. By default it is 100. |
314 |
|
315 The default value is \c 100. |
|
316 |
370 |
317 \sa setMaximum() |
371 \sa setMaximum() |
318 */ |
372 */ |
319 int HbProgressBar::maximum() const |
373 int HbProgressBar::maximum() const |
320 { |
374 { |
322 return d->mMaximum; |
376 return d->mMaximum; |
323 } |
377 } |
324 |
378 |
325 /*! |
379 /*! |
326 @beta |
380 @beta |
327 Sets the maximum value of the progress bar. |
381 Sets the maximum value of the progressbar. By default it is 100. |
328 when setting this property, the minimum is adjusted to ensure |
382 |
329 that the range remains valid. |
383 \param maximum the max value |
330 |
384 |
331 \sa maximum(),minimum(),setMinimum() |
385 \sa maximum() |
332 */ |
386 */ |
333 void HbProgressBar::setMaximum(int maximum) |
387 void HbProgressBar::setMaximum(int maximum) |
334 { |
388 { |
335 Q_D( HbProgressBar ); |
389 Q_D( HbProgressBar ); |
336 d->setRange(qMin(d->mMinimum,maximum),maximum); |
390 d->setRange(qMin(d->mMinimum,maximum),maximum); |
337 } |
391 } |
338 |
392 |
339 /*! |
393 /*! |
340 @beta |
394 @beta |
341 Returns the minimum value of the progress bar. |
395 Returns the minimum value of the progressbar. By default it is 0. |
342 |
|
343 The default value is \c 0. |
|
344 |
396 |
345 \sa setMinimum() |
397 \sa setMinimum() |
346 */ |
398 */ |
347 int HbProgressBar::minimum() const |
399 int HbProgressBar::minimum() const |
348 { |
400 { |
350 return d->mMinimum; |
402 return d->mMinimum; |
351 } |
403 } |
352 |
404 |
353 /*! |
405 /*! |
354 @beta |
406 @beta |
355 Sets the minimum value of the progress bar. |
407 Sets the minimum value of the progressbar. By default it is 0. |
356 when setting this property, the maximum is adjusted to ensure |
408 |
357 that the range remains valid. |
409 \param maximum the max value |
358 |
410 |
359 \sa maximum(),minimum(),setMaximum() |
411 \sa minimum() |
360 |
|
361 */ |
412 */ |
362 void HbProgressBar::setMinimum(int minimum) |
413 void HbProgressBar::setMinimum(int minimum) |
363 { |
414 { |
364 Q_D( HbProgressBar ); |
415 Q_D( HbProgressBar ); |
365 d->setRange(minimum,qMax(d->mMaximum,minimum)); |
416 d->setRange(minimum,qMax(d->mMaximum,minimum)); |
366 } |
417 } |
367 |
418 |
368 /*! |
419 /*! |
369 @beta |
420 @beta |
370 Returns the current value of the progress bar. |
421 Returns the current value of the progress bar. |
371 |
422 \sa setProgressValue() |
372 The default progressValue is \c 0. |
|
373 */ |
423 */ |
374 int HbProgressBar::progressValue() const |
424 int HbProgressBar::progressValue() const |
375 { |
425 { |
376 Q_D( const HbProgressBar ); |
426 Q_D( const HbProgressBar ); |
377 return d->mProgressValue; |
427 return d->mProgressValue; |
378 } |
428 } |
379 |
429 |
380 /*! |
430 /*! |
381 @beta |
431 @beta |
382 Sets the current value of the progress bar. |
432 Sets the progress value of the progressbar. |
383 |
433 |
384 The progress bar forces the value to be within the legal range: \b |
434 \param value the progress value |
385 minimum <= \c value <= \b maximum. |
|
386 |
435 |
387 \sa progressValue() |
436 \sa progressValue() |
388 */ |
437 */ |
389 void HbProgressBar::setProgressValue(int value) |
438 void HbProgressBar::setProgressValue(int value) |
390 { |
439 { |
391 Q_D( HbProgressBar ); |
440 Q_D( HbProgressBar ); |
392 if (d->mProgressValue == value) { |
441 d->setProgressValue(value); |
393 return; |
|
394 } |
|
395 if (value >= d->mMaximum) { |
|
396 value = d->mMaximum; |
|
397 #ifdef HB_EFFECTS |
|
398 HbEffect::start(d->mTrack, HB_PRGRESSBAR_ITEM_TYPE, "progressbar_progress_complete"); |
|
399 #endif |
|
400 } |
|
401 else if (value<d->mMinimum) { |
|
402 value = d->mMinimum; |
|
403 } |
|
404 d->mProgressValue=value; |
|
405 |
|
406 //redraw track |
|
407 HbStyleOptionProgressBar progressBarOption; |
|
408 initStyleOption(&progressBarOption); |
|
409 if(d->mTrack) { |
|
410 style()->updatePrimitive(d->mTrack, HbStyle::P_ProgressBar_track, &progressBarOption); |
|
411 } |
|
412 |
|
413 emit valueChanged(value); |
|
414 } |
442 } |
415 |
443 |
416 /*! |
444 /*! |
417 @beta |
445 @beta |
418 This function is provided for convenience. |
446 This function is provided for convenience. |
419 |
447 |
420 Sets the progress bar's minimum to \a minimum and its maximum to \a max. |
448 Sets the progress bar's minimum and its maximum. |
421 |
449 |
422 If \a maximum is smaller than minimum, minimum becomes the only valid legal |
450 If maximum is smaller than minimum, minimum becomes the only valid legal |
423 value. |
451 value. |
424 |
452 |
425 \sa setMinimum(), setMaximum() |
453 \param minimum the minimum value |
|
454 \param maximum the maximum value |
426 */ |
455 */ |
427 void HbProgressBar::setRange(int minimum, int maximum) |
456 void HbProgressBar::setRange(int minimum, int maximum) |
428 { |
457 { |
429 Q_D( HbProgressBar ); |
458 Q_D( HbProgressBar ); |
430 d->setRange(minimum , maximum); |
459 d->setRange(minimum , maximum); |
431 } |
460 } |
432 |
461 |
433 /*! |
462 /*! |
434 @beta |
463 @beta |
435 Set the \a Min text shown on the progressbar. |
464 Sets the min text string. |
436 \sa text() |
465 |
|
466 \param text mintext string |
|
467 |
|
468 \sa minText() |
437 */ |
469 */ |
438 void HbProgressBar::setMinText(const QString &text) |
470 void HbProgressBar::setMinText(const QString &text) |
439 { |
471 { |
440 Q_D(HbProgressBar); |
472 Q_D(HbProgressBar); |
441 if (d->mMinText != text) { |
473 if (d->mMinText != text) { |
447 } |
479 } |
448 |
480 |
449 /*! |
481 /*! |
450 @beta |
482 @beta |
451 Returns the Min Text of the progress bar. |
483 Returns the Min Text of the progress bar. |
452 |
484 \sa setMinText() |
453 The default progressValue is \c 0. |
|
454 */ |
485 */ |
455 QString HbProgressBar::minText() const |
486 QString HbProgressBar::minText() const |
456 { |
487 { |
457 Q_D( const HbProgressBar ); |
488 Q_D( const HbProgressBar ); |
458 return d->mMinText; |
489 return d->mMinText; |
459 } |
490 } |
460 |
491 |
461 /*! |
492 /*! |
462 @beta |
493 @beta |
463 Set the \a Max text shown on the progressbar. |
494 Sets the max text string. |
464 \sa text() |
495 |
|
496 \param text max text string |
|
497 |
|
498 \sa maxText() |
465 */ |
499 */ |
466 void HbProgressBar::setMaxText(const QString &text) |
500 void HbProgressBar::setMaxText(const QString &text) |
467 { |
501 { |
468 Q_D(HbProgressBar); |
502 Q_D(HbProgressBar); |
469 if (d->mMaxText != text) { |
503 if (d->mMaxText != text) { |
470 d->mMaxText = text; |
504 d->mMaxText = text; |
471 HbStyleOptionProgressBar progressBarOption; |
505 HbStyleOptionProgressBar progressBarOption; |
472 initStyleOption(&progressBarOption); |
506 initStyleOption(&progressBarOption); |
473 style()->updatePrimitive(d->mMaxTextItem,HbStyle::P_ProgressBar_maxtext,&progressBarOption); |
507 style()->updatePrimitive(d->mMaxTextItem,HbStyle::P_ProgressBar_maxtext,&progressBarOption); |
475 } |
509 } |
476 |
510 |
477 /*! |
511 /*! |
478 @beta |
512 @beta |
479 Returns the Max Text of the progress bar. |
513 Returns the Max Text of the progress bar. |
480 |
514 \sa setMaxText() |
481 The default progressValue is \c 0. |
|
482 */ |
515 */ |
483 QString HbProgressBar::maxText() const |
516 QString HbProgressBar::maxText() const |
484 { |
517 { |
485 Q_D( const HbProgressBar ); |
518 Q_D( const HbProgressBar ); |
486 return d->mMaxText; |
519 return d->mMaxText; |
487 } |
520 } |
488 |
521 |
489 /*! |
522 /*! |
490 @beta |
523 @beta |
491 Set the MinMaxtext visibility \a true for showing text,false for hiding the text. |
524 Set the MinMaxtext visibility. true for showing text,false for hiding the text. |
492 The default is \c false. Min Max text doesnt have a background and would have a transparent background. |
525 The default is false. Min Max text doesnt have a background and would have a transparent background. |
|
526 \param visible true or false. |
493 \sa isMinMaxTextVisible(). |
527 \sa isMinMaxTextVisible(). |
494 */ |
528 */ |
495 void HbProgressBar::setMinMaxTextVisible(bool visible) |
529 void HbProgressBar::setMinMaxTextVisible(bool visible) |
496 { |
530 { |
497 Q_D(HbProgressBar); |
531 Q_D(HbProgressBar); |
515 } |
549 } |
516 } |
550 } |
517 |
551 |
518 /*! |
552 /*! |
519 @beta |
553 @beta |
520 This property holds whether the MinMax text should be displayed. |
554 Returns the MinMax visibility. |
521 Return the value of this property. |
555 \sa setMinMaxTextVisible() |
522 |
|
523 \sa setMinMaxTextVisibile() |
|
524 */ |
556 */ |
525 bool HbProgressBar::isMinMaxTextVisible() const |
557 bool HbProgressBar::isMinMaxTextVisible() const |
526 { |
558 { |
527 Q_D(const HbProgressBar); |
559 Q_D(const HbProgressBar); |
528 return d->mMinMaxTextVisible; |
560 return d->mMinMaxTextVisible; |
529 } |
561 } |
530 |
562 |
531 /*! |
563 /*! |
532 @beta |
564 @beta |
533 Sets the Min-Max text alignment |
565 Sets the Min-Max text alignment |
534 |
566 |
535 Supportted alignments are (in both horizontal and vertical orientations) |
567 Supportted alignments are (in both horizontal and vertical orientations) |
536 Qt::AlignTop |
568 Qt::AlignTop |
537 Qt::AlignBottom |
569 Qt::AlignBottom |
538 Qt::AlignCenter |
570 Qt::AlignCenter |
539 |
571 |
540 In Vertical orienatation, |
572 In Vertical orienatation, |
541 AlignTop is equivalent to Left |
573 AlignTop is equivalent to Left |
542 AlignBottom is equivalent to Right |
574 AlignBottom is equivalent to Right |
543 |
575 |
|
576 \param alignment alignement for the min max text |
|
577 \sa isMinMaxTextVisible(). |
|
578 |
544 */ |
579 */ |
545 void HbProgressBar::setMinMaxTextAlignment(Qt::Alignment alignment) |
580 void HbProgressBar::setMinMaxTextAlignment(Qt::Alignment alignment) |
546 { |
581 { |
547 Q_D(HbProgressBar); |
582 Q_D(HbProgressBar); |
548 if( (alignment != Qt::AlignBottom) && (alignment != Qt::AlignTop) && (alignment != Qt::AlignCenter) ) { |
583 if( (alignment != Qt::AlignBottom) && (alignment != Qt::AlignTop) && (alignment != Qt::AlignCenter) ) { |
549 return; |
584 return; |
550 } |
585 } |
551 if (d->mMinMaxTextAlignment != alignment) { |
586 if (d->mMinMaxTextAlignment != alignment) { |
552 d->mMinMaxTextAlignment = alignment; |
587 d->mMinMaxTextAlignment = alignment; |
553 if (d->mMinMaxTextVisible) { |
588 if (d->mMinMaxTextVisible) { |
554 repolish(); |
589 repolish(); |
555 } |
590 } |
556 updatePrimitives(); |
591 updatePrimitives(); |
557 } |
592 } |
558 |
593 |
559 } |
594 } |
560 /*! |
595 /*! |
561 @beta |
596 @beta |
562 Returns the minmax Text alignment. |
597 Returns the minmax Text alignment. |
|
598 \sa setMinMaxTextAlignment(). |
563 |
599 |
564 */ |
600 */ |
565 Qt::Alignment HbProgressBar::minMaxTextAlignment() const |
601 Qt::Alignment HbProgressBar::minMaxTextAlignment() const |
566 { |
602 { |
567 Q_D(const HbProgressBar); |
603 Q_D(const HbProgressBar); |
568 return d->mMinMaxTextAlignment; |
604 return d->mMinMaxTextAlignment; |
569 } |
605 } |
570 |
606 |
571 /*! |
607 /*! |
572 @beta |
608 @beta |
573 sets the orientation of the progressbar.It can be vertical or horizontal. |
609 sets the orientation of the progressbar.It can be vertical or horizontal. |
|
610 \param orientation Horizontal or Vertical |
|
611 \sa orientation(). |
574 */ |
612 */ |
575 void HbProgressBar::setOrientation(Qt::Orientation orientation) |
613 void HbProgressBar::setOrientation(Qt::Orientation orientation) |
576 { |
614 { |
577 //TODO: Add vertical slider related info. |
615 //TODO: Add vertical slider related info. |
578 Q_D(HbProgressBar); |
616 Q_D(HbProgressBar); |
635 if (d->mWaitTrack) { |
674 if (d->mWaitTrack) { |
636 style()->updatePrimitive(d->mWaitTrack, HbStyle::P_ProgressBar_waittrack, &progressBarOption); |
675 style()->updatePrimitive(d->mWaitTrack, HbStyle::P_ProgressBar_waittrack, &progressBarOption); |
637 } |
676 } |
638 |
677 |
639 if(d->mMinTextItem && d->mMinMaxTextVisible) { |
678 if(d->mMinTextItem && d->mMinMaxTextVisible) { |
640 style()->updatePrimitive(d->mMinTextItem,HbStyle::P_ProgressBar_mintext,&progressBarOption); |
679 style()->updatePrimitive(d->mMinTextItem,HbStyle::P_ProgressBar_mintext,&progressBarOption); |
641 } |
680 } |
642 |
681 |
643 if(d->mMaxTextItem && d->mMinMaxTextVisible) { |
682 if(d->mMaxTextItem && d->mMinMaxTextVisible) { |
644 style()->updatePrimitive(d->mMaxTextItem,HbStyle::P_ProgressBar_maxtext,&progressBarOption); |
683 style()->updatePrimitive(d->mMaxTextItem,HbStyle::P_ProgressBar_maxtext,&progressBarOption); |
645 } |
684 } |
646 } |
685 } |
647 HbWidget::updatePrimitives(); |
686 HbWidget::updatePrimitives(); |
648 } |
687 } |
649 |
688 |
651 Initializes \a option with the values from this HbProgressBar. This method |
690 Initializes \a option with the values from this HbProgressBar. This method |
652 is useful for subclasses when they need a HbStyleOptionProgressBar, but don't |
691 is useful for subclasses when they need a HbStyleOptionProgressBar, but don't |
653 want to fill in all the information themselves. |
692 want to fill in all the information themselves. |
654 */ |
693 */ |
655 |
694 |
656 void HbProgressBar::initStyleOption(HbStyleOption *hboption) const |
695 void HbProgressBar::initStyleOption(HbStyleOptionProgressBar *option) const |
657 { |
696 { |
658 Q_D( const HbProgressBar ); |
697 Q_D( const HbProgressBar ); |
659 Q_ASSERT(hboption); |
698 |
660 |
699 HbWidget::initStyleOption(option); |
661 HbWidget::initStyleOption(hboption); |
700 |
662 HbStyleOptionProgressBar *option = 0; |
701 option->progressValue = d->mProgressValue; |
663 if ((option = qstyleoption_cast< HbStyleOptionProgressBar *>(hboption)) != 0) { |
702 option->maximum = d->mMaximum; |
664 |
703 option->minimum = d->mMinimum; |
665 option->progressValue = d->mProgressValue; |
704 option->minText = d->mMinText; |
666 option->maximum = d->mMaximum; |
705 option->maxText = d->mMaxText; |
667 option->minimum = d->mMinimum; |
706 option->orientation = d->mOrientation; |
668 option->minText = d->mMinText; |
707 option->isSlider=d->mType == HbProgressBar::RatingProgressBar; |
669 option->maxText = d->mMaxText; |
708 option->inverted = d->mInvertedAppearance; |
670 option->orientation = d->mOrientation; |
709 option->stopWaitAnimation = false; |
671 option->isSlider=d->mType == HbProgressBar::RatingProgressBar; |
710 option->minMaxTextAlignment = d->mMinMaxTextAlignment; |
672 option->inverted = d->mInvertedAppearance; |
711 QRect rect((int)d->mFrame->boundingRect().x(),(int)d->mFrame->boundingRect().y(),(int)d->mFrame->boundingRect().width(), |
673 option->stopWaitAnimation = false; |
712 (int)d->mFrame->boundingRect().height()); |
674 option->minMaxTextAlignment = d->mMinMaxTextAlignment; |
713 option->rect = rect; |
675 QRect rect(d->mFrame->boundingRect().x(),d->mFrame->boundingRect().y(),d->mFrame->boundingRect().width(), |
|
676 d->mFrame->boundingRect().height()); |
|
677 option->rect = rect; |
|
678 } |
|
679 } |
714 } |
680 |
715 |
681 /*! |
716 /*! |
682 \reimp |
717 \reimp |
683 */ |
718 */ |
704 #ifdef HB_EFFECTS |
739 #ifdef HB_EFFECTS |
705 Q_D(HbProgressBar); |
740 Q_D(HbProgressBar); |
706 if(change == QGraphicsItem::ItemVisibleChange){ |
741 if(change == QGraphicsItem::ItemVisibleChange){ |
707 if(value.toBool()) { |
742 if(value.toBool()) { |
708 |
743 |
709 HbEffect::start(this, HB_PRGRESSBAR_ITEM_TYPE, "progressbar_appear"); |
744 if(!d->mShowEffectInProgress) { |
|
745 HbEffect::start(this, HB_PRGRESSBAR_ITEM_TYPE, "progressbar_appear",this,"_q_delayedShow"); |
|
746 d->mShowEffectInProgress = true; |
|
747 } |
710 |
748 |
711 d->mDelayHideInProgress = false; |
749 d->mDelayHideInProgress = false; |
712 } |
750 } |
713 else if(!d->mDelayHideInProgress) { |
751 else if(!d->mDelayHideInProgress) { |
714 //parentItemVisibility check is a hack . Other wise if visibility |
752 //parentItemVisibility check is a hack . Other wise if visibility |
729 /*! |
767 /*! |
730 \reimp |
768 \reimp |
731 */ |
769 */ |
732 void HbProgressBar::changeEvent(QEvent *event) |
770 void HbProgressBar::changeEvent(QEvent *event) |
733 { |
771 { |
|
772 Q_D(HbProgressBar); |
|
773 switch (event->type()) { |
|
774 case QEvent::LayoutDirectionChange: |
|
775 if(layoutDirection() == Qt::RightToLeft) { |
|
776 setInvertedAppearance(true); |
|
777 } |
|
778 else { |
|
779 setInvertedAppearance(false); |
|
780 } |
|
781 break; |
|
782 case QEvent::EnabledChange: |
|
783 { |
|
784 if (!isEnabled()) { |
|
785 d->setEnableFlag(false); |
|
786 } |
|
787 else |
|
788 { |
|
789 d->setEnableFlag(true); |
|
790 } |
|
791 } |
|
792 default: |
|
793 break; |
|
794 } |
|
795 |
734 HbWidget::changeEvent(event); |
796 HbWidget::changeEvent(event); |
735 |
|
736 switch (event->type()) { |
|
737 case QEvent::LayoutDirectionChange: |
|
738 if(layoutDirection() == Qt::RightToLeft) { |
|
739 setInvertedAppearance(true); |
|
740 } |
|
741 else { |
|
742 setInvertedAppearance(false); |
|
743 } |
|
744 break; |
|
745 default: |
|
746 break; |
|
747 } |
|
748 } |
797 } |
749 |
798 |
750 #include "moc_hbprogressbar.cpp" |
799 #include "moc_hbprogressbar.cpp" |
751 |
800 |