src/hbwidgets/widgets/hbgroupboxheadingwidget_p.cpp
changeset 2 06ff229162e9
parent 1 f7ac710697a9
child 6 c3690ec91ef8
equal deleted inserted replaced
1:f7ac710697a9 2:06ff229162e9
    23 **
    23 **
    24 ****************************************************************************/
    24 ****************************************************************************/
    25 
    25 
    26 #include "hbgroupboxheadingwidget_p.h"
    26 #include "hbgroupboxheadingwidget_p.h"
    27 
    27 
    28 #include <hbstyleoptiongroupbox.h>
    28 #include <hbstyleoptiongroupbox_p.h>
    29 #include <hbwidgetfeedback.h>
    29 #include <hbwidgetfeedback.h>
    30 
    30 
    31 #ifdef HB_EFFECTS
    31 #ifdef HB_EFFECTS
    32 #include <hbeffect.h>
    32 #include <hbeffect.h>
    33 #include "hbeffectinternal_p.h"
    33 #include "hbeffectinternal_p.h"
    48     CollapsingContainer type.
    48     CollapsingContainer type.
    49     
    49     
    50     HbGroupBoxHeadingWidget holds the heading text and allows the groupBox to set marquee on it.
    50     HbGroupBoxHeadingWidget holds the heading text and allows the groupBox to set marquee on it.
    51 
    51 
    52 */
    52 */
    53 HbGroupBoxHeadingWidget::HbGroupBoxHeadingWidget(QGraphicsItem *parent ) :
    53 HbGroupBoxHeadingWidget::HbGroupBoxHeadingWidget( QGraphicsItem *parent ) :
    54     HbWidget(parent),
    54     HbWidget( parent ),
    55     mIconItem( 0 ),
    55     mIconItem( 0 ),
    56     mTextItem( 0 ),
    56     mTextItem( 0 ),
    57     mBackgroundItem( 0 ),
    57     mBackgroundItem( 0 ),
    58     collapsable( true ),
    58     collapsable( true ),
    59     collapsed( false),
    59     collapsed( false),
    60     marqueeEnabled( false ),
    60     marqueeEnabled( false ),
    61     headingPressed(false)
    61     headingPressed(false),
       
    62     groupBoxType( GroupBoxTypeUnknown )
    62 {
    63 {
    63     groupBox = qgraphicsitem_cast<HbGroupBox*>( parent );
    64     groupBox = qgraphicsitem_cast<HbGroupBox*>( parent );
    64     init();
    65     init( );
    65     setProperty("state", "normal");
    66     setProperty( "state", "normal" );
    66 }
    67 }
    67 
    68 
    68 /*
    69 /*
    69     internal
    70     internal
    70     Destructs HbGroupBoxHeadingWidget
    71     Destructs HbGroupBoxHeadingWidget
    71 */
    72 */
    72 HbGroupBoxHeadingWidget::~HbGroupBoxHeadingWidget()
    73 HbGroupBoxHeadingWidget::~HbGroupBoxHeadingWidget( )
    73 {
    74 {
    74 }
    75 }
    75 
    76 
    76 /*
    77 /*
    77     internal
    78     internal
    78     init
    79     init
    79 */
    80 */
    80 void HbGroupBoxHeadingWidget::init()
    81 void HbGroupBoxHeadingWidget::init( )
    81 {
    82 {
    82 
    83 
    83     createPrimitives();
    84     createPrimitives( );
    84 	
    85     if ( groupBoxType == GroupBoxCollapsingContainer ){
    85     if(groupBoxType == GroupBoxCollapsingContainer){
    86         createConnection( );    
    86         createConnection();    
       
    87     }
    87     }
    88 #ifdef HB_GESTURE_FW
    88 #ifdef HB_GESTURE_FW
    89     grabGesture(Qt::TapGesture);
    89     grabGesture( Qt::TapGesture );
    90 #endif 
    90 #endif 
    91 }
    91 }
    92 
    92 
    93 /*
    93 /*
    94   create primitives
    94   create primitives
    95 */
    95 */
    96 void HbGroupBoxHeadingWidget::createPrimitives()
    96 void HbGroupBoxHeadingWidget::createPrimitives()
    97 {
    97 {
    98     if(groupBoxType == GroupBoxCollapsingContainer && collapsable){
    98     if( groupBoxType == GroupBoxCollapsingContainer && collapsable ){
    99         if ( !mIconItem ) {
    99         if ( !mIconItem ) {
   100             mIconItem = style()->createPrimitive( HbStyle::P_GroupBoxHeading_icon , this );
   100             mIconItem = style( )->createPrimitive( HbStyle::P_GroupBoxHeading_icon , this );
   101         }
   101         }
   102     }
   102     }
   103     else if ( mIconItem ) {
   103     else if ( mIconItem ) {
   104         delete mIconItem;
   104         delete mIconItem;
   105         mIconItem = 0;
   105         mIconItem = 0;
   106     }
   106     }
   107     if ( mTextItem ) {
   107     if ( mTextItem ) {
   108         delete mTextItem;
   108         delete mTextItem;
   109         mTextItem = 0 ;
   109         mTextItem = 0;
   110     }
   110     }
   111     if ( groupBoxType == GroupBoxCollapsingContainer ) {
   111     if ( groupBoxType == GroupBoxCollapsingContainer ) {
   112         mTextItem = style()->createPrimitive( HbStyle::P_GroupBoxHeading_text , this );
   112         mTextItem = style( )->createPrimitive( HbStyle::P_GroupBoxHeading_text , this );
   113     }
   113     }
   114     else {
   114     else {
   115         mTextItem = style()->createPrimitive( HbStyle::P_GroupBoxMarquee_text , this );
   115         mTextItem = style( )->createPrimitive( HbStyle::P_GroupBoxMarquee_text , this );
   116     }
   116     }
   117 
   117 
   118     if ( !mBackgroundItem ) {
   118     if ( !mBackgroundItem ) {
   119         mBackgroundItem = style()->createPrimitive( HbStyle::P_GroupBoxHeading_background , this );
   119         mBackgroundItem = style( )->createPrimitive( HbStyle::P_GroupBoxHeading_background , this );
   120         style()->setItemName( mBackgroundItem , "background" );
   120         style( )->setItemName( mBackgroundItem , "background" );
   121     }
   121     }
   122 }
   122 }
   123 
   123 
   124 /*!
   124 /*!
   125     update primitives
   125     update primitives
   128 {
   128 {
   129     HbStyleOptionGroupBox option;
   129     HbStyleOptionGroupBox option;
   130     initStyleOption( &option );
   130     initStyleOption( &option );
   131    
   131    
   132     if ( mIconItem ) {
   132     if ( mIconItem ) {
   133             style()->updatePrimitive( mIconItem , HbStyle::P_GroupBoxHeading_icon , &option );
   133             style( )->updatePrimitive( mIconItem , HbStyle::P_GroupBoxHeading_icon , &option );
   134     }       
   134     }       
   135     if ( mTextItem ) {
   135     if ( mTextItem ) {
   136         if ( groupBoxType == GroupBoxCollapsingContainer ) {
   136         if ( groupBoxType == GroupBoxCollapsingContainer ) {
   137             style()->updatePrimitive( mTextItem , HbStyle::P_GroupBoxHeading_text , &option );
   137             style( )->updatePrimitive( mTextItem , HbStyle::P_GroupBoxHeading_text , &option );
   138         }
   138         }
   139         else {
   139         else {
   140             style()->updatePrimitive( mTextItem , HbStyle::P_GroupBoxMarquee_text , &option );
   140             style( )->updatePrimitive( mTextItem , HbStyle::P_GroupBoxMarquee_text , &option );
   141         }        
   141         }        
   142     }
   142     }
   143     if ( mBackgroundItem ) {
   143     if ( mBackgroundItem ) {
   144         style()->updatePrimitive( mBackgroundItem , HbStyle::P_GroupBoxHeading_background , &option );
   144         style( )->updatePrimitive( mBackgroundItem , HbStyle::P_GroupBoxHeading_background , &option );
   145     }
   145     }
   146 }
   146 }
   147 
   147 
   148 /*
   148 /*
   149     internal
   149     internal
   151 */
   151 */
   152 void HbGroupBoxHeadingWidget::createConnection()
   152 void HbGroupBoxHeadingWidget::createConnection()
   153 {
   153 {
   154 
   154 
   155 #ifdef HB_EFFECTS
   155 #ifdef HB_EFFECTS
   156     HbEffectInternal::add(HB_GROUPBOX_HEADING_TYPE,"groupbox_icon_click", "iconclick");
   156     HbEffectInternal::add( HB_GROUPBOX_HEADING_TYPE,"groupbox_icon_click", "iconclick" );
   157 #endif 
   157 #endif 
   158 
   158 
   159     connect ( this , SIGNAL ( clicked(bool) ) , groupBox , SLOT ( setCollapsed(bool) ));
   159     connect ( this , SIGNAL ( clicked(bool) ) , groupBox , SLOT ( setCollapsed(bool) ) );
   160 }
   160 }
   161 
   161 
   162 /*!
   162 /*!
   163     internal
   163     internal
   164     Sets the groupbox heading widgets type.
   164     Sets the groupbox heading widgets type.
   165     Create primitves & connect signals if needed based on type set
   165     Create primitves & connect signals if needed based on type set
   166 */
   166 */
   167 void HbGroupBoxHeadingWidget::setType(GroupBoxType type)
   167 void HbGroupBoxHeadingWidget::setType(GroupBoxType type)
   168 {
   168 {
   169     if ( groupBoxType == type )
   169     if ( groupBoxType != type ){
   170         return;
   170         groupBoxType = type;
   171     groupBoxType = type;
   171         // setting dynamic properties for type
   172     // setting dynamic properties for type
   172         if( groupBoxType == GroupBoxCollapsingContainer )
   173     if(groupBoxType == GroupBoxCollapsingContainer)
   173             setProperty( "groupBoxType",3 );
   174         setProperty("groupBoxType",3);
   174         else if( groupBoxType == GroupBoxSimpleLabel )
   175     else if(groupBoxType == GroupBoxSimpleLabel)
   175             setProperty( "groupBoxType",1 );
   176         setProperty("groupBoxType",1);
   176 
   177 
   177         if( groupBoxType != GroupBoxRichLabel ){
   178     if(groupBoxType != GroupBoxRichLabel){
   178             createPrimitives( );
   179         createPrimitives();
   179         }
   180     }
   180 
   181 
   181         if( groupBoxType == GroupBoxCollapsingContainer ){
   182     if(groupBoxType == GroupBoxCollapsingContainer){
   182             createConnection(); 
   183         createConnection(); 
   183             // collapsed is false by default for CollapsingContainer
   184         // collapsed is false by default for CollapsingContainer
   184             collapsed = false; 
   185         collapsed = false; 
   185             // marquee is disabled by default for CollapsingContainer
   186         // marquee is disabled by default for CollapsingContainer
   186             marqueeEnabled = false;
       
   187         }
       
   188 
       
   189         if( groupBoxType == GroupBoxSimpleLabel ){
       
   190             // marquee is disabled by default for simple label
   187         marqueeEnabled = false;			
   191         marqueeEnabled = false;			
   188     }
   192         }
   189 
       
   190     if(groupBoxType == GroupBoxSimpleLabel){
       
   191         // marquee is disabled by default for simple label
       
   192         marqueeEnabled = false;			
       
   193     }
   193     }
   194 
   194 
   195 }
   195 }
   196 
   196 
   197 /*!
   197 /*!
   198     internal
   198     internal
   199     Sets the groupbox heading widgets text
   199     Sets the groupbox heading widgets text
   200 */
   200 */
   201 void HbGroupBoxHeadingWidget::setHeading(const QString &text)
   201 void HbGroupBoxHeadingWidget::setHeading( const QString &text )
   202 {
   202 {
   203     if( headingText == text ) 
   203     if( headingText == text ) 
   204         return;
   204         return;
   205 
   205 
   206     headingText = text;
   206     headingText = text;
   207 
   207 
   208     HbStyleOptionGroupBox groupBoxOption;
   208     HbStyleOptionGroupBox groupBoxOption;
   209     initStyleOption(&groupBoxOption);
   209     initStyleOption( &groupBoxOption );
   210     if ( groupBoxType == GroupBoxCollapsingContainer ) {
   210     if ( groupBoxType == GroupBoxCollapsingContainer ) {
   211         style()->updatePrimitive( mTextItem , HbStyle::P_GroupBoxHeading_text , &groupBoxOption );
   211         style( )->updatePrimitive( mTextItem , HbStyle::P_GroupBoxHeading_text , &groupBoxOption );
   212     }
   212     }
   213     else {
   213     else {
   214        style()->updatePrimitive( mTextItem , HbStyle::P_GroupBoxMarquee_text , &groupBoxOption );
   214        style( )->updatePrimitive( mTextItem , HbStyle::P_GroupBoxMarquee_text , &groupBoxOption );
   215     }
   215     }
   216 }
   216 }
   217 
   217 
   218 /*!
   218 /*!
   219     internal
   219     internal
   225         return;
   225         return;
   226 
   226 
   227     marqueeEnabled  = marquee;
   227     marqueeEnabled  = marquee;
   228 
   228 
   229     HbStyleOptionGroupBox groupBoxOption;
   229     HbStyleOptionGroupBox groupBoxOption;
   230     initStyleOption(&groupBoxOption);
   230     initStyleOption( &groupBoxOption );
   231     style()->updatePrimitive( mTextItem, HbStyle::P_GroupBoxMarquee_text, &groupBoxOption);
   231     style()->updatePrimitive( mTextItem, HbStyle::P_GroupBoxMarquee_text, &groupBoxOption);
   232 }
   232 }
   233 
   233 
   234 /*!
   234 /*!
   235 
   235 
   237         is deprecated.
   237         is deprecated.
   238 
   238 
   239     Returns the pointer for \a primitive passed.
   239     Returns the pointer for \a primitive passed.
   240     Will return NULL if \a primitive passed is invalid
   240     Will return NULL if \a primitive passed is invalid
   241 */
   241 */
   242 QGraphicsItem* HbGroupBoxHeadingWidget::primitive(HbStyle::Primitive primitive) const
   242 QGraphicsItem *HbGroupBoxHeadingWidget::primitive( HbStyle::Primitive primitive ) const
   243 {
   243 {
   244     switch (primitive) {
   244     switch (primitive) {
   245         case HbStyle::P_GroupBoxHeading_icon:
   245         case HbStyle::P_GroupBoxHeading_icon:
   246             return mIconItem;
   246             return mIconItem;
   247         case HbStyle::P_GroupBoxHeading_text:
   247         case HbStyle::P_GroupBoxHeading_text:
   258     \reimp
   258     \reimp
   259     Initialize \a option with the values from this HbGroupBox. This method
   259     Initialize \a option with the values from this HbGroupBox. This method
   260     is useful for subclasses when they need a HbStyleOptionGroupBox, but don't want
   260     is useful for subclasses when they need a HbStyleOptionGroupBox, but don't want
   261     to fill in all the information themselves.
   261     to fill in all the information themselves.
   262 */
   262 */
   263 void HbGroupBoxHeadingWidget::initStyleOption(HbStyleOptionGroupBox *option) const
   263 void HbGroupBoxHeadingWidget::initStyleOption( HbStyleOptionGroupBox *option ) const
   264 {
   264 {
   265     HbWidget::initStyleOption( option );
   265     HbWidget::initStyleOption( option );
   266     option->collapsed = collapsed;
   266     option->collapsed = collapsed;
   267     option->heading = headingText;
   267     option->heading = headingText;
   268     option->marqueeEnabled = marqueeEnabled;
   268     option->marqueeEnabled = marqueeEnabled;
   269     // state & type info reqd fo background primitve updation
   269     // state & type info reqd fo background primitve updation
   270     if (headingPressed ) {
   270     if ( headingPressed ) {
   271         option->state = QStyle::State_On;
   271         option->state = QStyle::State_On;
   272     } else {
   272     } else {
   273         option->state = QStyle::State_Off;
   273         option->state = QStyle::State_Off;
   274     }
   274     }
   275     if(groupBoxType == GroupBoxCollapsingContainer)
   275     if( groupBoxType == GroupBoxCollapsingContainer )
   276         option->groupBoxType = HbStyleOptionGroupBox::GroupBoxCollapsingContainer;
   276         option->groupBoxType = HbStyleOptionGroupBox::GroupBoxCollapsingContainer;
   277     else if(groupBoxType == GroupBoxSimpleLabel)
   277     else if( groupBoxType == GroupBoxSimpleLabel )
   278         option->groupBoxType = HbStyleOptionGroupBox::GroupBoxSimpleLabel;
   278         option->groupBoxType = HbStyleOptionGroupBox::GroupBoxSimpleLabel;
   279 }
   279 }
   280 
   280 
   281 /*!
   281 /*!
   282     \reimp
   282     \reimp
   283  */
   283  */
   284 QVariant HbGroupBoxHeadingWidget::itemChange(GraphicsItemChange change, const QVariant &value)
   284 QVariant HbGroupBoxHeadingWidget::itemChange( GraphicsItemChange change, const QVariant &value )
   285 {
   285 {
   286     switch ( change ) {
   286     switch ( change ) {
   287         case ItemVisibleHasChanged: {
   287         case ItemVisibleHasChanged: {
   288             /*if (value.toBool() == true){
   288             /*if (value.toBool() == true){
   289                 if (mTextItem) {
   289                 if (mTextItem) {
   308             repolish();
   308             repolish();
   309             break;
   309             break;
   310         default:
   310         default:
   311             break;
   311             break;
   312     }
   312     }
   313     return HbWidget::itemChange(change, value);
   313     return HbWidget::itemChange( change, value );
   314 }
   314 }
   315 
   315 
   316 /*!
   316 /*!
   317     \reimp
   317     \reimp
   318  */
   318  */
   319 void HbGroupBoxHeadingWidget::mousePressEvent(QGraphicsSceneMouseEvent *event)
   319 void HbGroupBoxHeadingWidget::mousePressEvent( QGraphicsSceneMouseEvent *event )
   320 {
   320 {
   321 #ifdef HB_GESTURE_FW
   321 #ifdef HB_GESTURE_FW
   322     Q_UNUSED(event)
   322     Q_UNUSED( event )
   323 #else 
   323 #else 
   324     HbWidget::mousePressEvent( event );
   324     HbWidget::mousePressEvent( event );
   325     if ( !collapsable ){
   325     if ( !collapsable ){
   326         event->ignore();
   326         event->ignore();
   327         return;
   327         return;
   328     }
   328     }
   329 
   329 
   330     if (groupBoxType == GroupBoxCollapsingContainer) {
   330     if (groupBoxType == GroupBoxCollapsingContainer) {
   331         HbWidgetFeedback::triggered(this, Hb::InstantPressed, Hb::ModifierCollapsedItem);
   331         HbWidgetFeedback::triggered( this, Hb::InstantPressed, Hb::ModifierCollapsedItem );
   332     }
   332     }
   333     else {
   333     else {
   334         HbWidgetFeedback::triggered(this, Hb::InstantPressed);
   334         HbWidgetFeedback::triggered( this, Hb::InstantPressed );
   335     }
   335     }
   336 
   336 
   337     event->accept();
   337     event->accept();
   338     // background primitive updation, upon mouse press
   338     // background primitive updation, upon mouse press
   339     headingPressed = true;
   339     headingPressed = true;
   340 
   340 
   341     HbStyleOptionGroupBox groupBoxOption;
   341     HbStyleOptionGroupBox groupBoxOption;
   342     initStyleOption(&groupBoxOption);
   342     initStyleOption( &groupBoxOption );
   343     style()->updatePrimitive( mBackgroundItem , HbStyle::P_GroupBoxHeading_background , &groupBoxOption );
   343     style()->updatePrimitive( mBackgroundItem , HbStyle::P_GroupBoxHeading_background , &groupBoxOption );
   344 
   344 
   345     setProperty("state", "pressed");
   345     setProperty( "state", "pressed" );
   346 #endif  
   346 #endif  
   347 }
   347 }
   348 
   348 
   349 /*!
   349 /*!
   350     \reimp
   350     \reimp
   355     Q_UNUSED(event)
   355     Q_UNUSED(event)
   356 #else 
   356 #else 
   357     HbWidget::mouseReleaseEvent( event );
   357     HbWidget::mouseReleaseEvent( event );
   358 
   358 
   359     if (groupBoxType == GroupBoxCollapsingContainer) {
   359     if (groupBoxType == GroupBoxCollapsingContainer) {
   360         HbWidgetFeedback::triggered(this, Hb::InstantReleased, Hb::ModifierCollapsedItem);
   360         HbWidgetFeedback::triggered( this, Hb::InstantReleased, Hb::ModifierCollapsedItem );
   361     }
   361     }
   362     else {
   362     else {
   363         HbWidgetFeedback::triggered(this, Hb::InstantReleased);
   363         HbWidgetFeedback::triggered( this, Hb::InstantReleased );
   364     }
   364     }
   365 
   365 
   366     if ( this->isUnderMouse() ) {
   366     if ( this->isUnderMouse() ) {
   367         if ( mIconItem && mIconItem->isUnderMouse() ) {
   367         if ( mIconItem && mIconItem->isUnderMouse() ) {
   368     #ifdef HB_EFFECTS
   368     #ifdef HB_EFFECTS
   369         HbEffect::start( mIconItem, HB_GROUPBOX_HEADING_TYPE, "iconclick");
   369         HbEffect::start( mIconItem, HB_GROUPBOX_HEADING_TYPE, "iconclick");
   370     #endif
   370     #endif
   371         }
   371         }
   372         emit clicked(!collapsed);
   372         emit clicked( !collapsed );
   373     }
   373     }
   374     // background primitive updation, upon mouse release
   374     // background primitive updation, upon mouse release
   375     headingPressed = false;
   375     headingPressed = false;
   376 
   376 
   377     HbStyleOptionGroupBox groupBoxOption;
   377     HbStyleOptionGroupBox groupBoxOption;
   378     initStyleOption(&groupBoxOption);
   378     initStyleOption( &groupBoxOption );
   379     style()->updatePrimitive( mBackgroundItem , HbStyle::P_GroupBoxHeading_background , &groupBoxOption );
   379     style()->updatePrimitive( mBackgroundItem , HbStyle::P_GroupBoxHeading_background , &groupBoxOption );
   380 
   380 
   381     setProperty("state", "normal");
   381     setProperty( "state", "normal" );
   382 #endif 
   382 #endif 
   383 }
   383 }
   384 
   384 
   385 #ifdef HB_GESTURE_FW
   385 #ifdef HB_GESTURE_FW
   386 void HbGroupBoxHeadingWidget::gestureEvent(QGestureEvent *event)
   386 void HbGroupBoxHeadingWidget::gestureEvent(QGestureEvent *event)
   387 {
   387 {
   388     if(HbTapGesture *tap = qobject_cast<HbTapGesture *>(event->gesture(Qt::TapGesture))) {
   388     if(HbTapGesture *tap = qobject_cast<HbTapGesture*>( event->gesture( Qt::TapGesture ) ) ) {
   389         switch(tap->state()) {
   389         switch( tap->state() ) {
   390         case Qt::GestureStarted:  //
   390         case Qt::GestureStarted:  //
   391             {
   391             {
   392                 if ( !collapsable ){
   392                 if ( !collapsable ){
   393                     event->ignore(tap);
   393                     event->ignore( tap );
   394                     return;
   394                     return;
   395                 }
   395                 }
   396                 if (collapsable) {
   396                 if ( collapsable ) {
   397                     HbWidgetFeedback::triggered(this, Hb::InstantPressed, Hb::ModifierCollapsedItem);
   397                     HbWidgetFeedback::triggered( this, Hb::InstantPressed, Hb::ModifierCollapsedItem );
   398                 }
   398                 }
   399                 else {
   399                 else {
   400                     HbWidgetFeedback::triggered(this, Hb::InstantPressed);
   400                     HbWidgetFeedback::triggered( this, Hb::InstantPressed );
   401                 }
   401                 }
   402 
   402 
   403                 // background primitive updation, upon mouse press
   403                 // background primitive updation, upon mouse press
   404                 headingPressed = true;
   404                 headingPressed = true;
   405 
   405 
   406                 HbStyleOptionGroupBox groupBoxOption;
   406                 HbStyleOptionGroupBox groupBoxOption;
   407                 initStyleOption(&groupBoxOption);
   407                 initStyleOption( &groupBoxOption );
   408                 style()->updatePrimitive( mBackgroundItem , HbStyle::P_GroupBoxHeading_background , &groupBoxOption );
   408                 style()->updatePrimitive( mBackgroundItem , HbStyle::P_GroupBoxHeading_background , &groupBoxOption );
   409 
   409 
   410                 setProperty("state", "pressed");
   410                 setProperty( "state", "pressed" );
   411             }
   411             }
   412 
   412 
   413             break;
   413             break;
   414         case Qt::GestureCanceled: // Reset state
   414         case Qt::GestureCanceled: // Reset state
   415             {
   415             {
   416                 headingPressed = false;
   416                 headingPressed = false;
   417 
   417 
   418                 HbStyleOptionGroupBox groupBoxOption;
   418                 HbStyleOptionGroupBox groupBoxOption;
   419                 initStyleOption(&groupBoxOption);
   419                 initStyleOption( &groupBoxOption );
   420                 style()->updatePrimitive( mBackgroundItem , HbStyle::P_GroupBoxHeading_background , &groupBoxOption );
   420                 style()->updatePrimitive( mBackgroundItem , HbStyle::P_GroupBoxHeading_background , &groupBoxOption );
   421 
   421 
   422                 setProperty("state", "normal");
   422                 setProperty( "state", "normal" );
   423                 break;
   423                 break;
   424             }
   424             }
   425         case Qt::GestureFinished: // emit clicked
   425         case Qt::GestureFinished: // emit clicked
   426             {
   426             {
   427                 if (collapsable) {
   427                 if ( collapsable ) {
   428                     HbWidgetFeedback::triggered(this, Hb::InstantReleased, Hb::ModifierCollapsedItem);
   428                     HbWidgetFeedback::triggered( this, Hb::InstantReleased, Hb::ModifierCollapsedItem );
   429                 } else {
   429                 } else {
   430                     HbWidgetFeedback::triggered(this, Hb::InstantReleased);
   430                     HbWidgetFeedback::triggered( this, Hb::InstantReleased );
   431                 }
   431                 }
   432 
   432 
   433                 if ( this->isUnderMouse() ) {
   433                 if ( this->isUnderMouse() ) {
   434                     if ( mIconItem && mIconItem->isUnderMouse() ) {
   434                     if ( mIconItem && mIconItem->isUnderMouse( ) ) {
   435 #ifdef HB_EFFECTS
   435 #ifdef HB_EFFECTS
   436                         HbEffect::start( mIconItem, HB_GROUPBOX_HEADING_TYPE, "iconclick");
   436                         HbEffect::start( mIconItem, HB_GROUPBOX_HEADING_TYPE, "iconclick" );
   437 #endif
   437 #endif
   438                     }
   438                     }
   439                     emit clicked(!collapsed);
   439                     emit clicked( !collapsed );
   440                 }
   440                 }
   441                 // background primitive updation, upon mouse release
   441                 // background primitive updation, upon mouse release
   442                 headingPressed = false;
   442                 headingPressed = false;
   443 
   443 
   444                 HbStyleOptionGroupBox groupBoxOption;
   444                 HbStyleOptionGroupBox groupBoxOption;
   445                 initStyleOption(&groupBoxOption);
   445                 initStyleOption( &groupBoxOption );
   446                 style()->updatePrimitive( mBackgroundItem , HbStyle::P_GroupBoxHeading_background , &groupBoxOption );
   446                 style()->updatePrimitive( mBackgroundItem, HbStyle::P_GroupBoxHeading_background, &groupBoxOption );
   447 
   447 
   448                 setProperty("state", "normal");
   448                 setProperty( "state", "normal" );
   449             }
   449             }
   450             break;
   450             break;
   451         default:
   451         default:
   452             break;
   452             break;
   453         }
   453         }