Commit a63d6b2c authored by Laurent Montel's avatar Laurent Montel 😁

Use document

parent 7720d47e
......@@ -9,5 +9,5 @@ macro(add_kmail_converttext_unittest _source _additional)
endmacro ()
add_kmail_converttext_unittest(markdowninterfacetest.cpp "../markdowninterface.cpp")
add_kmail_converttext_unittest(markdownpreviewwidgettest.cpp "../markdownpreviewwidget.cpp")
add_kmail_converttext_unittest(markdownplugintest.cpp "../markdownplugin.cpp;../markdowninterface.cpp")
add_kmail_converttext_unittest(markdownpreviewwidgettest.cpp "../markdownpreviewwidget.cpp;../markdowndocument.cpp")
add_kmail_converttext_unittest(markdownplugintest.cpp "../markdownplugin.cpp;../markdowninterface.cpp;../markdowndocument.cpp")
......@@ -18,12 +18,15 @@
*/
#include "markdownpreviewwidget.h"
#include "markdowndocument.h"
#include <QHBoxLayout>
#include <QWebChannel>
#include <QWebEngineView>
MarkdownPreviewWidget::MarkdownPreviewWidget(QWidget *parent)
: QWidget(parent)
{
mDocument = new MarkdownDocument(this);
QHBoxLayout *mainLayout = new QHBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainLayout"));
......@@ -33,6 +36,11 @@ MarkdownPreviewWidget::MarkdownPreviewWidget(QWidget *parent)
mWebView->setObjectName(QStringLiteral("webengine"));
mainLayout->addWidget(mWebView);
mWebView->setContextMenuPolicy(Qt::NoContextMenu);
QWebChannel *channel = new QWebChannel(this);
channel->registerObject(QStringLiteral("content"), mDocument);
mWebView->page()->setWebChannel(channel);
}
MarkdownPreviewWidget::~MarkdownPreviewWidget()
......
......@@ -22,6 +22,7 @@
#include <QWidget>
class QWebEngineView;
class MarkdownDocument;
class MarkdownPreviewWidget : public QWidget
{
Q_OBJECT
......@@ -29,6 +30,7 @@ public:
explicit MarkdownPreviewWidget(QWidget *parent = nullptr);
~MarkdownPreviewWidget();
private:
MarkdownDocument *mDocument = nullptr;
QWebEngineView *mWebView = nullptr;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment