forked from qt-creator/qt-creator
Help Window: Add search view to side bar
Change-Id: If3acbad9694b6d1a3441007a9fa9c13a3738aa5f Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include "indexwindow.h"
|
||||
#include "localhelpmanager.h"
|
||||
#include "openpagesmanager.h"
|
||||
#include "searchwidget.h"
|
||||
#include "topicchooser.h"
|
||||
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
@@ -261,6 +262,7 @@ HelpWidget::~HelpWidget()
|
||||
Core::ActionManager::unregisterAction(m_contentsAction, Constants::HELP_CONTENTS);
|
||||
Core::ActionManager::unregisterAction(m_indexAction, Constants::HELP_INDEX);
|
||||
Core::ActionManager::unregisterAction(m_bookmarkAction, Constants::HELP_BOOKMARKS);
|
||||
Core::ActionManager::unregisterAction(m_searchAction, Constants::HELP_SEARCH);
|
||||
}
|
||||
Core::ICore::removeContextObject(m_context);
|
||||
Core::ActionManager::unregisterAction(m_copy, Core::Constants::COPY);
|
||||
@@ -325,8 +327,17 @@ void HelpWidget::addSideBar()
|
||||
: tr("Ctrl+Shift+B")));
|
||||
shortcutMap.insert(QLatin1String(Constants::HELP_BOOKMARKS), cmd);
|
||||
|
||||
auto searchItem = new SearchSideBarItem;
|
||||
connect(searchItem, &SearchSideBarItem::linkActivated, this, &HelpWidget::openFromSearch);
|
||||
m_searchAction = new QAction(tr("Activate Help Search View"), this);
|
||||
cmd = Core::ActionManager::registerAction(m_searchAction, Constants::HELP_SEARCH,
|
||||
m_context->context());
|
||||
cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+/")
|
||||
: tr("Ctrl+Shift+/")));
|
||||
shortcutMap.insert(QLatin1String(Constants::HELP_SEARCH), cmd);
|
||||
|
||||
QList<Core::SideBarItem *> itemList;
|
||||
itemList << contentItem << indexItem << bookmarkItem;
|
||||
itemList << contentItem << indexItem << bookmarkItem << searchItem;
|
||||
m_sideBar = new Core::SideBar(itemList,
|
||||
QList<Core::SideBarItem *>() << contentItem << indexItem);
|
||||
m_sideBar->setShortcutMap(shortcutMap);
|
||||
@@ -346,6 +357,9 @@ void HelpWidget::addSideBar()
|
||||
connect(m_bookmarkAction, &QAction::triggered, m_sideBar, [this]() {
|
||||
m_sideBar->activateItem(QLatin1String(Constants::HELP_BOOKMARKS));
|
||||
});
|
||||
connect(m_searchAction, &QAction::triggered, m_sideBar, [this]() {
|
||||
m_sideBar->activateItem(QLatin1String(Constants::HELP_SEARCH));
|
||||
});
|
||||
}
|
||||
|
||||
HelpViewer *HelpWidget::currentViewer() const
|
||||
|
||||
@@ -144,6 +144,7 @@ private:
|
||||
QAction *m_contentsAction;
|
||||
QAction *m_indexAction;
|
||||
QAction *m_bookmarkAction;
|
||||
QAction *m_searchAction;
|
||||
};
|
||||
|
||||
} // Internal
|
||||
|
||||
Reference in New Issue
Block a user