443 h.component = component;
444 d->handlers.insert(objectType,
h);
457 const auto it =
d->handlers.constFind(objectType);
458 if (
it !=
d->handlers.cend() && (!component || component ==
it->component)) {
462 d->handlers.erase(
it);
477 return handler.
iface;
502 item.setWidth(
s.width());
503 item.setAscent(
s.height());
559 if ((*it).component ==
obj)
573 return pieceTable->
find(
pos).value()->format;
584 int idx = pieceTable->
find(
pos).value()->format;
636 while (
block.isValid()) {
640 int relativeCursorPos = cursorPos -
block.position();
641 const int preeditLength =
layout ?
layout->preeditAreaText().length() : 0;
642 if (preeditLength > 0 && relativeCursorPos >
layout->preeditAreaPosition())
643 cursorPos -= qMin(cursorPos -
layout->preeditAreaPosition(), preeditLength);
663 while (
block.isValid()) {
669 if (
block.textList())
670 totalIndent +=
block.textList()->format().indent() * 40;
716 return d->paintDevice;
721 #include "moc_qabstracttextdocumentlayout.cpp"
The QAbstractTextDocumentLayout class is an abstract base class used to implement custom layouts for ...
virtual void resizeInlineObject(QTextInlineObject item, int posInDocument, const QTextFormat &format)
QTextFormat formatAt(const QPointF &pos) const
virtual void drawInlineObject(QPainter *painter, const QRectF &rect, QTextInlineObject object, int posInDocument, const QTextFormat &format)
virtual void positionInlineObject(QTextInlineObject item, int posInDocument, const QTextFormat &format)
void unregisterHandler(int objectType, QObject *component=nullptr)
QTextDocument * document() const
QTextCharFormat format(int pos)
void registerHandler(int objectType, QObject *component)
virtual QRectF blockBoundingRect(const QTextBlock &block) const =0
QTextBlock blockWithMarkerAt(const QPointF &pos) const
QAbstractTextDocumentLayout(QTextDocument *doc)
the format of the selection
void setPaintDevice(QPaintDevice *device)
virtual int hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const =0
QString anchorAt(const QPointF &pos) const
QPaintDevice * paintDevice() const
~QAbstractTextDocumentLayout()
QString imageAt(const QPointF &pos) const
QTextObjectInterface * handlerForObject(int objectType) const
~QAbstractTextDocumentLayoutPrivate()
void _q_handlerDestroyed(QObject *obj)
The QFontMetrics class provides font metrics information.
iterator erase(const_iterator it)
The QObject class is the base class of all Qt objects.
void destroyed(QObject *=nullptr)
static QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
static bool disconnect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot)
The QPainter class performs low-level painting on widgets and other paint devices.
The QPointF class defines a point in the plane using floating point precision.
The QRectF class defines a finite rectangle in the plane using floating point precision.
constexpr qreal height() const noexcept
constexpr qreal width() const noexcept
bool contains(const QRectF &r) const noexcept
constexpr QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const noexcept
The QSizeF class defines the size of a two-dimensional object using floating point precision.
The QString class provides a Unicode character string.
The QTextBlockFormat class provides formatting information for blocks of text in a QTextDocument....
The QTextBlock class provides a container for text fragments in a QTextDocument. \inmodule QtGui.
The QTextCharFormat class provides formatting information for characters in a QTextDocument....
QString anchorHref() const
The QTextDocument class holds formatted text.
QTextBlock firstBlock() const
QTextFormatCollection * formatCollection()
FragmentMap::ConstIterator FragmentIterator
static const QTextDocumentPrivate * get(const QTextDocument *document)
FragmentIterator find(int pos) const
QTextFormat format(int idx) const
QTextCharFormat charFormat(int index) const
The QTextFormat class provides formatting information for a QTextDocument. \inmodule QtGui.
QTextCharFormat toCharFormat() const
QTextImageFormat toImageFormat() const
The QTextImageFormat class provides formatting information for images in a QTextDocument....
The QTextInlineObject class represents an inline object in a QAbstractTextDocumentLayout and its impl...
The QTextLayout class is used to lay out and render text. \inmodule QtGui.
The QTextObjectInterface class allows drawing of custom text objects in \l{QTextDocument}s.
virtual void drawObject(QPainter *painter, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format)=0
virtual QSizeF intrinsicSize(QTextDocument *doc, int posInDocument, const QTextFormat &format)=0
virtual ~QTextObjectInterface()
QT_END_INCLUDE_NAMESPACE typedef double qreal
GLint GLsizei GLsizei GLenum format
GLfloat GLfloat GLfloat GLfloat h
QPointer< QObject > component
QTextObjectInterface * iface