Coverage Report

Created: 2026-02-08 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/qt/qtbase/src/gui/text/qtexttable.h
Line
Count
Source
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
#ifndef QTEXTTABLE_H
5
#define QTEXTTABLE_H
6
7
#include <QtGui/qtguiglobal.h>
8
#include <QtCore/qobject.h>
9
#include <QtGui/qtextobject.h>
10
11
QT_BEGIN_NAMESPACE
12
13
14
class QTextCursor;
15
class QTextTable;
16
class QTextTablePrivate;
17
18
class Q_GUI_EXPORT QTextTableCell
19
{
20
public:
21
7.82M
    QTextTableCell() : table(nullptr) {}
22
45.6M
    ~QTextTableCell() {}
23
0
    QTextTableCell(const QTextTableCell &o) : table(o.table), fragment(o.fragment) {}
24
    QTextTableCell &operator=(const QTextTableCell &o)
25
0
    { table = o.table; fragment = o.fragment; return *this; }
26
27
    void setFormat(const QTextCharFormat &format);
28
    QTextCharFormat format() const;
29
30
    int row() const;
31
    int column() const;
32
33
    int rowSpan() const;
34
    int columnSpan() const;
35
36
9.51M
    inline bool isValid() const { return table != nullptr; }
37
38
    QTextCursor firstCursorPosition() const;
39
    QTextCursor lastCursorPosition() const;
40
    int firstPosition() const;
41
    int lastPosition() const;
42
43
    inline bool operator==(const QTextTableCell &other) const
44
13.8M
    { return table == other.table && fragment == other.fragment; }
45
    inline bool operator!=(const QTextTableCell &other) const
46
0
    { return !operator==(other); }
47
48
    QTextFrame::iterator begin() const;
49
    QTextFrame::iterator end() const;
50
51
    int tableCellFormatIndex() const;
52
53
private:
54
    friend class QTextTable;
55
    QTextTableCell(const QTextTable *t, int f)
56
37.8M
        : table(t), fragment(f) {}
57
58
    const QTextTable *table;
59
    int fragment;
60
};
61
62
class Q_GUI_EXPORT QTextTable : public QTextFrame
63
{
64
0
    Q_OBJECT
65
0
public:
66
0
    explicit QTextTable(QTextDocument *doc);
67
0
    ~QTextTable();
68
0
69
0
    void resize(int rows, int cols);
70
0
    void insertRows(int pos, int num);
71
0
    void insertColumns(int pos, int num);
72
0
    void appendRows(int count);
73
0
    void appendColumns(int count);
74
0
    void removeRows(int pos, int num);
75
0
    void removeColumns(int pos, int num);
76
0
77
0
    void mergeCells(int row, int col, int numRows, int numCols);
78
0
    void mergeCells(const QTextCursor &cursor);
79
0
    void splitCell(int row, int col, int numRows, int numCols);
80
0
81
0
    int rows() const;
82
0
    int columns() const;
83
0
84
0
    QTextTableCell cellAt(int row, int col) const;
85
0
    QTextTableCell cellAt(int position) const;
86
0
    QTextTableCell cellAt(const QTextCursor &c) const;
87
0
88
0
    QTextCursor rowStart(const QTextCursor &c) const;
89
0
    QTextCursor rowEnd(const QTextCursor &c) const;
90
0
91
0
    void setFormat(const QTextTableFormat &format);
92
297k
    QTextTableFormat format() const { return QTextObject::format().toTableFormat(); }
93
94
private:
95
    Q_DISABLE_COPY(QTextTable)
96
    Q_DECLARE_PRIVATE(QTextTable)
97
    friend class QTextTableCell;
98
};
99
100
QT_END_NAMESPACE
101
102
#endif // QTEXTTABLE_H