Skip to content

Commit

Permalink
fix #278320 Tablature staves reported as standard in instruments dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Nov 30, 2018
1 parent f290089 commit 070f767
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
26 changes: 24 additions & 2 deletions mscore/instrwidget.cpp
Expand Up @@ -39,6 +39,10 @@

namespace Ms {

int StaffListItem::customStandardIdx;
int StaffListItem::customPercussionIdx;
int StaffListItem::customTablatureIdx;

void filterInstruments(QTreeWidget *instrumentList, const QString &searchPhrase = QString());

//---------------------------------------------------------
Expand Down Expand Up @@ -137,6 +141,13 @@ void StaffListItem::initStaffTypeCombo(bool forceRecreate)
}
++idx;
}
customStandardIdx = _staffTypeCombo->count();
_staffTypeCombo->addItem(tr("Custom Standard"), 0);
customPercussionIdx = _staffTypeCombo->count();
_staffTypeCombo->addItem(tr("Custom Percussion"), 0);
customTablatureIdx = _staffTypeCombo->count();
_staffTypeCombo->addItem(tr("Custom Tablature"), 0);

treeWidget()->setItemWidget(this, 4, _staffTypeCombo);
connect(_staffTypeCombo, SIGNAL(currentIndexChanged(int)), SLOT(staffTypeChanged(int)) );
}
Expand Down Expand Up @@ -196,8 +207,19 @@ void StaffListItem::setStaffType(const StaffType* st)
return;
}
}
qDebug("StaffListItem::setStaffType: not found\n");
_staffTypeCombo->setCurrentIndex(0); // if none found, default to standard staff type
int idx = 0;
switch (st->group()) {
case StaffGroup::STANDARD:
idx = customStandardIdx;
break;
case StaffGroup::PERCUSSION:
idx = customPercussionIdx;
break;
case StaffGroup::TAB:
idx = customTablatureIdx;
break;
}
_staffTypeCombo->setCurrentIndex(idx);
}
}

Expand Down
3 changes: 3 additions & 0 deletions mscore/instrwidget.h
Expand Up @@ -61,6 +61,9 @@ class StaffListItem : public QObject, public QTreeWidgetItem {
QComboBox* _staffTypeCombo { nullptr };
Staff* _staff { 0 };
ListItemOp _op { ListItemOp::KEEP };
static int customStandardIdx;
static int customPercussionIdx;
static int customTablatureIdx;

private slots:
void staffTypeChanged(int);
Expand Down

0 comments on commit 070f767

Please sign in to comment.