1 /*
2     SPDX-FileCopyrightText: 2020 Friedrich W. H. Kossebau <kossebau@kde.org>
3 
4     SPDX-License-Identifier: LGPL-2.1-or-later
5 */
6 
7 #ifndef MARKDOWNBROWSER_HPP
8 #define MARKDOWNBROWSER_HPP
9 
10 // Qt
11 #include <QTextBrowser>
12 
13 
14 class MarkdownView : public QTextBrowser
15 {
16     Q_OBJECT
17 
18 public:
19     MarkdownView(QTextDocument* document, QWidget* parent);
20 
21 public:
22     bool hasSelection() const;
23 
24     void setScrollPosition(QPoint offset);
25     QPoint scrollPosition() const;
26     int scrollPositionX() const;
27     int scrollPositionY() const;
28 
29 Q_SIGNALS:
30     void contextMenuRequested(QPoint globalPos, const QUrl& linkUrl,
31                               bool hasSelection);
32 
33 protected:
34     void contextMenuEvent(QContextMenuEvent* event) override;
35 };
36 
37 #endif
38