src/hbwidgets/editors/hbselectioncontrol_p.cpp
changeset 5 627c4a0fd0e7
parent 2 06ff229162e9
child 6 c3690ec91ef8
equal deleted inserted replaced
3:11d3954df52a 5:627c4a0fd0e7
    89     void panGestureStarted (HbPanGesture *gesture);
    89     void panGestureStarted (HbPanGesture *gesture);
    90     void panGestureUpdated (HbPanGesture *gesture);
    90     void panGestureUpdated (HbPanGesture *gesture);
    91     void panGestureFinished (HbPanGesture *gesture);
    91     void panGestureFinished (HbPanGesture *gesture);
    92     void show();
    92     void show();
    93     void _q_aboutToChangeView();
    93     void _q_aboutToChangeView();
       
    94     void detachEditor(bool updateAtthachedEditorState);
    94 
    95 
    95 public:
    96 public:
    96 
    97 
    97     HbAbstractEdit *mEdit;
    98     HbAbstractEdit *mEdit;
    98     QGraphicsItem *mTopLevelAncestor;
    99     QGraphicsItem *mTopLevelAncestor;
   464     if (mEdit && q->isVisible()) {
   465     if (mEdit && q->isVisible()) {
   465         mEdit->deselect();
   466         mEdit->deselect();
   466     }
   467     }
   467 }
   468 }
   468 
   469 
       
   470 void HbSelectionControlPrivate::detachEditor(bool updateAtthachedEditorState)
       
   471 {
       
   472     Q_Q(HbSelectionControl);
       
   473     if (mEdit) {
       
   474         q->hideHandles();
       
   475         reparentHandles(q);
       
   476         if (updateAtthachedEditorState) {
       
   477             mEdit->disconnect(q);
       
   478             mEdit->d_func()->selectionControl = 0;
       
   479             mEdit->deselect();
       
   480         }
       
   481         mEdit = 0;
       
   482         mTopLevelAncestor = 0;
       
   483     }
       
   484 }
   469 
   485 
   470 HbSelectionControl::HbSelectionControl() : HbWidget(*new HbSelectionControlPrivate(),0)
   486 HbSelectionControl::HbSelectionControl() : HbWidget(*new HbSelectionControlPrivate(),0)
   471 
   487 
   472 {
   488 {
   473     Q_D(HbSelectionControl);
   489     Q_D(HbSelectionControl);
   508 }
   524 }
   509 
   525 
   510 void HbSelectionControl::detachEditor()
   526 void HbSelectionControl::detachEditor()
   511 {
   527 {
   512     Q_D(HbSelectionControl);
   528     Q_D(HbSelectionControl);
   513     if (d->mEdit) {
   529     d->detachEditor(true);
   514         hideHandles();
   530 }
   515         d->reparentHandles(this);
   531 
   516         d->mEdit->disconnect(this);
   532 void HbSelectionControl::detachEditorFromDestructor()
   517         d->mEdit->d_func()->selectionControl = 0;        
   533 {
   518         d->mEdit->deselect();
   534     Q_D(HbSelectionControl);
   519         d->mEdit = 0;
   535     d->detachEditor(false);
   520         d->mTopLevelAncestor = 0;
   536 }
   521     }
       
   522 }
       
   523 
       
   524 
   537 
   525 void HbSelectionControl::hideHandles()
   538 void HbSelectionControl::hideHandles()
   526 {
   539 {
   527     Q_D(HbSelectionControl);
   540     Q_D(HbSelectionControl);
   528     if (isVisible() && d->mEdit) {
   541     if (isVisible() && d->mEdit) {