@@ -59,7 +59,6 @@ TransposeDialog::TransposeDialog(QWidget* parent)
5959 });
6060 setEnableTransposeChordNames (hasChordNames);
6161
62- setKey (firstPitchedStaffKey ());
6362 restorePreviousSettings ();
6463
6564 connect (this , &TransposeDialog::accepted, this , &TransposeDialog::apply);
@@ -252,38 +251,6 @@ void TransposeDialog::apply()
252251 }
253252}
254253
255- Key TransposeDialog::firstPitchedStaffKey () const
256- {
257- mu::engraving::staff_idx_t startStaffIdx = 0 ;
258- mu::engraving::staff_idx_t endStaffIdx = 0 ;
259- Fraction startTick = Fraction (0 , 1 );
260- INotationSelectionRangePtr range = selection ()->range ();
261-
262- if (selection ()->isRange ()) {
263- startStaffIdx = range->startStaffIndex ();
264- endStaffIdx = range->endStaffIndex ();
265- startTick = range->startTick ();
266- }
267-
268- Key key = Key::C;
269-
270- for (const Part* part : notation ()->parts ()->partList ()) {
271- for (const Staff* staff : part->staves ()) {
272- if (staff->idx () < startStaffIdx || staff->idx () > endStaffIdx) {
273- continue ;
274- }
275-
276- if (staff->isPitchedStaff (startTick)) {
277- key = staff->concertKey (startTick);
278-
279- break ;
280- }
281- }
282- }
283-
284- return key;
285- }
286-
287254void TransposeDialog::setEnableTransposeKeys (bool val)
288255{
289256 transposeKeys->setEnabled (val);
@@ -380,6 +347,7 @@ void TransposeDialog::restorePreviousSettings()
380347 setInterval (options.interval );
381348 setUseDoubleSharpsFlats (options.needTransposeDoubleSharpsFlats );
382349 setTransposeChordNames (options.needTransposeChordNames );
350+ setKey (options.key );
383351}
384352
385353TransposeOptions& TransposeDialog::lastUsedOptions ()
0 commit comments