@@ -3748,18 +3748,18 @@ void MainWindow::RestoreCurrentScene()
37483748}
37493749
37503750// -----------------------------------------------------------------------------
3751- // / @brief incrementDraftBlock Switch draft block incrementally.
3751+ // / @brief incrementDraftBlock Change draft block incrementally.
37523752// /
3753- // / This method switches the current draft block by incrementing the combobox box current item up or down .
3753+ // / This method changes the current draft block by selecting the previous or next combobox box item .
37543754// /
3755- // / @param increment determines whether to increment up or down .
3755+ // / @param selection determines whether to select previous or next draft block .
37563756// /
37573757// / @details
3758- // / - an increment value of DraftBlock::MovePrev changes to the previous block;
3759- // / - an increment value of DraftBlock::MovePrev changes to the next block.
3760- // / - incrementimg wraps at the first or last item.
3758+ // / - an selection value of Selection::Prev selects the previous block;
3759+ // / - an selection value of Selection::Next selects the next block.
3760+ // / - selection wraps at the first or last item.
37613761// -----------------------------------------------------------------------------
3762- void MainWindow::changeDraftBlock (DraftBlock increment )
3762+ void MainWindow::changeDraftBlock (Selection selection )
37633763{
37643764 int index = draftBlockComboBox->currentIndex ();
37653765 const int count = draftBlockComboBox->count ();
@@ -3769,17 +3769,31 @@ void MainWindow::changeDraftBlock(DraftBlock increment)
37693769 return ;
37703770 }
37713771
3772- if ((index == 0 ) && (increment == DraftBlock::MovePrev ))
3772+ if ((index == 0 ) && (selection == Selection::Prev ))
37733773 {
37743774 index = count - 1 ;
37753775 }
3776- else if ((index == count - 1 ) && (increment == DraftBlock::MoveNext ))
3776+ else if ((index == count - 1 ) && (selection == Selection::Next ))
37773777 {
37783778 index = 0 ;
37793779 }
37803780 else
37813781 {
3782- index = index + static_cast <int >(increment);
3782+ switch (static_cast <int >(selection))
3783+ {
3784+ case Selection::Prev:
3785+ {
3786+ index = index - 1 ;
3787+ break ;
3788+ }
3789+ case Selection::Next:
3790+ {
3791+ index = index + 1 ;
3792+ break ;
3793+ }
3794+ default :
3795+ break ;
3796+ }
37833797 }
37843798
37853799 draftBlockComboBox->setCurrentIndex (index);
@@ -5762,12 +5776,12 @@ void MainWindow::createActions()
57625776 // Edit Menu
57635777 connect (ui->previousDraftBlock_Action , &QAction::triggered, this , [this ]()
57645778 {
5765- changeDraftBlock (DraftBlock::MovePrev );
5779+ changeDraftBlock (Selection::Prev );
57665780 });
57675781
57685782 connect (ui->nextDraftBlock_Action , &QAction::triggered, this , [this ]()
57695783 {
5770- changeDraftBlock (DraftBlock::MoveNext);
5784+ changeDraftBlock (Selection::Next);
57715785 });
57725786
57735787 connect (ui->labelTemplateEditor_Action , &QAction::triggered, this , [this ]()
0 commit comments