KTextEditor

katetextpreview.h
1/*
2 SPDX-FileCopyrightText: 2016 Dominik Haumann <dhaumann@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KATE_TEXT_PREVIEW_H
8#define KATE_TEXT_PREVIEW_H
9
10#include <QFrame>
11
12// namespace KTextEditor { class DocumentPrivate; }
13namespace KTextEditor
14{
15class ViewPrivate;
16}
17
18/**
19 * TODO
20 */
21class KateTextPreview : public QFrame
22{
24 Q_PROPERTY(qreal line READ line WRITE setLine)
25 Q_PROPERTY(bool showFoldedLines READ showFoldedLines WRITE setShowFoldedLines)
26 Q_PROPERTY(bool centerView READ centerView WRITE setCenterView)
27 Q_PROPERTY(qreal scaleFactor READ scaleFactor WRITE setScaleFactor)
28
29public:
30 KateTextPreview(KTextEditor::ViewPrivate *view, QWidget *parent);
31
32 KTextEditor::ViewPrivate *view() const;
33
34 /**
35 * Sets @p line as preview line.
36 */
37 void setLine(qreal line);
38
39 /**
40 * Returns the line set with setLine().
41 */
42 qreal line() const;
43
44 /**
45 * Enabled/disable centering the view on the line set with setLine().
46 * If @p center is false, the first visible line is the once specified in
47 * setLine(). If @p center is true, the specified line is vertically
48 * centered. By default, centering the preview is set to true.
49 */
50 void setCenterView(bool center);
51
52 /**
53 * Returns whether view centering is enabled.
54 */
55 bool centerView() const;
56
57 /**
58 * Sets the scale factor.
59 * The default scale factor is 1.0.
60 * For text previews, you may want a scale factor of e.g. 0.75.
61 * Negative scale factors are not allowed.
62 */
63 void setScaleFactor(qreal factor);
64
65 /**
66 * Returns the scale factor set with setScale().
67 * The default value is 1.0.
68 */
69 qreal scaleFactor() const;
70
71 /**
72 * Sets whether folded lines are hidden or not.
73 * By default, folded liens are not visible.
74 */
75 void setShowFoldedLines(bool on);
76
77 /**
78 * Returns whether folded lines are hidden.
79 */
80 bool showFoldedLines() const;
81
82protected:
83 void paintEvent(QPaintEvent *event) override;
84
85private:
86 KTextEditor::ViewPrivate *m_view;
87 qreal m_line;
88 bool m_showFoldedLines;
89 bool m_center;
90 qreal m_scale;
91};
92
93#endif
void setShowFoldedLines(bool on)
Sets whether folded lines are hidden or not.
void setLine(qreal line)
Sets line as preview line.
void setCenterView(bool center)
Enabled/disable centering the view on the line set with setLine().
void setScaleFactor(qreal factor)
Sets the scale factor.
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
virtual bool event(QEvent *e) override
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:56 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.