-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscrollsynchronizer.h
More file actions
36 lines (27 loc) · 939 Bytes
/
Copy pathscrollsynchronizer.h
File metadata and controls
36 lines (27 loc) · 939 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
36
/////////////////////////////////////////////////////////////////////////////
// Name: scrollsynchronizer.h
// Purpose: Synchronize scrolling of MD editor with MD viewer (header)
// Author: Jan Buchholz
// Created: 2025-11-20
// Changed: 2026-05-22
/////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QObject>
#include <QSplitter>
#include <QTextEdit>
#include <QMainWindow>
class ScrollSynchronizer : public QObject {
Q_OBJECT
public:
explicit ScrollSynchronizer(QTextEdit* a, QTextEdit* b, QSplitter* splitter, QMainWindow* parent);
void setEnabled(bool enabled);
private:
QTextEdit* m_editA;
QTextEdit* m_editB;
QSplitter* m_splitter;
bool m_syncing;
bool m_enabled;
void sync(QTextEdit* source, QTextEdit* target);
private slots:
void syncBtoA() { sync(m_editB, m_editA); }
};