Help: Fix missing page switching keyboard shortcuts for external window

Which are relevant now that external windows support multiple pages.

Change-Id: Ibc748e9e0582c8d54264af535c32aa2702f91631
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Eike Ziller
2019-09-27 13:05:34 +02:00
parent 6123580767
commit d34aee4d53
3 changed files with 31 additions and 27 deletions

View File

@@ -191,8 +191,6 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
HelpPluginPrivate::HelpPluginPrivate() HelpPluginPrivate::HelpPluginPrivate()
{ {
Context modecontext(Help::Constants::C_MODE_HELP);
const QString &locale = ICore::userInterfaceLanguage(); const QString &locale = ICore::userInterfaceLanguage();
if (!locale.isEmpty()) { if (!locale.isEmpty()) {
auto qtr = new QTranslator(this); auto qtr = new QTranslator(this);
@@ -284,29 +282,6 @@ HelpPluginPrivate::HelpPluginPrivate()
ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_SUPPORT); ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_SUPPORT);
connect(action, &QAction::triggered, this, &HelpPluginPrivate::slotSystemInformation); connect(action, &QAction::triggered, this, &HelpPluginPrivate::slotSystemInformation);
if (ActionContainer *windowMenu = ActionManager::actionContainer(Core::Constants::M_WINDOW)) {
// reuse EditorManager constants to avoid a second pair of menu actions
// Goto Previous In History Action
action = new QAction(this);
Command *ctrlTab = ActionManager::registerAction(action, Core::Constants::GOTOPREVINHISTORY,
modecontext);
windowMenu->addAction(ctrlTab, Core::Constants::G_WINDOW_NAVIGATE);
connect(action,
&QAction::triggered,
m_centralWidget->openPagesManager(),
&OpenPagesManager::gotoPreviousPage);
// Goto Next In History Action
action = new QAction(this);
Command *ctrlShiftTab = ActionManager::registerAction(action, Core::Constants::GOTONEXTINHISTORY,
modecontext);
windowMenu->addAction(ctrlShiftTab, Core::Constants::G_WINDOW_NAVIGATE);
connect(action,
&QAction::triggered,
m_centralWidget->openPagesManager(),
&OpenPagesManager::gotoNextPage);
}
connect(&helpIndexFilter, &HelpIndexFilter::linksActivated, connect(&helpIndexFilter, &HelpIndexFilter::linksActivated,
this, &HelpPluginPrivate::showLinksInCurrentViewer); this, &HelpPluginPrivate::showLinksInCurrentViewer);

View File

@@ -261,8 +261,35 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget
layout->addWidget(m_filterComboBox); layout->addWidget(m_filterComboBox);
connect(m_filterComboBox, QOverload<int>::of(&QComboBox::activated), connect(m_filterComboBox, QOverload<int>::of(&QComboBox::activated),
LocalHelpManager::instance(), &LocalHelpManager::setFilterIndex); LocalHelpManager::instance(), &LocalHelpManager::setFilterIndex);
connect(LocalHelpManager::instance(), &LocalHelpManager::filterIndexChanged, connect(LocalHelpManager::instance(),
m_filterComboBox, &QComboBox::setCurrentIndex); &LocalHelpManager::filterIndexChanged,
m_filterComboBox,
&QComboBox::setCurrentIndex);
Core::ActionContainer *windowMenu = Core::ActionManager::actionContainer(
Core::Constants::M_WINDOW);
if (QTC_GUARD(windowMenu)) {
// reuse EditorManager constants to avoid a second pair of menu actions
m_gotoPrevious = new QAction(this);
cmd = Core::ActionManager::registerAction(m_gotoPrevious,
Core::Constants::GOTOPREVINHISTORY,
context);
windowMenu->addAction(cmd, Core::Constants::G_WINDOW_NAVIGATE);
connect(m_gotoPrevious,
&QAction::triggered,
openPagesManager(),
&OpenPagesManager::gotoPreviousPage);
m_gotoNext = new QAction(this);
cmd = Core::ActionManager::registerAction(m_gotoNext,
Core::Constants::GOTONEXTINHISTORY,
context);
windowMenu->addAction(cmd, Core::Constants::G_WINDOW_NAVIGATE);
connect(m_gotoNext,
&QAction::triggered,
openPagesManager(),
&OpenPagesManager::gotoNextPage);
}
} else { } else {
layout->addWidget(new QLabel(), 10); layout->addWidget(new QLabel(), 10);
} }

View File

@@ -161,6 +161,8 @@ private:
QAction *m_resetScale = nullptr; QAction *m_resetScale = nullptr;
QAction *m_printAction = nullptr; QAction *m_printAction = nullptr;
QAction *m_copy = nullptr; QAction *m_copy = nullptr;
QAction *m_gotoPrevious = nullptr;
QAction *m_gotoNext = nullptr;
QStackedWidget *m_viewerStack = nullptr; QStackedWidget *m_viewerStack = nullptr;
QPrinter *m_printer = nullptr; QPrinter *m_printer = nullptr;