src/hbwidgets/widgets/hbgroupboxcontentwidget_p.cpp
changeset 21 4633027730f5
parent 7 923ff622b8b9
child 23 e6ad4ef83b23
equal deleted inserted replaced
7:923ff622b8b9 21:4633027730f5
    75 */
    75 */
    76 void HbGroupBoxContentWidget::createPrimitives()
    76 void HbGroupBoxContentWidget::createPrimitives()
    77 {
    77 {
    78     if( groupBoxType == GroupBoxRichLabel ){
    78     if( groupBoxType == GroupBoxRichLabel ){
    79         if ( !mBackgroundItem ) {
    79         if ( !mBackgroundItem ) {
    80             mBackgroundItem = style()->createPrimitive( HbStyle::P_GroupBoxContent_background , this );
    80             mBackgroundItem = HbStylePrivate::createPrimitive( HbStylePrivate::P_GroupBoxContent_background , this );
    81         }
    81         }
    82     }else if ( mBackgroundItem ) {
    82     }else if ( mBackgroundItem ) {
    83             delete mBackgroundItem;
    83             delete mBackgroundItem;
    84             mBackgroundItem = 0;
    84             mBackgroundItem = 0;
    85     }
    85     }
    92 {
    92 {
    93    HbStyleOption option;
    93    HbStyleOption option;
    94    initStyleOption( &option );
    94    initStyleOption( &option );
    95 
    95 
    96     if ( mBackgroundItem ) {
    96     if ( mBackgroundItem ) {
    97         style()->updatePrimitive( mBackgroundItem , HbStyle::P_GroupBoxContent_background , &option );
    97         HbStylePrivate::updatePrimitive( mBackgroundItem , HbStylePrivate::P_GroupBoxContent_background , &option );
    98     }
    98     }
    99 }
    99 }
   100 
   100 
   101 /*
   101 /*
   102     internal
   102     internal
   104     creates signal connection for contentWidget
   104     creates signal connection for contentWidget
   105 */
   105 */
   106 void HbGroupBoxContentWidget::createConnection()
   106 void HbGroupBoxContentWidget::createConnection()
   107 {
   107 {
   108     // to avoid duplicate signals getting emitted from groupBox contentWidget
   108     // to avoid duplicate signals getting emitted from groupBox contentWidget
   109     disconnect( this , SIGNAL ( clicked() ) , groupBox , SIGNAL ( clicked() ));
   109     disconnect(this, SIGNAL(clicked()), groupBox, SIGNAL(clicked()));
   110     disconnect ( this , SIGNAL( longPress( QPointF ) ) , groupBox , SIGNAL( longPress( QPointF ) ));
   110     disconnect(this, SIGNAL(longPress(QPointF)), groupBox , SIGNAL(longPress(QPointF)));
   111 
   111 
   112     connect ( this , SIGNAL ( clicked() ) , groupBox , SIGNAL ( clicked() ));
   112     connect(this, SIGNAL(clicked()), groupBox, SIGNAL(clicked()));
   113     connect ( this , SIGNAL( longPress( QPointF ) ) , groupBox , SIGNAL( longPress( QPointF ) ));
   113     connect(this, SIGNAL(longPress(QPointF)), groupBox, SIGNAL(longPress(QPointF)));
   114 }
   114 }
   115 
   115 
   116 /*!
   116 /*!
   117     internal
   117     internal
   118 
   118 
   150         if ( mContent ) {
   150         if ( mContent ) {
   151             delete mContent; 
   151             delete mContent; 
   152             mContent = 0;
   152             mContent = 0;
   153         }
   153         }
   154         mContent = widget;
   154         mContent = widget;
   155         style()->setItemName( mContent , "content" );
   155         HbStyle::setItemName( mContent , "content" );
   156         mContent->setParentItem( this);
   156         mContent->setParentItem( this);
   157     }
   157     }
   158 }
   158 }
   159 
   159 
   160 /*!
   160 /*!
   162     Will return NULL if \a primitive passed is invalid
   162     Will return NULL if \a primitive passed is invalid
   163 */
   163 */
   164 QGraphicsItem* HbGroupBoxContentWidget::primitive(HbStyle::Primitive primitive) const
   164 QGraphicsItem* HbGroupBoxContentWidget::primitive(HbStyle::Primitive primitive) const
   165 {
   165 {
   166     switch (primitive) {
   166     switch (primitive) {
   167         case HbStyle::P_GroupBoxContent_background:
   167         case HbStylePrivate::P_GroupBoxContent_background:
   168             return mBackgroundItem;
   168             return mBackgroundItem;
   169         default:
   169         default:
   170             return 0;
   170             return 0;
   171     }
   171     }
   172 }
   172 }
   274                 tap->setProperty(HbPrivate::ThresholdRect.latin1(), mapRectToScene(boundingRect()).toRect());
   274                 tap->setProperty(HbPrivate::ThresholdRect.latin1(), mapRectToScene(boundingRect()).toRect());
   275             }
   275             }
   276 
   276 
   277             contentPressed=true;
   277             contentPressed=true;
   278             updatePrimitives();
   278             updatePrimitives();
       
   279             HbWidgetFeedback::triggered(this, Hb::InstantPressed);
   279             break;
   280             break;
   280         case Qt::GestureCanceled: // Reset state
   281         case Qt::GestureCanceled: // Reset state
   281             scene()->setProperty(HbPrivate::OverridingGesture.latin1(),QVariant());
   282             scene()->setProperty(HbPrivate::OverridingGesture.latin1(),QVariant());
   282 
   283 
   283             contentPressed=false;
   284             contentPressed=false;
   290             break;
   291             break;
   291         case Qt::GestureFinished: // emit clicked
   292         case Qt::GestureFinished: // emit clicked
   292             scene()->setProperty(HbPrivate::OverridingGesture.latin1(),QVariant());
   293             scene()->setProperty(HbPrivate::OverridingGesture.latin1(),QVariant());
   293             contentPressed=false;
   294             contentPressed=false;
   294             updatePrimitives();
   295             updatePrimitives();
       
   296             HbWidgetFeedback::triggered(this, Hb::InstantReleased);
   295             if(tap->tapStyleHint() == HbTapGesture::Tap) {
   297             if(tap->tapStyleHint() == HbTapGesture::Tap) {
   296                 emit clicked();
   298                 emit clicked();
   297             }
   299             }
   298             break;
   300             break;
   299         default:
   301         default: