File indexing completed on 2023-09-24 09:54:56
0001 /* 0002 SPDX-FileCopyrightText: 2020 Friedrich W. H. Kossebau <kossebau@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.1-or-later 0005 */ 0006 0007 #ifndef MARKDOWNBROWSER_HPP 0008 #define MARKDOWNBROWSER_HPP 0009 0010 // Qt 0011 #include <QTextBrowser> 0012 0013 0014 class MarkdownView : public QTextBrowser 0015 { 0016 Q_OBJECT 0017 0018 public: 0019 MarkdownView(QTextDocument* document, QWidget* parent); 0020 0021 public: 0022 bool hasSelection() const; 0023 0024 void setScrollPosition(QPoint offset); 0025 QPoint scrollPosition() const; 0026 int scrollPositionX() const; 0027 int scrollPositionY() const; 0028 0029 Q_SIGNALS: 0030 void contextMenuRequested(QPoint globalPos, const QUrl& linkUrl, 0031 bool hasSelection); 0032 0033 protected: 0034 void contextMenuEvent(QContextMenuEvent* event) override; 0035 }; 0036 0037 #endif