Skip to content

Commit

Permalink
fix #229246: staff incorrectly numbered in "Chose Instruments" dialog
Browse files Browse the repository at this point in the history
Staff numbers are only updated (actually re-created by `genPartList()`) upon next opening of the dialog, not instantly when staffs are changed. A new function `updatePartIdx()` does what's needed to be done.
  • Loading branch information
Harmoniker1 committed Nov 10, 2019
1 parent 5acccf8 commit 0176d22
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions mscore/instrwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,25 @@ void InstrumentsWidget::genPartList(Score* cs)
partiturList->resizeColumnToContents(4);
}

//---------------------------------------------------------
// updatePartIdx
//---------------------------------------------------------

void InstrumentsWidget::updatePartIdx()
{
for (int i = 0; i < partiturList->topLevelItemCount(); ++i) {
PartListItem* tli = static_cast<PartListItem*>(partiturList->topLevelItem(i));
int partIdx = -1;
for (int j = 0; j < tli->childCount(); ++j) {
StaffListItem* sli = static_cast<StaffListItem*>(tli->child(j));
if (!sli->isHidden()) {
partIdx++;
sli->setPartIdx(partIdx);
}
}
}
}

//---------------------------------------------------------
// on_instrumentList_itemSelectionChanged
//---------------------------------------------------------
Expand Down Expand Up @@ -674,6 +693,7 @@ void InstrumentsWidget::on_removeButton_clicked()
}
partiturList->setCurrentItem(nextParent);
}
updatePartIdx();
}

//---------------------------------------------------------
Expand Down Expand Up @@ -763,6 +783,7 @@ void InstrumentsWidget::on_upButton_clicked()
}
}
}
updatePartIdx();
}

//---------------------------------------------------------
Expand Down Expand Up @@ -854,6 +875,7 @@ void InstrumentsWidget::on_downButton_clicked()
}
}
}
updatePartIdx();
}

//---------------------------------------------------------
Expand Down Expand Up @@ -893,6 +915,7 @@ StaffListItem* InstrumentsWidget::on_addStaffButton_clicked()
partiturList->clearSelection(); // should not be necessary
partiturList->setCurrentItem(nsli);
pli->updateClefs();
updatePartIdx();
return nsli;
}

Expand Down
1 change: 1 addition & 0 deletions mscore/instrwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ class InstrumentsWidget : public QWidget, public Ui::InstrumentsWidget {
public:
InstrumentsWidget(QWidget* parent = 0);
void genPartList(Score*);
void updatePartIdx();
void init();
void createInstruments(Score*);
QTreeWidget* getPartiturList();
Expand Down

0 comments on commit 0176d22

Please sign in to comment.