KPimTextEdit

textutils.h
1/*
2 This file is part of KDE.
3
4 SPDX-FileCopyrightText: 2009 Thomas McGuire <mcguire@kde.org>
5 SPDX-FileCopyrightText: 2010 Stephen Kelly <steveire@gmail.com>
6
7 SPDX-License-Identifier: LGPL-2.0-or-later
8*/
9
10#pragma once
11
12#include "kpimtextedit_export.h"
13#include <qglobal.h>
14class QTextDocument;
15
16namespace KPIMTextEdit
17{
18/**
19 Utility class for methods working with rich text.
20
21 @since 4.5
22*/
23namespace TextUtils
24{
25/**
26 * Returns whether the QTextDocument @p document contains rich text formatting.
27 */
28[[nodiscard]] KPIMTEXTEDIT_EXPORT bool containsFormatting(const QTextDocument *document);
29
30/**
31 * Changes the given text so that each line of it fits into the given maximal length.
32 * At each line, the "indent" string is prepended, which is usually the quote prefix.
33 * The text parameter will be empty afterwards.
34 * @param text the text to indent
35 * @param indent the indentation prefix string
36 * @param maxLength the maximal length the string of text will fit into
37 * Example:
38 * text = "Hello World, this is a test."
39 * indent = "> "
40 * maxLength = 16
41 * Result: "> Hello World,\n"
42 * "> this is a test."
43 */
44[[nodiscard]] KPIMTEXTEDIT_EXPORT QString flowText(QString &text, const QString &indent, int maxLength);
45}
46}
KPIMTEXTEDIT_EXPORT bool containsFormatting(const QTextDocument *document)
Returns whether the QTextDocument document contains rich text formatting.
Definition textutils.cpp:47
KPIMTEXTEDIT_EXPORT QString flowText(QString &text, const QString &indent, int maxLength)
Changes the given text so that each line of it fits into the given maximal length.
Definition textutils.cpp:92
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:20:45 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.