KTextAddons

grammarerror.h
1/*
2 SPDX-FileCopyrightText: 2019-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "textgrammarcheck_export.h"
10#include <QColor>
11#include <QDebug>
12#include <QJsonObject>
13#include <QString>
14namespace TextGrammarCheck
15{
16class TEXTGRAMMARCHECK_EXPORT GrammarError
17{
18public:
19 GrammarError();
20 virtual ~GrammarError();
21 [[nodiscard]] QColor color() const;
22 void setColor(const QColor &color);
23
24 [[nodiscard]] QString error() const;
25 void setError(const QString &error);
26
27 [[nodiscard]] int blockId() const;
28 void setBlockId(int blockId);
29
30 [[nodiscard]] int start() const;
31 void setStart(int start);
32
33 [[nodiscard]] int length() const;
34 void setLength(int length);
35
36 [[nodiscard]] QStringList suggestions() const;
37 void setSuggestions(const QStringList &suggestions);
38
39 [[nodiscard]] bool isValid() const;
40
41 virtual void parse(const QJsonObject &obj, int blockindex);
42
43 [[nodiscard]] bool operator==(const GrammarError &other) const;
44
45 [[nodiscard]] QString option() const;
46 void setOption(const QString &option);
47
48 [[nodiscard]] QString rule() const;
49 void setRule(const QString &rule);
50
51 [[nodiscard]] QString url() const;
52 void setUrl(const QString &url);
53
54protected:
55 QStringList mSuggestions;
56 QString mError;
57 QString mOption;
58 QString mRule;
59 QString mUrl;
60 QColor mColor;
61 int mBlockId = -1;
62 int mStart = -1;
63 int mLength = -1;
64};
65}
66Q_DECLARE_METATYPE(TextGrammarCheck::GrammarError)
67Q_DECLARE_TYPEINFO(TextGrammarCheck::GrammarError, Q_MOVABLE_TYPE);
68TEXTGRAMMARCHECK_EXPORT QDebug operator<<(QDebug d, const TextGrammarCheck::GrammarError &t);
Q_SCRIPTABLE Q_NOREPLY void start()
KHEALTHCERTIFICATE_EXPORT QVariant parse(const QByteArray &data)
void error(QWidget *parent, const QString &text, const QString &title, const KGuiItem &buttonOk, Options options=Notify)
bool isValid(QStringView ifopt)
bool operator==(const StyleDelim &l, const StyleDelim &r)
QDebug operator<<(QDebug dbg, const PerceptualColor::MultiSpinBoxSection &value)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:19:49 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.