-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsynchelper.h
More file actions
36 lines (29 loc) · 999 Bytes
/
synchelper.h
File metadata and controls
36 lines (29 loc) · 999 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/////////////////////////////////////////////////////////////////////////////
// Name: synchelper.h
// Purpose: Keep MD viewer in sync with MD editor (header)
// Author: Jan Buchholz
// Created: 2025-11-26
// Changed: 2026-04-09
/////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QObject>
#include <QTextEdit>
#include <QTextBrowser>
#include "imagehandler.h"
class SyncHelper : public QObject {
Q_OBJECT
public:
SyncHelper(QTextEdit* editor, QTextBrowser* viewer);
~SyncHelper();
void syncToViewer();
void setDocumentPath(QString path) { m_documentPath = path; }
void invalidateImageCache() { mc_handler->invalidateCache(); }
void refreshDocument();
private:
QTextEdit* m_editor;
QTextBrowser* m_viewer;
ImageHandler* mc_handler;
QString m_documentPath;
void processImages();
const QString c_highlighting = "<span style=\"background-color:#FAE098\">\\1</span>";
};