1// qabstracttextdocumentlayout.sip generated by MetaSIP 2// 3// This file is part of the QtGui Python extension module. 4// 5// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com> 6// 7// This file is part of PyQt5. 8// 9// This file may be used under the terms of the GNU General Public License 10// version 3.0 as published by the Free Software Foundation and appearing in 11// the file LICENSE included in the packaging of this file. Please review the 12// following information to ensure the GNU General Public License version 3.0 13// requirements will be met: http://www.gnu.org/copyleft/gpl.html. 14// 15// If you do not wish to use this file under the terms of the GPL version 3.0 16// then you may purchase a commercial license. For more information contact 17// info@riverbankcomputing.com. 18// 19// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 20// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 21 22 23class QAbstractTextDocumentLayout : QObject 24{ 25%TypeHeaderCode 26#include <qabstracttextdocumentlayout.h> 27%End 28 29public: 30 explicit QAbstractTextDocumentLayout(QTextDocument *doc); 31 virtual ~QAbstractTextDocumentLayout(); 32 33 struct Selection 34 { 35%TypeHeaderCode 36#include <qabstracttextdocumentlayout.h> 37%End 38 39 QTextCursor cursor; 40 QTextCharFormat format; 41 }; 42 43 struct PaintContext 44 { 45%TypeHeaderCode 46#include <qabstracttextdocumentlayout.h> 47%End 48 49 PaintContext(); 50 int cursorPosition; 51 QPalette palette; 52 QRectF clip; 53 QVector<QAbstractTextDocumentLayout::Selection> selections; 54 }; 55 56 virtual void draw(QPainter *painter, const QAbstractTextDocumentLayout::PaintContext &context) = 0; 57 virtual int hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const = 0; 58 QString anchorAt(const QPointF &pos) const; 59 virtual int pageCount() const = 0; 60 virtual QSizeF documentSize() const = 0; 61 virtual QRectF frameBoundingRect(QTextFrame *frame) const = 0; 62 virtual QRectF blockBoundingRect(const QTextBlock &block) const = 0; 63 void setPaintDevice(QPaintDevice *device); 64 QPaintDevice *paintDevice() const; 65 QTextDocument *document() const; 66 void registerHandler(int objectType, QObject *component); 67%If (Qt_5_2_0 -) 68 void unregisterHandler(int objectType, QObject *component = 0); 69%End 70 QTextObjectInterface *handlerForObject(int objectType) const; 71 72signals: 73 void update(const QRectF &rect = QRectF(0., 0., 1.0E+9, 1.0E+9)); 74 void documentSizeChanged(const QSizeF &newSize); 75 void pageCountChanged(int newPages); 76 void updateBlock(const QTextBlock &block); 77 78protected: 79 virtual void documentChanged(int from, int charsRemoved, int charsAdded) = 0; 80 virtual void resizeInlineObject(QTextInlineObject item, int posInDocument, const QTextFormat &format); 81 virtual void positionInlineObject(QTextInlineObject item, int posInDocument, const QTextFormat &format); 82 virtual void drawInlineObject(QPainter *painter, const QRectF &rect, QTextInlineObject object, int posInDocument, const QTextFormat &format); 83 QTextCharFormat format(int pos); 84 85public: 86%If (Qt_5_8_0 -) 87 QString imageAt(const QPointF &pos) const; 88%End 89%If (Qt_5_8_0 -) 90 QTextFormat formatAt(const QPointF &pos) const; 91%End 92%If (Qt_5_14_0 -) 93 QTextBlock blockWithMarkerAt(const QPointF &pos) const; 94%End 95}; 96 97class QTextObjectInterface /Mixin,PyQtInterface="org.qt-project.Qt.QTextObjectInterface"/ 98{ 99%TypeHeaderCode 100#include <qabstracttextdocumentlayout.h> 101%End 102 103public: 104 virtual ~QTextObjectInterface(); 105 virtual QSizeF intrinsicSize(QTextDocument *doc, int posInDocument, const QTextFormat &format) = 0; 106 virtual void drawObject(QPainter *painter, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format) = 0; 107}; 108