Warning, file /include/QtGui/qtexttable.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004 #ifndef QTEXTTABLE_H
0005 #define QTEXTTABLE_H
0006
0007 #include <QtGui/qtguiglobal.h>
0008 #include <QtCore/qobject.h>
0009 #include <QtGui/qtextobject.h>
0010
0011 QT_BEGIN_NAMESPACE
0012
0013
0014 class QTextCursor;
0015 class QTextTable;
0016 class QTextTablePrivate;
0017
0018 class Q_GUI_EXPORT QTextTableCell
0019 {
0020 public:
0021 QTextTableCell() : table(nullptr) {}
0022 ~QTextTableCell() {}
0023 QTextTableCell(const QTextTableCell &o) : table(o.table), fragment(o.fragment) {}
0024 QTextTableCell &operator=(const QTextTableCell &o)
0025 { table = o.table; fragment = o.fragment; return *this; }
0026
0027 void setFormat(const QTextCharFormat &format);
0028 QTextCharFormat format() const;
0029
0030 int row() const;
0031 int column() const;
0032
0033 int rowSpan() const;
0034 int columnSpan() const;
0035
0036 inline bool isValid() const { return table != nullptr; }
0037
0038 QTextCursor firstCursorPosition() const;
0039 QTextCursor lastCursorPosition() const;
0040 int firstPosition() const;
0041 int lastPosition() const;
0042
0043 inline bool operator==(const QTextTableCell &other) const
0044 { return table == other.table && fragment == other.fragment; }
0045 inline bool operator!=(const QTextTableCell &other) const
0046 { return !operator==(other); }
0047
0048 QTextFrame::iterator begin() const;
0049 QTextFrame::iterator end() const;
0050
0051 int tableCellFormatIndex() const;
0052
0053 private:
0054 friend class QTextTable;
0055 QTextTableCell(const QTextTable *t, int f)
0056 : table(t), fragment(f) {}
0057
0058 const QTextTable *table;
0059 int fragment;
0060 };
0061
0062 class Q_GUI_EXPORT QTextTable : public QTextFrame
0063 {
0064 Q_OBJECT
0065 public:
0066 explicit QTextTable(QTextDocument *doc);
0067 ~QTextTable();
0068
0069 void resize(int rows, int cols);
0070 void insertRows(int pos, int num);
0071 void insertColumns(int pos, int num);
0072 void appendRows(int count);
0073 void appendColumns(int count);
0074 void removeRows(int pos, int num);
0075 void removeColumns(int pos, int num);
0076
0077 void mergeCells(int row, int col, int numRows, int numCols);
0078 void mergeCells(const QTextCursor &cursor);
0079 void splitCell(int row, int col, int numRows, int numCols);
0080
0081 int rows() const;
0082 int columns() const;
0083
0084 QTextTableCell cellAt(int row, int col) const;
0085 QTextTableCell cellAt(int position) const;
0086 QTextTableCell cellAt(const QTextCursor &c) const;
0087
0088 QTextCursor rowStart(const QTextCursor &c) const;
0089 QTextCursor rowEnd(const QTextCursor &c) const;
0090
0091 void setFormat(const QTextTableFormat &format);
0092 QTextTableFormat format() const { return QTextObject::format().toTableFormat(); }
0093
0094 private:
0095 Q_DISABLE_COPY(QTextTable)
0096 Q_DECLARE_PRIVATE(QTextTable)
0097 friend class QTextTableCell;
0098 };
0099
0100 QT_END_NAMESPACE
0101
0102 #endif