Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qtexttable.h
Go to the documentation of this file.
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
12
13
14class QTextCursor;
15class QTextTable;
17
18class Q_GUI_EXPORT QTextTableCell
19{
20public:
23 QTextTableCell(const QTextTableCell &o) : table(o.table), fragment(o.fragment) {}
25 { 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 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 { return table == other.table && fragment == other.fragment; }
45 inline bool operator!=(const QTextTableCell &other) const
46 { return !operator==(other); }
47
50
51 int tableCellFormatIndex() const;
52
53private:
54 friend class QTextTable;
55 QTextTableCell(const QTextTable *t, int f)
56 : table(t), fragment(f) {}
57
58 const QTextTable *table;
59 int fragment;
60};
61
62class Q_GUI_EXPORT QTextTable : public QTextFrame
63{
65public:
66 explicit QTextTable(QTextDocument *doc);
68
69 void resize(int rows, int cols);
70 void insertRows(int pos, int num);
71 void insertColumns(int pos, int num);
72 void appendRows(int count);
73 void appendColumns(int count);
74 void removeRows(int pos, int num);
75 void removeColumns(int pos, int num);
76
77 void mergeCells(int row, int col, int numRows, int numCols);
78 void mergeCells(const QTextCursor &cursor);
79 void splitCell(int row, int col, int numRows, int numCols);
80
81 int rows() const;
82 int columns() const;
83
84 QTextTableCell cellAt(int row, int col) const;
85 QTextTableCell cellAt(int position) const;
86 QTextTableCell cellAt(const QTextCursor &c) const;
87
88 QTextCursor rowStart(const QTextCursor &c) const;
89 QTextCursor rowEnd(const QTextCursor &c) const;
90
93
94private:
95 Q_DISABLE_COPY(QTextTable)
96 Q_DECLARE_PRIVATE(QTextTable)
97 friend class QTextTableCell;
98};
99
101
102#endif // QTEXTTABLE_H
\reentrant \inmodule QtGui
Definition qtextcursor.h:30
\reentrant \inmodule QtGui
QTextTableFormat toTableFormat() const
Returns this format as a table format.
\reentrant
Definition qtextobject.h:81
QTextFormat format() const
Returns the text object's format.
\reentrant
Definition qtexttable.h:19
~QTextTableCell()
Destroys the table cell.
Definition qtexttable.h:22
bool operator==(const QTextTableCell &other) const
Returns true if this cell object and the other cell object describe the same cell; otherwise returns ...
Definition qtexttable.h:43
QTextTableCell(const QTextTableCell &o)
Copy constructor.
Definition qtexttable.h:23
bool operator!=(const QTextTableCell &other) const
Returns true if this cell object and the other cell object describe different cells; otherwise return...
Definition qtexttable.h:45
QTextTableCell & operator=(const QTextTableCell &o)
Assigns the other table cell to this table cell.
Definition qtexttable.h:24
bool isValid() const
Returns true if this is a valid table cell; otherwise returns false.
Definition qtexttable.h:36
QTextTableCell()
Constructs an invalid table cell.
Definition qtexttable.h:21
\reentrant
Definition qtexttable.h:63
QTextTableFormat format() const
Returns the table's format.
Definition qtexttable.h:92
widget setFormat(format)
a resize(100000)
QCursor cursor
Combined button and popup list for selecting options.
GLuint GLuint end
GLenum GLenum GLsizei count
GLfloat GLfloat f
GLint GLsizei GLsizei GLenum format
GLenum GLenum GLsizei void GLsizei void * column
const GLubyte * c
GLdouble GLdouble t
Definition qopenglext.h:243
GLenum GLenum GLsizei void * row
GLuint num
GLenum GLenum GLsizei void * table
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
Definition qrandom.cpp:1220
QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIterator begin(const QRegularExpressionMatchIterator &iterator)
#define Q_OBJECT
QObject::connect nullptr
QSharedPointer< T > other(t)
[5]