61 |
61 |
62 HbWidgetPrivate::HbWidgetPrivate() |
62 HbWidgetPrivate::HbWidgetPrivate() |
63 : HbWidgetBasePrivate(), |
63 : HbWidgetBasePrivate(), |
64 style(0), |
64 style(0), |
65 backgroundPrimitiveType(HbStylePrivate::P_None), |
65 backgroundPrimitiveType(HbStylePrivate::P_None), |
|
66 polished(0), |
66 polishPending(false), |
67 polishPending(false), |
67 themingPending(true), |
68 themingPending(true), |
68 repolishOutstanding(false), |
69 repolishOutstanding(false), |
69 mHandlingRepolishSynchronously(false), |
70 mHandlingRepolishSynchronously(false), |
70 notifyScene(false), |
71 notifyScene(false), |
491 } |
492 } |
492 |
493 |
493 |
494 |
494 /*! |
495 /*! |
495 Sets a custom style for the widget. |
496 Sets a custom style for the widget. |
496 When a new style is set for the widget the widget's primitives need to recreated and primitives and layout updated. |
497 When a new style is set for the widget the widget's primitives need to recreated and primitives and layout updated. |
497 In order for the style change to work each widget needs to override recreatePrimitives() method and recreate the |
498 In order for the style change to work each widget needs to override recreatePrimitives() method and recreate the |
498 primitives. |
499 primitives. |
499 \param style Custom style for the widget, note that the ownership is not transferred |
500 \param style Custom style for the widget, note that the ownership is not transferred |
500 */ |
501 */ |
501 void HbWidget::setStyle( HbStyle *style ) |
502 void HbWidget::setStyle( HbStyle *style ) |
502 { |
503 { |
503 Q_D( HbWidget ); |
504 Q_D( HbWidget ); |
504 d->style = style; |
505 d->style = style; |
505 recreatePrimitives(); |
506 recreatePrimitives(); |
506 updatePrimitives(); |
507 repolish(); |
507 repolish(); |
508 updatePrimitives(); |
|
509 |
508 } |
510 } |
509 |
511 |
510 /*! |
512 /*! |
511 As a default returns the hbInstance's platform style. If style is set using |
513 As a default returns the hbInstance's platform style. If style is set using |
512 the setStyle then the set style is returned. |
514 the setStyle then the set style is returned. |
532 for(int i = 0; i < acts.size(); i++) { |
534 for(int i = 0; i < acts.size(); i++) { |
533 removeAction(acts[i]); |
535 removeAction(acts[i]); |
534 if (acts[i]->parent() == this && acts[i]->associatedGraphicsWidgets().isEmpty()) |
536 if (acts[i]->parent() == this && acts[i]->associatedGraphicsWidgets().isEmpty()) |
535 delete acts[i]; |
537 delete acts[i]; |
536 } |
538 } |
537 } |
|
538 |
|
539 /*! |
|
540 \deprecated HbWidget::pluginBaseId() |
|
541 is deprecated. Style plugins are deprecated. |
|
542 */ |
|
543 int HbWidget::pluginBaseId() const |
|
544 { |
|
545 return 0; // deprecated |
|
546 } |
|
547 |
|
548 /*! |
|
549 \deprecated HbWidget::setPluginBaseId(int) |
|
550 is deprecated. Style plugins are deprecated. |
|
551 */ |
|
552 void HbWidget::setPluginBaseId( int baseId ) |
|
553 { |
|
554 Q_UNUSED(baseId); // deprecated |
|
555 } |
539 } |
556 |
540 |
557 /*! |
541 /*! |
558 This function returns the HbMainWindow of the widget or \c 0 if |
542 This function returns the HbMainWindow of the widget or \c 0 if |
559 it doesn't exist. Note that if the widget is not added to the scene |
543 it doesn't exist. Note that if the widget is not added to the scene |
746 QVariant HbWidget::itemChange ( GraphicsItemChange change, const QVariant & value ) |
730 QVariant HbWidget::itemChange ( GraphicsItemChange change, const QVariant & value ) |
747 { |
731 { |
748 Q_D(HbWidget); |
732 Q_D(HbWidget); |
749 |
733 |
750 if (d->testabilitySignal && d->testabilitySignal->signalEnabled()) { |
734 if (d->testabilitySignal && d->testabilitySignal->signalEnabled()) { |
751 emit d->testabilitySignal->propertyChanges(change, value); |
735 emit d->testabilitySignal->propertyChanges(change, value); |
752 } |
736 } |
753 |
737 |
754 if (change == QGraphicsItem::ItemVisibleHasChanged) { |
738 if (change == QGraphicsItem::ItemVisibleHasChanged) { |
755 if (!d->polished && !value.toBool()) { |
739 if (!d->polished && !value.toBool()) { |
756 |
740 |
757 // temporary solution starts -->> |
741 // temporary solution starts -->> |
758 // bypass QT defect: 251309 |
742 // bypass QT defect: 251309 |
759 // when the defect is fixed, this needs to be removed to prevent calling the polish |
743 // when the defect is fixed, this needs to be removed to prevent calling the polish |
760 // twice. |
744 // twice. |
761 #if (QT_VERSION < QT_VERSION_CHECK(4, 6, 1)) |
745 #if (QT_VERSION < QT_VERSION_CHECK(4, 6, 1)) |
762 if ( !scene() ) { |
746 if ( !scene() ) { |
763 d->polishPending = true; |
747 d->polishPending = true; |
764 } |
748 } |
765 #endif |
749 #endif |
766 // <<-- temporary solution ends |
750 // <<-- temporary solution ends |
767 |
751 |
898 { |
882 { |
899 Q_D(HbWidget); |
883 Q_D(HbWidget); |
900 // "d->polished" check removed because there's a bug in QGraphicsScene (Qt bug id 251309): |
884 // "d->polished" check removed because there's a bug in QGraphicsScene (Qt bug id 251309): |
901 // "polishEvent" is never sent to items that were invisible when added to scene. |
885 // "polishEvent" is never sent to items that were invisible when added to scene. |
902 #if (QT_VERSION < QT_VERSION_CHECK(4, 6, 1)) |
886 #if (QT_VERSION < QT_VERSION_CHECK(4, 6, 1)) |
903 if (!d->repolishOutstanding) { |
887 if (!d->repolishOutstanding) { |
904 #else |
888 #else |
905 if (d->polished && !d->repolishOutstanding) { |
889 if (d->polished && !d->repolishOutstanding) { |
906 #endif |
890 #endif |
907 d->repolishOutstanding = true; |
891 d->repolishOutstanding = true; |
908 QEvent* polishEvent = new QEvent( QEvent::Polish ); |
892 QEvent* polishEvent = new QEvent( QEvent::Polish ); |
909 QCoreApplication::postEvent(this, polishEvent); |
893 QCoreApplication::postEvent(this, polishEvent); |
910 // If no one is handling repolish synchronously, lets make sure they are handled |
894 // If no one is handling repolish synchronously, lets make sure they are handled |