File: QStyleSyntaxHighlighter.hpp

package info (click to toggle)
qcodeeditor 1.0%2B1gitdc644d-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 528 kB
  • sloc: cpp: 2,502; xml: 731; python: 11; makefile: 9
file content (41 lines) | stat: -rw-r--r-- 942 bytes parent folder | download | duplicates (2)
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
#pragma once

// Qt
#include <QSyntaxHighlighter> // Required for inheritance

class QSyntaxStyle;

/**
 * @brief Class, that descrubes highlighter with
 * syntax style.
 */
class QStyleSyntaxHighlighter : public QSyntaxHighlighter
{
public:

    /**
     * @brief Constructor.
     * @param document Pointer to text document.
     */
    explicit QStyleSyntaxHighlighter(QTextDocument* document=nullptr);

    // Disable copying
    QStyleSyntaxHighlighter(const QStyleSyntaxHighlighter&) = delete;
    QStyleSyntaxHighlighter& operator=(const QStyleSyntaxHighlighter&) = delete;

    /**
     * @brief Method for setting syntax style.
     * @param style Pointer to syntax style.
     */
    void setSyntaxStyle(QSyntaxStyle* style);

    /**
     * @brief Method for getting syntax style.
     * @return Pointer to syntax style. May be nullptr.
     */
    QSyntaxStyle* syntaxStyle() const;

private:
    QSyntaxStyle* m_syntaxStyle;
};