qabstracttextdocumentlayout.sip 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. // qabstracttextdocumentlayout.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtGui Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  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. class QAbstractTextDocumentLayout : public QObject
  22. {
  23. %TypeHeaderCode
  24. #include <qabstracttextdocumentlayout.h>
  25. %End
  26. public:
  27. explicit QAbstractTextDocumentLayout(QTextDocument *doc);
  28. virtual ~QAbstractTextDocumentLayout();
  29. struct Selection
  30. {
  31. %TypeHeaderCode
  32. #include <qabstracttextdocumentlayout.h>
  33. %End
  34. QTextCursor cursor;
  35. QTextCharFormat format;
  36. };
  37. struct PaintContext
  38. {
  39. %TypeHeaderCode
  40. #include <qabstracttextdocumentlayout.h>
  41. %End
  42. PaintContext();
  43. int cursorPosition;
  44. QPalette palette;
  45. QRectF clip;
  46. QList<QAbstractTextDocumentLayout::Selection> selections;
  47. };
  48. virtual void draw(QPainter *painter, const QAbstractTextDocumentLayout::PaintContext &context) = 0;
  49. virtual int hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const = 0;
  50. QString anchorAt(const QPointF &pos) const;
  51. virtual int pageCount() const = 0;
  52. virtual QSizeF documentSize() const = 0;
  53. virtual QRectF frameBoundingRect(QTextFrame *frame) const = 0;
  54. virtual QRectF blockBoundingRect(const QTextBlock &block) const = 0;
  55. void setPaintDevice(QPaintDevice *device);
  56. QPaintDevice *paintDevice() const;
  57. QTextDocument *document() const;
  58. void registerHandler(int objectType, QObject *component);
  59. void unregisterHandler(int objectType, QObject *component = 0);
  60. QTextObjectInterface *handlerForObject(int objectType) const;
  61. signals:
  62. void update(const QRectF &rect = QRectF(0., 0., 1.0E+9, 1.0E+9));
  63. void documentSizeChanged(const QSizeF &newSize);
  64. void pageCountChanged(int newPages);
  65. void updateBlock(const QTextBlock &block);
  66. protected:
  67. virtual void documentChanged(int from, int charsRemoved, int charsAdded) = 0;
  68. virtual void resizeInlineObject(QTextInlineObject item, int posInDocument, const QTextFormat &format);
  69. virtual void positionInlineObject(QTextInlineObject item, int posInDocument, const QTextFormat &format);
  70. virtual void drawInlineObject(QPainter *painter, const QRectF &rect, QTextInlineObject object, int posInDocument, const QTextFormat &format);
  71. QTextCharFormat format(int pos);
  72. public:
  73. QString imageAt(const QPointF &pos) const;
  74. QTextFormat formatAt(const QPointF &pos) const;
  75. QTextBlock blockWithMarkerAt(const QPointF &pos) const;
  76. };
  77. class QTextObjectInterface /Mixin,PyQtInterface="org.qt-project.Qt.QTextObjectInterface"/
  78. {
  79. %TypeHeaderCode
  80. #include <qabstracttextdocumentlayout.h>
  81. %End
  82. public:
  83. virtual ~QTextObjectInterface();
  84. virtual QSizeF intrinsicSize(QTextDocument *doc, int posInDocument, const QTextFormat &format) = 0;
  85. virtual void drawObject(QPainter *painter, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format) = 0;
  86. };