Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multiple shortcuts for actions #571

Merged
merged 2 commits into from
Jan 19, 2025
Merged

Conversation

melkorbsd
Copy link
Contributor

No description provided.

@royqh1979
Copy link
Owner

Why not use QKeySequence::listFromString?

@melkorbsd
Copy link
Contributor Author

QKeySequence::listFromString

There was such variant:

action->setShortcuts( QKeySequence::listFromString ( shortcut.replace (',' , ';' ) ) );

but it turned out to be inoperable.

@royqh1979
Copy link
Owner

There was such variant:

action->setShortcuts( QKeySequence::listFromString ( shortcut.replace (',' , ';' ) ) );

but it turned out to be inoperable.

  1. What's the purpose of replacing ';' to ','? Why don't just use listToString() 's default output?
  2. Why the output of listFromString is not workable? It should return a list of qkeysequence.
  3. Manually split string may break if the key squence contains 'ctrl+,' etc.

@melkorbsd
Copy link
Contributor Author

There was such variant:
action->setShortcuts( QKeySequence::listFromString ( shortcut.replace (',' , ';' ) ) );
but it turned out to be inoperable.

1. What's the purpose of replacing ';' to ','? Why don't just use listToString() 's default output?

Because in shortcutmanager uses ',' as multiple shortcut delimiter ("Ctrl+C, Ctrl+Ins"), but listToString() return string value with ';' delimiters.

2. Why the output of listFromString is not workable? It should return a list of qkeysequence.

3. Manually split string may break if the key squence contains 'ctrl+,' etc.

'Ctrl+,' cant, because ',' used as delimiter. Maybe change delimiter to ';' ?

@melkorbsd
Copy link
Contributor Author

I change PR commits, new variant with listFromString and ';' delimiters.

@royqh1979 royqh1979 merged commit 282009e into royqh1979:master Jan 19, 2025
41 of 45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants