[Qgis-developer] Key accelerators vs. key shortcuts.
Lubos Balazovic
lubos.balazovic at gmail.com
Sat Apr 8 14:27:20 EDT 2006
Hi!
For quick navigation through menu items QGIS uses key accelerators.
Key accelerators are always based on one character of the item name
(underlined character in item). In localized version is the item name
translated, so accelerator is logically based on translated name of item, so
the character used for accelerator obviously differs from original one.
The problem comes out with shortcuts. If there are used shortcuts based on
combination Alt+some_key then they may be (and mostly are) in conflict with
key accelerators for main menu items (handled also with Alt). It occurs
especially in localized versions (in current SVN also with original en_US
version).
There are 2 ways how to resolve this:
1. Shortcuts in localized versions are customizable through translation .ts
files so it is possible to have own set of shortcuts for each language to
avoid conflicts with key accelerators. However, I think it's not a good idea
to have various shortcut sets - it is confusing for both, translators and
users.
2. Much better solution is NOT to use shortcuts with Alt key (currently 7
shortcuts affected).
QGIS actually uses these 39 shotcuts (ambigous shortcuts are marked with "!",
shortcuts with Alt-key marked with "*", after "//" followed with suggested
replacement):
mActionFileNew->setShortcut(tr("Ctrl+N"));
! mActionFileOpen->setShortcut(tr("Ctrl+O")); // -OK-
! mActionFileSave->setShortcut(tr("Ctrl+O")); // Ctrl+S
mActionFileSaveAs->setShortcut(tr("Ctrl+A"));
! mActionFilePrint->setShortcut(tr("Ctrl+P")); // -OK-
! mActionSaveMapAsImage->setShortcut(tr("I")); // Ctrl+I
mActionExportMapServer->setShortcut(tr("M"));
mActionFileExit->setShortcut(tr("Ctrl+Q"));
mActionAddNonDbLayer->setShortcut(tr("V"));
mActionAddRasterLayer->setShortcut(tr("R"));
mActionAddLayer->setShortcut(tr("D"));
mActionNewVectorLayer->setShortcut(tr("N"));
mActionRemoveLayer->setShortcut(tr("Ctrl+D"));
mActionAddAllToOverview->setShortcut(tr("+"));
mActionRemoveAllFromOverview->setShortcut(tr("-"));
mActionShowAllLayers->setShortcut(tr("S"));
mActionHideAllLayers->setShortcut(tr("H"));
* mActionProjectProperties->setShortcut(tr("Alt+P")); // P
* mActionOptions->setShortcut(tr("Alt+O")); -nothing-
* mActionCustomProjection->setShortcut(tr("Alt+I")); // -nothing-
mActionHelpContents->setShortcut(tr("F1"));
mActionQgisHomePage->setShortcut(tr("Ctrl+H"));
* mActionQgisSourceForgePage->setShortcut(tr("Alt+H")); // -nothing-
mActionDraw->setShortcut(tr("Ctrl+R"));
! mActionZoomIn->setShortcut(tr("z")); // no case sensitivity // Ctrl++
! mActionZoomOut->setShortcut(tr("Z")); // no case sensitivity // Ctrl+-
! mActionZoomFullExtent->setShortcut(tr("f")); // -OK-
! mActionZoomToSelected->setShortcut(tr("F")); // S
! mActionIdentify->setShortcut(tr("I")); //-OK-
! mActionMeasure->setShortcut(tr("Ctrl+M")); // -OK-
* mActionMeasureArea->setShortcut(tr("Alt+M")); // Ctrl+J
mActionShowBookmarks->setShortcut(tr("Ctrl+B"));
* mActionNewBookmark->setShortcut(tr("Alt+B")); // B
! mActionAddWmsLayer->setShortcut(tr("Ctrl+M")); // W
* mActionInOverview->setShortcut(tr("Alt+O")); // O
! mActionShowPluginManager->setShortcut(tr("Ctrl+P")); // -nothing-
mActionCapturePoint->setShortcut(tr("."));
mActionCaptureLine->setShortcut(tr("/"));
mActionCapturePolygon->setShortcut(tr("Ctrl+/"));
I've submitted a patch to trac, which tidies up shortcuts as suggested above.
Maybe it would be also useful to remove tr() from setShortcut() to preserve
shortcuts integrity (I've never seen real application with localized
shortcuts yet, except Trolltech's Qt examples). In case of keeping tr() for
shortcuts it would be useful to give hint what does the shortcut do (hint is
the second parameter of tr() and it is displayed only in Qt-linguist).
Regards
Lubos
More information about the Qgis-developer
mailing list