4#ifndef HELPVIEWERIMPL_H
5#define HELPVIEWERIMPL_H
7#include <QtCore/qglobal.h>
9#include <QtCore/QVariant>
13#if defined(BROWSER_QTWEBKIT)
15#elif defined(BROWSER_QTEXTBROWSER)
16# include <QtWidgets/QTextBrowser>
23#if defined(BROWSER_QTWEBKIT)
24#define TEXTBROWSER_OVERRIDE
25class HelpViewerImpl :
public QWebView
26#elif defined(BROWSER_QTEXTBROWSER)
27#define TEXTBROWSER_OVERRIDE override
28class HelpViewerImpl :
public QTextBrowser
32 class HelpViewerImplPrivate;
35 HelpViewerImpl(qreal zoom, QWidget *parent =
nullptr);
36 ~HelpViewerImpl() override;
38 QFont viewerFont()
const;
39 void setViewerFont(
const QFont &font);
47 QString title()
const;
50 void doSetSource(
const QUrl &url, QTextDocument::ResourceType type) TEXTBROWSER_OVERRIDE;
52 QString selectedText()
const;
53 bool isForwardAvailable()
const;
54 bool isBackwardAvailable()
const;
56 bool findText(
const QString &text, HelpViewer::FindFlags flags,
bool incremental,
59 static const QString AboutBlank;
60 static const QString LocalHelpFile;
61 static const QString PageNotFoundMessage;
64#if QT_CONFIG(clipboard)
67 void home() TEXTBROWSER_OVERRIDE;
69 void forward() TEXTBROWSER_OVERRIDE;
70 void backward() TEXTBROWSER_OVERRIDE;
74#if !defined(BROWSER_QTEXTBROWSER)
76 void copyAvailable(
bool yes);
77 void sourceChanged(
const QUrl &url);
78 void forwardAvailable(
bool enabled);
79 void backwardAvailable(
bool enabled);
80 void highlighted(
const QUrl &link);
81 void printRequested();
82#elif !defined(BROWSER_QTWEBKIT)
84 void loadFinished(
bool finished);
88 void keyPressEvent(QKeyEvent *e) override;
89 void wheelEvent(QWheelEvent *event) override;
90 void mousePressEvent(QMouseEvent *event) override;
91 void mouseReleaseEvent(QMouseEvent *event) override;
92 void resizeEvent(QResizeEvent *e) override;
96 void setLoadFinished();
99 bool eventFilter(QObject *obj, QEvent *event) override;
100 void contextMenuEvent(QContextMenuEvent *event) override;
101 QVariant loadResource(
int type,
const QUrl &name) TEXTBROWSER_OVERRIDE;
102 bool handleForwardBackwardMouseButtons(QMouseEvent *e);
103 void scrollToTextPosition(
int position);
106 HelpViewerImplPrivate *d;
static HelpEngineWrapper & instance()
HistoryItem currentHistoryItem() const
std::vector< HistoryItem > m_backItems
std::vector< HistoryItem > m_forwardItems
void applyZoom(int percentage)
QLiteHtmlWidget * m_viewer
void incrementZoom(int steps)
void setSourceInternal(const QUrl &url, int *vscroll=nullptr, bool reload=false)
void setViewerFont(const QFont &font)
void setSource(const QUrl &url)
QString selectedText() const
bool isForwardAvailable() const
bool findText(const QString &text, FindFlags flags, bool incremental, bool fromSearch)
bool isBackwardAvailable() const
bool eventFilter(QObject *src, QEvent *event) override
Filters events if this object has been installed as an event filter for the watched object.
static QByteArray getData(const QUrl &url)
static QTextDocument::FindFlags textDocumentFlagsForFindFlags(HelpViewer::FindFlags flags)
const int kMaxHistoryItems
Combined button and popup list for selecting options.