CopperSpice API  1.9.2
QPlainTextDocumentLayout Class Reference

The QPlainTextDocumentLayout class implements a plain text layout for QTextDocument. More...

Inheritance diagram for QPlainTextDocumentLayout:
QAbstractTextDocumentLayout QObject

Public Methods

 QPlainTextDocumentLayout (QTextDocument *document)
 
 ~QPlainTextDocumentLayout ()
 
QRectF blockBoundingRect (const QTextBlock &block) const override
 
int cursorWidth () const
 
QSizeF documentSize () const override
 
void draw (QPainter *, const PaintContext &) override
 
void ensureBlockLayout (const QTextBlock &block) const
 
QRectF frameBoundingRect (QTextFrame *) const override
 
int hitTest (const QPointF &, Qt::HitTestAccuracy) const override
 
int pageCount () const override
 
void requestUpdate ()
 
void setCursorWidth (int width)
 
- Public Methods inherited from QAbstractTextDocumentLayout
 QAbstractTextDocumentLayout (QTextDocument *doc)
 
QString anchorAt (const QPointF &pos) const
 
QTextDocumentdocument () const
 
virtual void draw (QPainter *painter, const PaintContext &context) = 0
 
QTextObjectInterfacehandlerForObject (int objectType) const
 
QPaintDevicepaintDevice () const
 
void registerHandler (int objectType, QObject *component)
 
void setPaintDevice (QPaintDevice *device)
 
void unregisterHandler (int objectType, QObject *component=nullptr)
 
- Public Methods inherited from QObject
 QObject (QObject *parent=nullptr)
 
 ~QObject ()
 
bool blockSignals (bool block)
 
const QList< QObject * > & children () const
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QStringdynamicPropertyNames () const
 
virtual bool event (QEvent *event)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
template<typename T >
findChild (const QString &childName=QString ()) const
 
template<class T >
QList< T > findChildren (const QRegularExpression &regExp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<class T >
QList< T > findChildren (const QString &childName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
bool inherits (const QString &className) const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const
 
bool isWindowType () const
 
void killTimer (int id)
 
const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const
 
QObject * parent () const
 
template<class T = QVariant>
property (const QString &name) const
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const QString &name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
QThreadthread () const
 

Protected Methods

void documentChanged (int from, int charsRemoved, int charsAdded) override
 
- Protected Methods inherited from QAbstractTextDocumentLayout
virtual void drawInlineObject (QPainter *painter, const QRectF &rect, QTextInlineObject object, int posInDocument, const QTextFormat &format)
 
QTextCharFormat format (int pos)
 
virtual void positionInlineObject (QTextInlineObject item, int posInDocument, const QTextFormat &format)
 
virtual void resizeInlineObject (QTextInlineObject item, int posInDocument, const QTextFormat &format)
 
- Protected Methods inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signalMethod) const
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signalMethod) const
 
bool isSignalConnected (const QMetaMethod &signalMethod) const
 
int receivers (const QString &signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

Properties

 cursorWidth
 
- Properties inherited from QObject
 objectName
 

Friends

class QPlainTextEdit
 

Additional Inherited Members

- Public Signals inherited from QAbstractTextDocumentLayout
void documentSizeChanged (const QSizeF &newSize)
 
void pageCountChanged (int newPages)
 
void update (const QRectF &rect=QRectF (0.0, 0.0, 1000000000.0, 1000000000.0))
 
void updateBlock (const QTextBlock &block)
 
- Public Signals inherited from QObject
void destroyed (QObject *obj=nullptr)
 
void objectNameChanged (const QString &objectName)
 
- Public Slots inherited from QObject
void deleteLater ()
 
- Static Public Methods inherited from QObject
static bool connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ())
 
static bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...))
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod)
 
static QMetaObjectstaticMetaObject ()
 
static QString tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >())
 

Detailed Description

The QPlainTextDocumentLayout class implements a plain text layout for QTextDocument. This class is required for text documents that can be display or edited in a QPlainTextEdit. See QTextDocument::setDocumentLayout().

QPlainTextDocumentLayout uses the QAbstractTextDocumentLayout API that QTextDocument requires, but redefines it partially in order to support plain text better. For instances, it does not operate on vertical pixels, but on paragraphs (called blocks) instead. The height of a document is identical to the number of paragraphs it contains. The layout also does not support tables or nested frames, or any sort of advanced text layout that goes beyond a list of paragraphs with syntax highlighting.

Constructor & Destructor Documentation

QPlainTextDocumentLayout::QPlainTextDocumentLayout ( QTextDocument document)

Constructs a plain text document layout for the text document.

QPlainTextDocumentLayout::~QPlainTextDocumentLayout ( )

Destructs a plain text document layout.

Method Documentation

QRectF QPlainTextDocumentLayout::blockBoundingRect ( const QTextBlock block) const
overridevirtual
int QPlainTextDocumentLayout::cursorWidth ( ) const

Returns the value of the property.

void QPlainTextDocumentLayout::documentChanged ( int  from,
int  charsRemoved,
int  charsAdded 
)
overrideprotectedvirtual
QSizeF QPlainTextDocumentLayout::documentSize ( ) const
overridevirtual
void QPlainTextDocumentLayout::draw ( QPainter ,
const PaintContext &   
)
override
void QPlainTextDocumentLayout::ensureBlockLayout ( const QTextBlock block) const

Ensures the given block has a valid layout.

QRectF QPlainTextDocumentLayout::frameBoundingRect ( QTextFrame ) const
overridevirtual
int QPlainTextDocumentLayout::hitTest ( const QPointF ,
Qt::HitTestAccuracy   
) const
overridevirtual
int QPlainTextDocumentLayout::pageCount ( ) const
overridevirtual
void QPlainTextDocumentLayout::requestUpdate ( )

Requests a complete update on all views.

void QPlainTextDocumentLayout::setCursorWidth ( int  width)

Sets the value of the property to width.

Property Documentation

QPlainTextDocumentLayout::cursorWidth

This property specifies the width of the cursor in pixels. The default value is 1.

PropertiesClass Methods
read cursorWidth
write setCursorWidth