From: asl Date: Fri, 13 Dec 2013 09:57:41 +0000 (+0000) Subject: bug #63: join of sections X-Git-Tag: BR_hydro_v_0_5~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a25ccf745a10b7a5e0b73584d365ad5892c6cb73;p=modules%2Fhydro.git bug #63: join of sections --- diff --git a/src/HYDROCurveCreator/CurveCreator_Widget.cxx b/src/HYDROCurveCreator/CurveCreator_Widget.cxx index 28f7c5b5..6961f01b 100644 --- a/src/HYDROCurveCreator/CurveCreator_Widget.cxx +++ b/src/HYDROCurveCreator/CurveCreator_Widget.cxx @@ -95,6 +95,7 @@ CurveCreator_Widget::CurveCreator_Widget(QWidget* parent, QGroupBox* aSectionGroup = new QGroupBox(tr("Sections"),this); mySectionView = new CurveCreator_TreeView(myCurve, aSectionGroup); + mySectionView->setSelectionMode( QTreeView::ExtendedSelection ); connect( mySectionView, SIGNAL(selectionChanged()), this, SLOT( onSelectionChanged() ) ); connect( mySectionView, SIGNAL(sectionEntered(int)), this, SLOT(onEditSection(int)) ); connect( mySectionView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onContextMenu(QPoint)) ); @@ -185,22 +186,20 @@ CurveCreator_Widget::CurveCreator_Widget(QWidget* parent, connect(anAct, SIGNAL(triggered()), this, SLOT(onRemove()) ); aTB->addAction(anAct); - // TODO join - //aTB->addSeparator(); + aTB->addSeparator(); - //anAct = createAction( JOIN_ID, tr("JOIN"), aJoinPixmap, tr("JOIN_TLT"), - // QKeySequence(Qt::ControlModifier|Qt::Key_Plus ) ); - //connect( anAct, SIGNAL(triggered()), this, SLOT(onJoin()) ); - //aTB->addAction(anAct); + anAct = createAction( JOIN_ID, tr("JOIN"), aJoinPixmap, tr("JOIN_TLT"), + QKeySequence(Qt::ControlModifier|Qt::Key_Plus ) ); + connect( anAct, SIGNAL(triggered()), this, SLOT(onJoin()) ); + aTB->addAction(anAct); anAct = createAction( CLEAR_ALL_ID, tr("CLEAR_ALL"), QPixmap(), tr("CLEAR_ALL_TLT"), QKeySequence(Qt::ControlModifier | Qt::ShiftModifier | Qt::Key_Delete ) ); connect( anAct, SIGNAL(triggered()), this, SLOT( onClearAll()) ); - // TODO join - //anAct = createAction( JOIN_ALL_ID, tr("JOIN_ALL"), QPixmap(), tr("JOIN_ALL_TLT"), - // QKeySequence(Qt::ControlModifier | Qt::ShiftModifier | Qt::Key_Plus ) ); - //connect( anAct, SIGNAL(triggered()), this, SLOT(onJoinAll()) ); + anAct = createAction( JOIN_ALL_ID, tr("JOIN_ALL"), QPixmap(), tr("JOIN_ALL_TLT"), + QKeySequence(Qt::ControlModifier | Qt::ShiftModifier | Qt::Key_Plus ) ); + connect( anAct, SIGNAL(triggered()), this, SLOT(onJoinAll()) ); QVBoxLayout* aSectLayout = new QVBoxLayout(); aSectLayout->setMargin( 5 ); @@ -373,18 +372,25 @@ void CurveCreator_Widget::updateActionsStates() int aSectCnt = myCurve->getNbSections(); if( aSectCnt > 0 ) anEnabledAct << CLEAR_ALL_ID; - // TODO - //if( aSectCnt > 1 ) - // anEnabledAct << JOIN_ALL_ID; - //if( aSelSections.size() > 1 ){ - // anEnabledAct << JOIN_ID; - //} + if( aSectCnt > 1 ) + anEnabledAct << JOIN_ALL_ID; + if( aSelSections.size() > 1 ){ + anEnabledAct << JOIN_ID; + } } break; case DetectionMode: { } break; case NoneMode: + { + int aSectCnt = myCurve->getNbSections(); + if( aSectCnt > 1 ) + anEnabledAct << JOIN_ALL_ID; + if( aSelSections.size() > 1 ) + anEnabledAct << JOIN_ID; + } + break; default: break; } @@ -417,10 +423,9 @@ void CurveCreator_Widget::updateActionsStates() if( (myCurve->getNbSections() + myCurve->getNbPoints()) > 0 ){ anEnabledAct << REMOVE_ALL_ID; }*/ - // TODO - //if( myCurve->getNbSections() > 1 ){ - // anEnabledAct << JOIN_ALL_ID; - //} + if( myCurve->getNbSections() > 1 ){ + anEnabledAct << JOIN_ALL_ID; + } } QList anIds = myActionMap.keys(); for( int i = 0 ; i < anIds.size() ; i++ ){ @@ -714,7 +719,7 @@ void CurveCreator_Widget::onJoinAll() if( !myCurve ) return; stopActionMode(); - myCurve->join(); + myCurve->join( 0, myCurve->getNbSections() ); mySectionView->reset(); updateActionsStates(); updateUndoRedo(); @@ -827,7 +832,7 @@ void CurveCreator_Widget::updateUndoRedo() void CurveCreator_Widget::onContextMenu( QPoint thePoint ) { QList aContextActions; - aContextActions << CLEAR_ALL_ID << JOIN_ALL_ID << SEPARATOR_ID << + aContextActions << CLEAR_ALL_ID << JOIN_ID << JOIN_ALL_ID << SEPARATOR_ID << CLOSE_SECTIONS_ID << UNCLOSE_SECTIONS_ID << SET_SECTIONS_POLYLINE_ID << SET_SECTIONS_SPLINE_ID; QPoint aGlPoint = mySectionView->mapToGlobal(thePoint);