blob: f5c9f57d43adc8d268c049b987cb05b48dc0e53b (
plain)
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
37
38
39
40
41
42
43
|
/*
* Copyright 2010, Robert Bieber
* Licensed under the LGPLv2.1, see the COPYING file for more information
*/
#ifndef VARIANTEDITOR_H
#define VARIANTEDITOR_H
#include <QTextDocument>
class QTextEdit;
class QPlainTextEdit;
class QPushButton;
class QTextCursor;
/**
* A simple class that transparently wraps a pointer to either
* a QPlainTextEdit or a QTextEdit, providing access to functions common
* to each of them
*/
class VariantEditor
{
public:
VariantEditor(QTextEdit* textEdit);
VariantEditor(QPlainTextEdit* textEdit);
void connectToSetEnabled(QPushButton* button);
QTextDocument* document();
void setTextCursor(const QTextCursor& cursor);
bool find(const QString& exp, QTextDocument::FindFlags flags);
QTextCursor textCursor() const;
private:
QPlainTextEdit* plainTextEdit;
QTextEdit* textEdit;
enum{ Plain, Rich} type;
};
#endif // VARIANTEDITOR_H
|