fix #23052 hide instrument name style option
This commit is contained in:
parent
2bf563b515
commit
20f0fc07e9
6 changed files with 14 additions and 13 deletions
|
@ -318,6 +318,8 @@ void initStyle(MStyle* s)
|
|||
false, QColor(Qt::black), QColor(255, 255, 255, 0), // default params
|
||||
TextStyle::HIDE_IN_EDITOR); // don't show in Style Editor
|
||||
|
||||
s->set(ST_hideInstrumentNameIfOneInstrument, true);
|
||||
|
||||
#undef MM
|
||||
#undef OA
|
||||
#undef OS
|
||||
|
|
|
@ -274,6 +274,7 @@ enum StyleIdx {
|
|||
ST_minMMRestWidth,
|
||||
ST_hideEmptyStaves,
|
||||
ST_dontHideStavesInFirstSystem,
|
||||
ST_hideInstrumentNameIfOneInstrument,
|
||||
ST_gateTime,
|
||||
ST_tenutoGateTime,
|
||||
ST_staccatoGateTime,
|
||||
|
|
|
@ -498,7 +498,8 @@ void System::setInstrumentNames(bool longName)
|
|||
//
|
||||
if (isVbox()) // ignore vbox
|
||||
return;
|
||||
if (!score()->showInstrumentNames()) {
|
||||
if (!score()->showInstrumentNames()
|
||||
|| (score()->styleB(ST_hideInstrumentNameIfOneInstrument) && _staves.size() == 1)) {
|
||||
for (int staffIdx = 0; staffIdx < score()->nstaves(); ++staffIdx) {
|
||||
SysStaff* staff = _staves[staffIdx];
|
||||
foreach(InstrumentName* t, staff->instrumentNames)
|
||||
|
|
|
@ -333,6 +333,7 @@ void EditStyle::getValues()
|
|||
lstyle.set(ST_minMMRestWidth, Spatium(minMeasureWidth->value()));
|
||||
lstyle.set(ST_hideEmptyStaves, hideEmptyStaves->isChecked());
|
||||
lstyle.set(ST_dontHideStavesInFirstSystem, dontHideStavesInFirstSystem->isChecked());
|
||||
lstyle.set(ST_hideInstrumentNameIfOneInstrument, hideInstrumentNameIfOneInstrument->isChecked());
|
||||
|
||||
lstyle.set(ST_accidentalNoteDistance, Spatium(accidentalNoteDistance->value()));
|
||||
lstyle.set(ST_accidentalDistance, Spatium(accidentalDistance->value()));
|
||||
|
@ -587,6 +588,7 @@ void EditStyle::setValues()
|
|||
hideEmptyStaves->setChecked(lstyle.value(ST_hideEmptyStaves).toBool());
|
||||
dontHideStavesInFirstSystem->setChecked(lstyle.value(ST_dontHideStavesInFirstSystem).toBool());
|
||||
dontHideStavesInFirstSystem->setEnabled(hideEmptyStaves->isChecked());
|
||||
hideInstrumentNameIfOneInstrument->setChecked(lstyle.value(ST_hideInstrumentNameIfOneInstrument).toBool());
|
||||
|
||||
accidentalNoteDistance->setValue(lstyle.value(ST_accidentalNoteDistance).toDouble());
|
||||
accidentalDistance->setValue(lstyle.value(ST_accidentalDistance).toDouble());
|
||||
|
|
|
@ -321,6 +321,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hideInstrumentNameIfOneInstrument">
|
||||
<property name="text">
|
||||
<string>Hide instrument name if there is only 1 instrument</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
|
|
@ -524,18 +524,6 @@ void InstrumentWizard::createInstruments(Score* cs)
|
|||
staffIdx = nstaffIdx;
|
||||
}
|
||||
|
||||
//
|
||||
// remove instrument names if only one part
|
||||
//
|
||||
if (cs->parts().size() == 1) {
|
||||
Part* part = cs->parts().front();
|
||||
if (part->instrList()->size() == 1) {
|
||||
Instrument& instrument = part->instrList()->instrument(0);
|
||||
instrument.setShortName("");
|
||||
instrument.setLongName("");
|
||||
}
|
||||
}
|
||||
|
||||
cs->setLayoutAll(true);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue