Changeset View
Standalone View
lib/documentview/documentviewcontroller.cpp
Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Line(s) | 89 | { | |||
---|---|---|---|---|---|
93 | view->collection()->setDefaultShortcut(mZoomToFitAction, Qt::Key_F); | 93 | view->collection()->setDefaultShortcut(mZoomToFitAction, Qt::Key_F); | ||
94 | mZoomToFitAction->setCheckable(true); | 94 | mZoomToFitAction->setCheckable(true); | ||
95 | mZoomToFitAction->setChecked(true); | 95 | mZoomToFitAction->setChecked(true); | ||
96 | mZoomToFitAction->setText(i18n("Zoom to fit")); | 96 | mZoomToFitAction->setText(i18n("Zoom to fit")); | ||
97 | mZoomToFitAction->setIcon(QIcon::fromTheme("zoom-fit-best")); | 97 | mZoomToFitAction->setIcon(QIcon::fromTheme("zoom-fit-best")); | ||
98 | mZoomToFitAction->setIconText(i18nc("@action:button Zoom to fit, shown in status bar, keep it short please", "Fit")); | 98 | mZoomToFitAction->setIconText(i18nc("@action:button Zoom to fit, shown in status bar, keep it short please", "Fit")); | ||
99 | 99 | | |||
100 | mZoomToFillAction = view->addAction("view_zoom_to_fill"); | 100 | mZoomToFillAction = view->addAction("view_zoom_to_fill"); | ||
101 | //view->collection()->setDefaultShortcuts(mZoomToFillAction, Qt::Key_W); ?? | 101 | view->collection()->setDefaultShortcut(mZoomToFillAction, Qt::SHIFT + Qt::Key_F); | ||
102 | mZoomToFillAction->setCheckable(true); | 102 | mZoomToFillAction->setCheckable(true); | ||
103 | mZoomToFillAction->setChecked(false); | 103 | mZoomToFillAction->setChecked(false); | ||
104 | mZoomToFillAction->setText(i18n("Zoom to fill window by fitting to width or height")); | 104 | mZoomToFillAction->setText(i18n("Zoom to fill window by fitting to width or height")); | ||
105 | mZoomToFillAction->setIcon(QIcon::fromTheme("zoom-fit-best")); | 105 | mZoomToFillAction->setIcon(QIcon::fromTheme("zoom-fit-best")); | ||
106 | mZoomToFillAction->setIconText(i18nc("@action:button Zoom to fill (fit width or height), shown in status bar, keep it short please", "Fill")); | 106 | mZoomToFillAction->setIconText(i18nc("@action:button Zoom to fill (fit width or height), shown in status bar, keep it short please", "Fill")); | ||
107 | 107 | | |||
108 | mActualSizeAction = view->addAction(KStandardAction::ActualSize); | 108 | mActualSizeAction = view->addAction(KStandardAction::ActualSize); | ||
109 | mActualSizeAction->setCheckable(true); | 109 | mActualSizeAction->setCheckable(true); | ||
110 | mZoomToFillAction->setChecked(false); | 110 | mZoomToFillAction->setChecked(false); | ||
muhlenpfordt: This seems to be a copy/paste error from 3e10699ac37c.
I'll change this to `mActualSizeAction… | |||||
Thanks for noticing, makes sense. In fact, https://doc.qt.io/qt-5/qaction.html#checked-prop reads
…so you could even remove both calls to setChecked(false). rkflx: Thanks for noticing, makes sense. In fact, https://doc.qt.io/qt-5/qaction.html#checked-prop… | |||||
111 | mActualSizeAction->setIcon(QIcon::fromTheme("zoom-original")); | 111 | mActualSizeAction->setIcon(QIcon::fromTheme("zoom-original")); | ||
The standard action may have any system shortcuts which we should not replace. muhlenpfordt: The standard action may have any system shortcuts which we should not replace. | |||||
When testing I realized I mentioned the wrong shortcut for 100%: It's actually Ctrl+0, which makes even more sense if you consider how this would work on an English keyboard layout. On a German layout this probably means pressing Ctrl instead of ⇧, with 0 and = being on the same key. As this is a KStandardAction::ActualSize, could you check whether we could add the shortcut for everyone in R265 KConfigWidgets, like it's done already for KStandardAction::ZoomOut? In particular check https://lxr.kde.org for conflicts in existing apps. Thanks ;) rkflx: When testing I realized I mentioned the wrong shortcut for {nav 100%}: It's actually {key Ctrl… | |||||
I found no conflicts. Some code uses Ctrl+0 but in this case the shortcut is replaced and will not raise any error. muhlenpfordt: I found no conflicts. Some code uses {key Ctrl 0} but in this case the shortcut is replaced and… | |||||
muhlenpfordt: ~~`KConfigWidgets`~~ {icon arrow-right} `KConfig` (R237): [kstandardshortcut.cpp](https… | |||||
112 | mActualSizeAction->setIconText(i18nc("@action:button Zoom to original size, shown in status bar, keep it short please", "100%")); | 112 | mActualSizeAction->setIconText(i18nc("@action:button Zoom to original size, shown in status bar, keep it short please", "100%")); | ||
113 | 113 | | |||
114 | mZoomInAction = view->addAction(KStandardAction::ZoomIn); | 114 | mZoomInAction = view->addAction(KStandardAction::ZoomIn); | ||
115 | mZoomOutAction = view->addAction(KStandardAction::ZoomOut); | 115 | mZoomOutAction = view->addAction(KStandardAction::ZoomOut); | ||
116 | 116 | | |||
117 | mActions << mZoomToFitAction << mActualSizeAction << mZoomInAction << mZoomOutAction << mZoomToFillAction; | 117 | mActions << mZoomToFitAction << mActualSizeAction << mZoomInAction << mZoomOutAction << mZoomToFillAction; | ||
118 | } | 118 | } | ||
119 | 119 | | |||
▲ Show 20 Lines • Show All 169 Lines • Show Last 20 Lines |
This seems to be a copy/paste error from 3e10699ac37c.
I'll change this to mActualSizeAction->setChecked(false); without a further diff, if nobody has any objections.