Return key is set as shortcut

• May 15, 2014 - 20:32
Type
Functional
Severity
S4 - Minor
Status
closed
Project

If the Return key is set as shortcut, none of the other objects that should do something when Return is pressed will perform any action.

For this issue I can think of two solutions, but I'm open to other suggestions if those are not good:
1. I could change the the shortcut. In order to keep the new shortcut similar, I would suggest Ctrl+Enter. This is the most simple solution that I can think of.

2. (I'm not sure if this is possible) I could override the event method int the BarLine class to make it look something like this:


void BarLine::event(QEvent *e){

     if(e->type() == QEvent::KeyPress){
       QKeyEvent* keyEvent = static_cast(e);

        if(this->isSelected() && keyEvent->key() == Qt::Key_Return){
            toggle system break here;
            return true;
            }
        }

    return Element::event(e);
    }

This solution has the advantage of keeping the same behaviour when the Return key is presssed, form the user's perspective. But, again, I'm not sure if it can be done and if it has other implications.

I'm waiting for comments and suggestions. :)
Thank you!
Andrei


Comments

I think keeping the existing Enter behavior when applied to a barline would be preferable. Ctrl+Enter, BTW, is already used also, to add a page break.

As I mentioned in developer list discussion, there is definitely precedent in MuseScore for state-dependent shortcuts. So I don't think there is any reason not to have Enter behave this way. I have no opinion on the specific implementation you show here. If it works, that could be fine, but do look into how other state-dependent shortcuts are handled - Space bar ("play" normally, but move to next syllable or chord symbol in lyric or chord symbol entry modes, etc).

The normal behavior is to use the Alt key to enable keyboard and tab navigation. Once you are in the keyboard navigation mode Return and Space would activate the currently selected button or menu item (experiment with a couple other software programs to see what I mean).

MuseScore defines which modes the keyboard shortcuts apply to in mscore/actions.cpp (using "STATE_...")

@Marc
Sorry, I've looked in the shortcut XML file, but I must have missed it.

@David
Do you know this to be the standard?

As I said on the mailing list creating a new state affects more then just the navigation through the menus and tool bar. When I'm saying this I'm thinking about palettes and how should this be handled there in order to make both navigation and applying the elements to the score possible. I will think about it and present here possible advantages and disadvantages.

@AndreiTuicu:
Sorry for my confusion. The Alt key is to activate navigation of the menus, not for Tab navigation of the other aspects of the interface. However once you are in keyboard navigation mode (via Alt or Tab) the space and enter keys do seem to act within the keyboard navigation mode only. I tested on Windows 7 with Firefox, iTunes, Windows Media Player, Microsoft Word, Microsoft Paint, etc.