equal
deleted
inserted
replaced
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 ), |
|
59 collapsed( false), |
|
60 marqueeEnabled( false ), |
58 marqueeEnabled( false ), |
61 headingPressed(false), |
59 headingPressed(false), |
62 groupBoxType( GroupBoxTypeUnknown ) |
60 groupBoxType( GroupBoxTypeUnknown ) |
63 { |
61 { |
64 groupBox = qgraphicsitem_cast<HbGroupBox*>( parent ); |
62 groupBox = qgraphicsitem_cast<HbGroupBox*>( parent ); |
78 internal |
76 internal |
79 init |
77 init |
80 */ |
78 */ |
81 void HbGroupBoxHeadingWidget::init( ) |
79 void HbGroupBoxHeadingWidget::init( ) |
82 { |
80 { |
83 |
|
84 createPrimitives( ); |
81 createPrimitives( ); |
85 if ( groupBoxType == GroupBoxCollapsingContainer ){ |
82 if ( groupBoxType == GroupBoxCollapsingContainer ){ |
86 createConnection( ); |
83 createConnection( ); |
87 } |
84 } |
88 #ifdef HB_GESTURE_FW |
85 #ifdef HB_GESTURE_FW |
93 /* |
90 /* |
94 create primitives |
91 create primitives |
95 */ |
92 */ |
96 void HbGroupBoxHeadingWidget::createPrimitives() |
93 void HbGroupBoxHeadingWidget::createPrimitives() |
97 { |
94 { |
98 if( groupBoxType == GroupBoxCollapsingContainer && collapsable ){ |
95 if( groupBoxType == GroupBoxCollapsingContainer && groupBox->isCollapsable() ){ |
99 if ( !mIconItem ) { |
96 if ( !mIconItem ) { |
100 mIconItem = style( )->createPrimitive( HbStyle::P_GroupBoxHeading_icon , this ); |
97 mIconItem = style( )->createPrimitive( HbStyle::P_GroupBoxHeading_icon , this ); |
101 } |
98 } |
102 } |
99 } |
103 else if ( mIconItem ) { |
100 else if ( mIconItem ) { |
179 } |
176 } |
180 |
177 |
181 if( groupBoxType == GroupBoxCollapsingContainer ){ |
178 if( groupBoxType == GroupBoxCollapsingContainer ){ |
182 createConnection(); |
179 createConnection(); |
183 // collapsed is false by default for CollapsingContainer |
180 // collapsed is false by default for CollapsingContainer |
184 collapsed = false; |
181 //collapsed = false; |
185 // marquee is disabled by default for CollapsingContainer |
182 // marquee is disabled by default for CollapsingContainer |
186 marqueeEnabled = false; |
183 marqueeEnabled = false; |
187 } |
184 } |
188 |
185 |
189 if( groupBoxType == GroupBoxSimpleLabel ){ |
186 if( groupBoxType == GroupBoxSimpleLabel ){ |
261 to fill in all the information themselves. |
258 to fill in all the information themselves. |
262 */ |
259 */ |
263 void HbGroupBoxHeadingWidget::initStyleOption( HbStyleOptionGroupBox *option ) const |
260 void HbGroupBoxHeadingWidget::initStyleOption( HbStyleOptionGroupBox *option ) const |
264 { |
261 { |
265 HbWidget::initStyleOption( option ); |
262 HbWidget::initStyleOption( option ); |
266 option->collapsed = collapsed; |
263 //option->collapsed = collapsed; |
|
264 option->collapsed = groupBox->isCollapsed(); |
267 option->heading = headingText; |
265 option->heading = headingText; |
268 option->marqueeEnabled = marqueeEnabled; |
266 option->marqueeEnabled = marqueeEnabled; |
269 // state & type info reqd fo background primitve updation |
267 // state & type info reqd fo background primitve updation |
270 if ( headingPressed ) { |
268 if ( headingPressed ) { |
271 option->state = QStyle::State_On; |
269 option->state = QStyle::State_On; |
320 { |
318 { |
321 #ifdef HB_GESTURE_FW |
319 #ifdef HB_GESTURE_FW |
322 Q_UNUSED( event ) |
320 Q_UNUSED( event ) |
323 #else |
321 #else |
324 HbWidget::mousePressEvent( event ); |
322 HbWidget::mousePressEvent( event ); |
325 if ( !collapsable ){ |
323 if ( !( groupBox->isCollapsable( ) ) ){ |
326 event->ignore(); |
324 event->ignore(); |
327 return; |
325 return; |
328 } |
326 } |
329 |
327 |
330 if (groupBoxType == GroupBoxCollapsingContainer) { |
328 if (groupBoxType == GroupBoxCollapsingContainer) { |
387 { |
385 { |
388 if(HbTapGesture *tap = qobject_cast<HbTapGesture*>( event->gesture( Qt::TapGesture ) ) ) { |
386 if(HbTapGesture *tap = qobject_cast<HbTapGesture*>( event->gesture( Qt::TapGesture ) ) ) { |
389 switch( tap->state() ) { |
387 switch( tap->state() ) { |
390 case Qt::GestureStarted: // |
388 case Qt::GestureStarted: // |
391 { |
389 { |
392 if ( !collapsable ){ |
390 if ( !(groupBox->isCollapsable( )) ){ |
393 event->ignore( tap ); |
391 event->ignore( tap ); |
394 return; |
392 return; |
395 } |
393 } |
396 if ( collapsable ) { |
394 if ( groupBox->isCollapsable( ) ) { |
397 HbWidgetFeedback::triggered( this, Hb::InstantPressed, Hb::ModifierCollapsedItem ); |
395 HbWidgetFeedback::triggered( this, Hb::InstantPressed, Hb::ModifierCollapsedItem ); |
398 } |
396 } |
399 else { |
397 else { |
400 HbWidgetFeedback::triggered( this, Hb::InstantPressed ); |
398 HbWidgetFeedback::triggered( this, Hb::InstantPressed ); |
401 } |
399 } |
422 setProperty( "state", "normal" ); |
420 setProperty( "state", "normal" ); |
423 break; |
421 break; |
424 } |
422 } |
425 case Qt::GestureFinished: // emit clicked |
423 case Qt::GestureFinished: // emit clicked |
426 { |
424 { |
427 if ( collapsable ) { |
425 if ( groupBox->isCollapsable( ) ) { |
428 HbWidgetFeedback::triggered( this, Hb::InstantReleased, Hb::ModifierCollapsedItem ); |
426 HbWidgetFeedback::triggered( this, Hb::InstantReleased, Hb::ModifierCollapsedItem ); |
429 } else { |
427 } else { |
430 HbWidgetFeedback::triggered( this, Hb::InstantReleased ); |
428 HbWidgetFeedback::triggered( this, Hb::InstantReleased ); |
431 } |
429 } |
432 |
430 |
434 if ( mIconItem && mIconItem->isUnderMouse( ) ) { |
432 if ( mIconItem && mIconItem->isUnderMouse( ) ) { |
435 #ifdef HB_EFFECTS |
433 #ifdef HB_EFFECTS |
436 HbEffect::start( mIconItem, HB_GROUPBOX_HEADING_TYPE, "iconclick" ); |
434 HbEffect::start( mIconItem, HB_GROUPBOX_HEADING_TYPE, "iconclick" ); |
437 #endif |
435 #endif |
438 } |
436 } |
439 emit clicked( !collapsed ); |
437 emit clicked( !(groupBox->isCollapsed()) ); |
440 } |
438 } |
441 // background primitive updation, upon mouse release |
439 // background primitive updation, upon mouse release |
442 headingPressed = false; |
440 headingPressed = false; |
443 |
441 |
444 HbStyleOptionGroupBox groupBoxOption; |
442 HbStyleOptionGroupBox groupBoxOption; |