forked from qt-creator/qt-creator
HelpPlugin: Modernize
modernize-use-* Change-Id: Ie0058675c1336377326089dbc093436130f1fe03 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -68,7 +68,7 @@ static DocEntry createEntry(const QString &nameSpace, const QString &fileName, b
|
||||
|
||||
class DocModel : public QAbstractListModel {
|
||||
public:
|
||||
typedef QVector<DocEntry> DocEntries;
|
||||
using DocEntries = QVector<DocEntry>;
|
||||
|
||||
explicit DocModel(const DocEntries &e = DocEntries(), QObject *parent = nullptr)
|
||||
: QAbstractListModel(parent), m_docEntries(e) {}
|
||||
@@ -268,7 +268,7 @@ bool DocSettingsPage::eventFilter(QObject *object, QEvent *event)
|
||||
return IOptionsPage::eventFilter(object, event);
|
||||
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *ke = static_cast<QKeyEvent*>(event);
|
||||
auto ke = static_cast<const QKeyEvent*>(event);
|
||||
switch (ke->key()) {
|
||||
case Qt::Key_Delete:
|
||||
removeDocumentation(currentSelection());
|
||||
|
||||
@@ -63,7 +63,7 @@ private:
|
||||
|
||||
QString m_recentDialogPath;
|
||||
|
||||
typedef QHash<QString, QString> NameSpaceToPathHash;
|
||||
using NameSpaceToPathHash = QHash<QString, QString>;
|
||||
NameSpaceToPathHash m_filesToRegister;
|
||||
QHash<QString, bool> m_filesToRegisterUserManaged;
|
||||
NameSpaceToPathHash m_filesToUnregister;
|
||||
|
||||
@@ -59,7 +59,7 @@ private:
|
||||
Ui::FilterSettingsPage m_ui;
|
||||
QPointer<QWidget> m_widget;
|
||||
|
||||
typedef QMap<QString, QStringList> FilterMap;
|
||||
using FilterMap = QMap<QString, QStringList>;
|
||||
FilterMap m_filterMap;
|
||||
FilterMap m_filterMapBackup;
|
||||
|
||||
|
||||
@@ -65,9 +65,7 @@ HelpIndexFilter::HelpIndexFilter()
|
||||
this, &HelpIndexFilter::invalidateCache);
|
||||
}
|
||||
|
||||
HelpIndexFilter::~HelpIndexFilter()
|
||||
{
|
||||
}
|
||||
HelpIndexFilter::~HelpIndexFilter() = default;
|
||||
|
||||
void HelpIndexFilter::prepareSearch(const QString &entry)
|
||||
{
|
||||
|
||||
@@ -203,8 +203,8 @@ HelpPluginPrivate::HelpPluginPrivate()
|
||||
|
||||
const QString &locale = ICore::userInterfaceLanguage();
|
||||
if (!locale.isEmpty()) {
|
||||
QTranslator *qtr = new QTranslator(this);
|
||||
QTranslator *qhelptr = new QTranslator(this);
|
||||
auto qtr = new QTranslator(this);
|
||||
auto qhelptr = new QTranslator(this);
|
||||
const QString &creatorTrPath = ICore::resourcePath() + "/translations";
|
||||
const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
||||
const QString &trFile = QLatin1String("assistant_") + locale;
|
||||
@@ -397,7 +397,7 @@ void HelpPluginPrivate::saveExternalWindowSettings()
|
||||
|
||||
HelpWidget *HelpPluginPrivate::createHelpWidget(const Context &context, HelpWidget::WidgetStyle style)
|
||||
{
|
||||
HelpWidget *widget = new HelpWidget(context, style);
|
||||
auto widget = new HelpWidget(context, style);
|
||||
|
||||
connect(widget->currentViewer(), &HelpViewer::loadFinished,
|
||||
this, &HelpPluginPrivate::highlightSearchTermsInContextHelp);
|
||||
@@ -446,8 +446,8 @@ HelpViewer *HelpPluginPrivate::externalHelpViewer()
|
||||
HelpViewer *HelpPlugin::createHelpViewer(qreal zoom)
|
||||
{
|
||||
// check for backends
|
||||
typedef std::function<HelpViewer *()> ViewerFactory;
|
||||
typedef QPair<QByteArray, ViewerFactory> ViewerFactoryItem; // id -> factory
|
||||
using ViewerFactory = std::function<HelpViewer *()>;
|
||||
using ViewerFactoryItem = QPair<QByteArray, ViewerFactory>; // id -> factory
|
||||
QVector<ViewerFactoryItem> factories;
|
||||
#ifdef QTC_WEBENGINE_HELPVIEWER
|
||||
factories.append(qMakePair(QByteArray("qtwebengine"), []() { return new WebEngineHelpViewer(); }));
|
||||
@@ -491,7 +491,7 @@ HelpViewer *HelpPlugin::createHelpViewer(qreal zoom)
|
||||
viewer->setScale(zoom);
|
||||
|
||||
// add find support
|
||||
Aggregation::Aggregate *agg = new Aggregation::Aggregate();
|
||||
auto agg = new Aggregation::Aggregate;
|
||||
agg->add(viewer);
|
||||
agg->add(new HelpViewerFindSupport(viewer));
|
||||
|
||||
@@ -760,10 +760,10 @@ class DialogClosingOnEscape : public QDialog
|
||||
{
|
||||
public:
|
||||
DialogClosingOnEscape(QWidget *parent = nullptr) : QDialog(parent) {}
|
||||
bool event(QEvent *event)
|
||||
bool event(QEvent *event) override
|
||||
{
|
||||
if (event->type() == QEvent::ShortcutOverride) {
|
||||
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
|
||||
auto ke = static_cast<QKeyEvent *>(event);
|
||||
if (ke->key() == Qt::Key_Escape && !ke->modifiers()) {
|
||||
ke->accept();
|
||||
return true;
|
||||
|
||||
@@ -78,8 +78,7 @@ static ExtensionMap extensionMap[] = {
|
||||
{".xhtml", "application/xhtml+xml"},
|
||||
{".wml", "text/vnd.wap.wml"},
|
||||
{".wmlc", "application/vnd.wap.wmlc"},
|
||||
{"about:blank", nullptr},
|
||||
{nullptr, nullptr}
|
||||
{"about:blank", nullptr}
|
||||
};
|
||||
|
||||
HelpViewer::HelpViewer(QWidget *parent)
|
||||
@@ -122,11 +121,9 @@ QString HelpViewer::mimeFromUrl(const QUrl &url)
|
||||
const int index = path.lastIndexOf(QLatin1Char('.'));
|
||||
const QByteArray &ext = path.mid(index).toUtf8().toLower();
|
||||
|
||||
const ExtensionMap *e = extensionMap;
|
||||
while (e->extension) {
|
||||
if (ext == e->extension)
|
||||
return QLatin1String(e->mimeType);
|
||||
++e;
|
||||
for (const auto &e : extensionMap) {
|
||||
if (ext == e.extension)
|
||||
return QLatin1String(e.mimeType);
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ protected:
|
||||
|
||||
void restoreOverrideCursor();
|
||||
|
||||
Actions m_visibleActions = 0;
|
||||
Actions m_visibleActions;
|
||||
int m_loadOverrideStack = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -98,19 +98,19 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget
|
||||
m_sideBarSplitter->setOpaqueResize(false);
|
||||
hLayout->addWidget(m_sideBarSplitter);
|
||||
|
||||
Utils::StyledBar *toolBar = new Utils::StyledBar();
|
||||
QHBoxLayout *layout = new QHBoxLayout(toolBar);
|
||||
auto toolBar = new Utils::StyledBar();
|
||||
auto layout = new QHBoxLayout(toolBar);
|
||||
layout->setSpacing(0);
|
||||
layout->setMargin(0);
|
||||
|
||||
auto rightSide = new QWidget(this);
|
||||
m_sideBarSplitter->insertWidget(1, rightSide);
|
||||
QVBoxLayout *vLayout = new QVBoxLayout(rightSide);
|
||||
auto vLayout = new QVBoxLayout(rightSide);
|
||||
vLayout->setMargin(0);
|
||||
vLayout->setSpacing(0);
|
||||
vLayout->addWidget(toolBar);
|
||||
vLayout->addWidget(m_viewerStack);
|
||||
Core::FindToolBarPlaceHolder *fth = new Core::FindToolBarPlaceHolder(this);
|
||||
auto fth = new Core::FindToolBarPlaceHolder(this);
|
||||
vLayout->addWidget(fth);
|
||||
|
||||
setFocusProxy(m_viewerStack);
|
||||
@@ -265,7 +265,7 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget
|
||||
openButton->setPopupMode(QToolButton::InstantPopup);
|
||||
openButton->setProperty("noArrow", true);
|
||||
layout->addWidget(openButton);
|
||||
QMenu *openMenu = new QMenu(openButton);
|
||||
auto openMenu = new QMenu(openButton);
|
||||
if (m_switchToHelp)
|
||||
openMenu->addAction(m_switchToHelp);
|
||||
if (style == ModeWidget) {
|
||||
@@ -382,7 +382,7 @@ void HelpWidget::addSideBar()
|
||||
: tr("Ctrl+Shift+/")));
|
||||
shortcutMap.insert(Constants::HELP_SEARCH, cmd);
|
||||
|
||||
Core::SideBarItem *openPagesItem = 0;
|
||||
Core::SideBarItem *openPagesItem = nullptr;
|
||||
if (m_style == ModeWidget) {
|
||||
QWidget *openPagesWidget = OpenPagesManager::instance().openPagesWidget();
|
||||
openPagesWidget->setWindowTitle(HelpPlugin::tr(Constants::SB_OPENPAGES));
|
||||
@@ -693,7 +693,7 @@ void HelpWidget::highlightSearchTerms()
|
||||
{
|
||||
if (m_searchTerms.isEmpty())
|
||||
return;
|
||||
HelpViewer *viewer = qobject_cast<HelpViewer *>(sender());
|
||||
auto viewer = qobject_cast<HelpViewer *>(sender());
|
||||
QTC_ASSERT(viewer, return);
|
||||
foreach (const QString& term, m_searchTerms)
|
||||
viewer->findText(term, nullptr, false, true);
|
||||
|
||||
@@ -46,7 +46,7 @@ class MacWebKitHelpWidget : public QMacCocoaViewContainer
|
||||
|
||||
public:
|
||||
MacWebKitHelpWidget(MacWebKitHelpViewer *parent);
|
||||
~MacWebKitHelpWidget();
|
||||
~MacWebKitHelpWidget() override;
|
||||
|
||||
WebView *webView() const;
|
||||
void startToolTipTimer(const QPoint &pos, const QString &text);
|
||||
@@ -54,8 +54,8 @@ public:
|
||||
MacWebKitHelpViewer *viewer() const;
|
||||
|
||||
protected:
|
||||
void hideEvent(QHideEvent *);
|
||||
void showEvent(QShowEvent *);
|
||||
void hideEvent(QHideEvent *) override;
|
||||
void showEvent(QShowEvent *) override;
|
||||
|
||||
private:
|
||||
void showToolTip();
|
||||
@@ -68,44 +68,44 @@ class MacWebKitHelpViewer : public HelpViewer
|
||||
|
||||
public:
|
||||
explicit MacWebKitHelpViewer(QWidget *parent = nullptr);
|
||||
~MacWebKitHelpViewer();
|
||||
~MacWebKitHelpViewer() override;
|
||||
|
||||
QFont viewerFont() const;
|
||||
void setViewerFont(const QFont &font);
|
||||
QFont viewerFont() const override;
|
||||
void setViewerFont(const QFont &font) override;
|
||||
|
||||
qreal scale() const;
|
||||
void setScale(qreal scale);
|
||||
qreal scale() const override;
|
||||
void setScale(qreal scale) override;
|
||||
|
||||
QString title() const;
|
||||
QString title() const override;
|
||||
|
||||
QUrl source() const;
|
||||
void setSource(const QUrl &url);
|
||||
QUrl source() const override;
|
||||
void setSource(const QUrl &url) override;
|
||||
void scrollToAnchor(const QString &anchor);
|
||||
void highlightId(const QString &id) { Q_UNUSED(id) }
|
||||
void highlightId(const QString &id) override { Q_UNUSED(id) }
|
||||
|
||||
void setHtml(const QString &html);
|
||||
void setHtml(const QString &html) override;
|
||||
|
||||
QString selectedText() const;
|
||||
bool isForwardAvailable() const;
|
||||
bool isBackwardAvailable() const;
|
||||
void addBackHistoryItems(QMenu *backMenu);
|
||||
void addForwardHistoryItems(QMenu *forwardMenu);
|
||||
QString selectedText() const override;
|
||||
bool isForwardAvailable() const override;
|
||||
bool isBackwardAvailable() const override;
|
||||
void addBackHistoryItems(QMenu *backMenu) override;
|
||||
void addForwardHistoryItems(QMenu *forwardMenu) override;
|
||||
void setActionVisible(bool visible);
|
||||
|
||||
bool findText(const QString &text, Core::FindFlags flags,
|
||||
bool incremental, bool fromSearch, bool *wrapped = nullptr);
|
||||
bool incremental, bool fromSearch, bool *wrapped = nullptr) override;
|
||||
|
||||
MacWebKitHelpWidget *widget() const { return m_widget; }
|
||||
|
||||
public:
|
||||
void scaleUp();
|
||||
void scaleDown();
|
||||
void resetScale();
|
||||
void copy();
|
||||
void stop();
|
||||
void forward();
|
||||
void backward();
|
||||
void print(QPrinter *printer);
|
||||
void scaleUp() override;
|
||||
void scaleDown() override;
|
||||
void resetScale() override;
|
||||
void copy() override;
|
||||
void stop() override;
|
||||
void forward() override;
|
||||
void backward() override;
|
||||
void print(QPrinter *printer) override;
|
||||
|
||||
void slotLoadStarted();
|
||||
void slotLoadFinished();
|
||||
|
||||
@@ -97,7 +97,7 @@ HelpViewer *OpenPagesModel::pageAt(int index) const
|
||||
|
||||
void OpenPagesModel::handleTitleChanged()
|
||||
{
|
||||
HelpViewer *page = static_cast<HelpViewer *>(sender());
|
||||
auto page = static_cast<HelpViewer *>(sender());
|
||||
const int row = m_pages.indexOf(page);
|
||||
Q_ASSERT(row != -1 );
|
||||
const QModelIndex &item = index(row, 0);
|
||||
|
||||
@@ -58,7 +58,7 @@ OpenPagesSwitcher::OpenPagesSwitcher(OpenPagesModel *model)
|
||||
m_openPagesWidget->allowContextMenu(false);
|
||||
m_openPagesWidget->installEventFilter(this);
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
auto layout = new QVBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->addWidget(m_openPagesWidget);
|
||||
|
||||
@@ -68,9 +68,7 @@ OpenPagesSwitcher::OpenPagesSwitcher(OpenPagesModel *model)
|
||||
this, &OpenPagesSwitcher::setCurrentPage);
|
||||
}
|
||||
|
||||
OpenPagesSwitcher::~OpenPagesSwitcher()
|
||||
{
|
||||
}
|
||||
OpenPagesSwitcher::~OpenPagesSwitcher() = default;
|
||||
|
||||
void OpenPagesSwitcher::gotoNextPage()
|
||||
{
|
||||
@@ -110,7 +108,7 @@ bool OpenPagesSwitcher::eventFilter(QObject *object, QEvent *event)
|
||||
{
|
||||
if (object == m_openPagesWidget) {
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *ke = static_cast<QKeyEvent*>(event);
|
||||
auto ke = static_cast<const QKeyEvent*>(event);
|
||||
if (ke->key() == Qt::Key_Escape) {
|
||||
setVisible(false);
|
||||
return true;
|
||||
@@ -129,7 +127,7 @@ bool OpenPagesSwitcher::eventFilter(QObject *object, QEvent *event)
|
||||
else if (key == Qt::Key_Tab && (ke->modifiers() == modifier))
|
||||
gotoPreviousPage();
|
||||
} else if (event->type() == QEvent::KeyRelease) {
|
||||
QKeyEvent *ke = static_cast<QKeyEvent*>(event);
|
||||
auto ke = static_cast<const QKeyEvent*>(event);
|
||||
if (ke->modifiers() == 0
|
||||
/*HACK this is to overcome some event inconsistencies between platforms*/
|
||||
|| (ke->modifiers() == Qt::AltModifier
|
||||
|
||||
@@ -59,9 +59,7 @@ OpenPagesWidget::OpenPagesWidget(OpenPagesModel *sourceModel, QWidget *parent)
|
||||
this, &OpenPagesWidget::updateCloseButtonVisibility);
|
||||
}
|
||||
|
||||
OpenPagesWidget::~OpenPagesWidget()
|
||||
{
|
||||
}
|
||||
OpenPagesWidget::~OpenPagesWidget() = default;
|
||||
|
||||
void OpenPagesWidget::selectCurrentPage()
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ RemoteFilterOptions::RemoteFilterOptions(RemoteHelpFilter *filter, QWidget *pare
|
||||
|
||||
const QStringList remoteUrls = m_filter->remoteUrls();
|
||||
for (const QString &url : remoteUrls) {
|
||||
QListWidgetItem *item = new QListWidgetItem(url);
|
||||
auto item = new QListWidgetItem(url);
|
||||
m_ui.listWidget->addItem(item);
|
||||
item->setFlags(item->flags() | Qt::ItemIsEditable);
|
||||
}
|
||||
@@ -127,9 +127,7 @@ RemoteHelpFilter::RemoteHelpFilter()
|
||||
m_remoteUrls.append("https://en.wikipedia.org/w/index.php?search=%1");
|
||||
}
|
||||
|
||||
RemoteHelpFilter::~RemoteHelpFilter()
|
||||
{
|
||||
}
|
||||
RemoteHelpFilter::~RemoteHelpFilter() = default;
|
||||
|
||||
QList<Core::LocatorFilterEntry> RemoteHelpFilter::matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future, const QString &entry)
|
||||
{
|
||||
|
||||
@@ -55,17 +55,13 @@
|
||||
|
||||
using namespace Help::Internal;
|
||||
|
||||
SearchWidget::SearchWidget()
|
||||
{
|
||||
}
|
||||
SearchWidget::SearchWidget() = default;
|
||||
|
||||
SearchWidget::~SearchWidget()
|
||||
{
|
||||
}
|
||||
SearchWidget::~SearchWidget() = default;
|
||||
|
||||
void SearchWidget::zoomIn()
|
||||
{
|
||||
QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>();
|
||||
auto browser = resultWidget->findChild<QTextBrowser*>();
|
||||
if (browser && zoomCount != 10) {
|
||||
zoomCount++;
|
||||
browser->zoomIn();
|
||||
@@ -74,7 +70,7 @@ void SearchWidget::zoomIn()
|
||||
|
||||
void SearchWidget::zoomOut()
|
||||
{
|
||||
QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>();
|
||||
auto browser = resultWidget->findChild<QTextBrowser*>();
|
||||
if (browser && zoomCount != -5) {
|
||||
zoomCount--;
|
||||
browser->zoomOut();
|
||||
@@ -86,7 +82,7 @@ void SearchWidget::resetZoom()
|
||||
if (zoomCount == 0)
|
||||
return;
|
||||
|
||||
QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>();
|
||||
auto browser = resultWidget->findChild<QTextBrowser*>();
|
||||
if (browser) {
|
||||
browser->zoomOut(zoomCount);
|
||||
zoomCount = 0;
|
||||
@@ -102,13 +98,13 @@ void SearchWidget::reindexDocumentation()
|
||||
void SearchWidget::showEvent(QShowEvent *event)
|
||||
{
|
||||
if (!event->spontaneous() && !searchEngine) {
|
||||
QVBoxLayout *vLayout = new QVBoxLayout(this);
|
||||
auto vLayout = new QVBoxLayout(this);
|
||||
vLayout->setMargin(0);
|
||||
vLayout->setSpacing(0);
|
||||
|
||||
searchEngine = new QHelpSearchEngine(&LocalHelpManager::helpEngine(), this);
|
||||
|
||||
Utils::StyledBar *toolbar = new Utils::StyledBar(this);
|
||||
auto toolbar = new Utils::StyledBar(this);
|
||||
toolbar->setSingleRow(false);
|
||||
m_queryWidget = searchEngine->queryWidget();
|
||||
QLayout *tbLayout = new QVBoxLayout();
|
||||
@@ -120,7 +116,7 @@ void SearchWidget::showEvent(QShowEvent *event)
|
||||
tbLayout->addWidget(m_indexingDocumentationLabel);
|
||||
toolbar->setLayout(tbLayout);
|
||||
|
||||
Utils::StyledBar *toolbar2 = new Utils::StyledBar(this);
|
||||
auto toolbar2 = new Utils::StyledBar(this);
|
||||
toolbar2->setSingleRow(false);
|
||||
tbLayout = new QVBoxLayout();
|
||||
tbLayout->setSpacing(0);
|
||||
@@ -149,7 +145,7 @@ void SearchWidget::showEvent(QShowEvent *event)
|
||||
connect(searchEngine, &QHelpSearchEngine::searchingFinished, this,
|
||||
&SearchWidget::searchingFinished);
|
||||
|
||||
QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>();
|
||||
auto browser = resultWidget->findChild<const QTextBrowser*>();
|
||||
browser->viewport()->installEventFilter(this);
|
||||
|
||||
connect(searchEngine, &QHelpSearchEngine::indexingStarted, this,
|
||||
@@ -210,10 +206,10 @@ void SearchWidget::indexingFinished()
|
||||
|
||||
bool SearchWidget::eventFilter(QObject *o, QEvent *e)
|
||||
{
|
||||
QTextBrowser *browser = resultWidget->findChild<QTextBrowser *>();
|
||||
auto browser = resultWidget->findChild<const QTextBrowser *>();
|
||||
if (browser && o == browser->viewport()
|
||||
&& e->type() == QEvent::MouseButtonRelease){
|
||||
QMouseEvent *me = static_cast<QMouseEvent *>(e);
|
||||
auto me = static_cast<const QMouseEvent *>(e);
|
||||
QUrl link = resultWidget->linkAt(me->pos());
|
||||
if (!link.isEmpty() || link.isValid()) {
|
||||
bool controlPressed = me->modifiers() & Qt::ControlModifier;
|
||||
@@ -228,7 +224,7 @@ bool SearchWidget::eventFilter(QObject *o, QEvent *e)
|
||||
|
||||
void SearchWidget::contextMenuEvent(QContextMenuEvent *contextMenuEvent)
|
||||
{
|
||||
QTextBrowser *browser = resultWidget->findChild<QTextBrowser *>();
|
||||
auto browser = resultWidget->findChild<QTextBrowser *>();
|
||||
if (!browser)
|
||||
return;
|
||||
|
||||
@@ -280,7 +276,7 @@ SearchSideBarItem::SearchSideBarItem()
|
||||
|
||||
QList<QToolButton *> SearchSideBarItem::createToolBarWidgets()
|
||||
{
|
||||
QToolButton *reindexButton = new QToolButton;
|
||||
auto reindexButton = new QToolButton;
|
||||
reindexButton->setIcon(Utils::Icons::RELOAD.icon());
|
||||
reindexButton->setToolTip(tr("Regenerate Index"));
|
||||
connect(reindexButton, &QAbstractButton::clicked,
|
||||
|
||||
@@ -52,7 +52,7 @@ TextBrowserHelpViewer::TextBrowserHelpViewer(QWidget *parent)
|
||||
, m_textBrowser(new TextBrowserHelpWidget(this))
|
||||
{
|
||||
m_textBrowser->setOpenLinks(false);
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
auto layout = new QVBoxLayout;
|
||||
setLayout(layout);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addWidget(m_textBrowser, 10);
|
||||
@@ -73,9 +73,7 @@ TextBrowserHelpViewer::TextBrowserHelpViewer(QWidget *parent)
|
||||
connect(m_textBrowser, &QTextBrowser::backwardAvailable, this, &HelpViewer::backwardAvailable);
|
||||
}
|
||||
|
||||
TextBrowserHelpViewer::~TextBrowserHelpViewer()
|
||||
{
|
||||
}
|
||||
TextBrowserHelpViewer::~TextBrowserHelpViewer() = default;
|
||||
|
||||
QFont TextBrowserHelpViewer::viewerFont() const
|
||||
{
|
||||
@@ -179,7 +177,7 @@ bool TextBrowserHelpViewer::isBackwardAvailable() const
|
||||
void TextBrowserHelpViewer::addBackHistoryItems(QMenu *backMenu)
|
||||
{
|
||||
for (int i = 1; i <= m_textBrowser->backwardHistoryCount(); ++i) {
|
||||
QAction *action = new QAction(backMenu);
|
||||
auto action = new QAction(backMenu);
|
||||
action->setText(m_textBrowser->historyTitle(-i));
|
||||
action->setData(-i);
|
||||
connect(action, &QAction::triggered, this, &TextBrowserHelpViewer::goToHistoryItem);
|
||||
@@ -190,7 +188,7 @@ void TextBrowserHelpViewer::addBackHistoryItems(QMenu *backMenu)
|
||||
void TextBrowserHelpViewer::addForwardHistoryItems(QMenu *forwardMenu)
|
||||
{
|
||||
for (int i = 1; i <= m_textBrowser->forwardHistoryCount(); ++i) {
|
||||
QAction *action = new QAction(forwardMenu);
|
||||
auto action = new QAction(forwardMenu);
|
||||
action->setText(m_textBrowser->historyTitle(i));
|
||||
action->setData(i);
|
||||
connect(action, &QAction::triggered, this, &TextBrowserHelpViewer::goToHistoryItem);
|
||||
@@ -281,7 +279,7 @@ void TextBrowserHelpViewer::print(QPrinter *printer)
|
||||
|
||||
void TextBrowserHelpViewer::goToHistoryItem()
|
||||
{
|
||||
QAction *action = qobject_cast<QAction *>(sender());
|
||||
auto action = qobject_cast<const QAction *>(sender());
|
||||
QTC_ASSERT(action, return);
|
||||
bool ok = false;
|
||||
int index = action->data().toInt(&ok);
|
||||
@@ -393,14 +391,14 @@ bool TextBrowserHelpWidget::eventFilter(QObject *obj, QEvent *event)
|
||||
if (!forceFont)
|
||||
return true;
|
||||
} else if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
||||
auto keyEvent = static_cast<QKeyEvent *>(event);
|
||||
if (keyEvent->key() == Qt::Key_Slash) {
|
||||
keyEvent->accept();
|
||||
Core::Find::openFindToolBar(Core::Find::FindForwardDirection);
|
||||
return true;
|
||||
}
|
||||
} else if (event->type() == QEvent::ToolTip) {
|
||||
QHelpEvent *e = static_cast<QHelpEvent *>(event);
|
||||
auto e = static_cast<const QHelpEvent *>(event);
|
||||
QToolTip::showText(e->globalPos(), linkAt(e->pos()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ void XbelReader::readBookmark(QStandardItem *item)
|
||||
|
||||
QStandardItem *XbelReader::createChildItem(QStandardItem *item)
|
||||
{
|
||||
QStandardItem *childItem = new QStandardItem();
|
||||
auto childItem = new QStandardItem;
|
||||
childItem->setEditable(false);
|
||||
|
||||
if (item)
|
||||
|
||||
Reference in New Issue
Block a user