Files
qt-creator/src/plugins/help/litehtmlhelpviewer.h
Eike Ziller 04e50438eb Utils: Remove Utils::optional
Since we are now requiring macOS 10.14 we can remove our local
implementation of optional and use std::optional for macOS too.

Change-Id: I2bd018261b68da64f7f031a812045dd7784697e1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2022-09-01 06:58:04 +00:00

75 lines
1.9 KiB
C++

// Copyright (C) 2019 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once
#include "helpviewer.h"
#include "openpagesmanager.h"
#include <qlitehtmlwidget.h>
#include <QTextBrowser>
#include <optional>
namespace Help {
namespace Internal {
class LiteHtmlHelpViewer : public HelpViewer
{
Q_OBJECT
public:
explicit LiteHtmlHelpViewer(QWidget *parent = nullptr);
~LiteHtmlHelpViewer() override;
void setViewerFont(const QFont &font) override;
void setScale(qreal scale) override;
QString title() const override;
QUrl source() const override;
void setSource(const QUrl &url) override;
void setHtml(const QString &html) override;
QString selectedText() const override;
bool isForwardAvailable() const override;
bool isBackwardAvailable() const override;
void addBackHistoryItems(QMenu *backMenu) override;
void addForwardHistoryItems(QMenu *forwardMenu) override;
bool findText(const QString &text, Core::FindFlags flags,
bool incremental, bool fromSearch, bool *wrapped = nullptr) override;
void copy() override;
void stop() override;
void forward() override;
void backward() override;
void print(QPrinter *printer) override;
bool eventFilter(QObject *src, QEvent *e) override;
private:
void goForward(int count);
void goBackward(int count);
void setSourceInternal(const QUrl &url, std::optional<int> vscroll = std::nullopt);
void showContextMenu(const QPoint &pos, const QUrl &url);
struct HistoryItem
{
QUrl url;
QString title;
int vscroll;
};
HistoryItem currentHistoryItem() const;
QLiteHtmlWidget *m_viewer;
std::vector<HistoryItem> m_backItems;
std::vector<HistoryItem> m_forwardItems;
};
} // namespace Internal
} // namespace Help