GXDE Bernese
Loading...
Searching...
No Matches
text_layout_utils.h
1/*
2 * Copyright (C) 2026 CharOfString <root@charofstring.cc>
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation, either version 3 of the License, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program. If not, see <https://www.gnu.org/licenses/>.
16 * ----------------------------------------------------------------------------
17 * Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd.
18 * 2016 ~ 2018 dragondjf
19 * 2026 CharOfString
20 *
21 * Author: dragondjf <dingjiangfeng@deepin.com>
22 * CharOfString <root@charofstring.cc>
23 *
24 * Maintainer: CharOfString <root@charofstring.cc>
25 * dragondjf<dingjiangfeng@deepin.com>
26 * zccrs<zhangjide@deepin.com>
27 * Tangtong<tangtong@deepin.com>
28 * ----------------------------------------------------------------------------
29 * This class was adapted & modified from Deepin DDE.
30 */
31
32#ifndef TEXT_LAYOUT_UTILS_TEXT_LAYOUT_UTILS_H_
33#define TEXT_LAYOUT_UTILS_TEXT_LAYOUT_UTILS_H_
34
35#include <QBrush>
36#include <QColor>
37#include <QList>
38#include <QPainter>
39#include <QPointF>
40#include <QRectF>
41#include <QSizeF>
42#include <QStringList>
43#include <QTextDocument>
44#include <QTextLayout>
45#include <QTextOption>
46#include <QtGlobal>
47
48#include "bernese/export.h"
49
50namespace bernese {
51namespace text_layout_utils {
52
78BERNESE_EXPORT void DrawElidedText(QTextLayout* layout, const QSizeF& size,
79 QTextOption::WrapMode word_wrap, Qt::TextElideMode mode, qreal line_height,
80 int flags, QStringList* lines, QPainter* painter, QPointF offset,
81 const QColor& shadow_color, const QPointF& shadow_offset,
82 const QBrush& background, qreal background_radius,
83 QList<QRectF>* bounding_region, QTextDocument* document = nullptr);
84
85} // namespace text_layout_utils
86} // namespace bernese
87
88#endif // TEXT_LAYOUT_UTILS_TEXT_LAYOUT_UTILS_H_