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)) );
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 );
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;
}
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<ActionId> anIds = myActionMap.keys();
for( int i = 0 ; i < anIds.size() ; i++ ){
if( !myCurve )
return;
stopActionMode();
- myCurve->join();
+ myCurve->join( 0, myCurve->getNbSections() );
mySectionView->reset();
updateActionsStates();
updateUndoRedo();
void CurveCreator_Widget::onContextMenu( QPoint thePoint )
{
QList<ActionId> 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);