ChatProseView

The prose of a composite chat row, painted as a painted row paints it (trove-navigation TNX-41).

Inherits QWidget
Group libwidgets

Declared in src/libs/libwidgets/widgets/chat/ChatProseView.hpp.

Detailed description

A composite row holds a card, such as the buttons of a question, under its prose. The prose was a label that rendered the HTML of the document: its tables broke at spaces only, so a wide table was cut at the edge of the bubble, and its measure was another document than the one it showed (TNX-33). This view paints the document of a painted row, with the tables of ChatTables: whole words in each cell, and a table wider than the bubble that scrolls sideways.

See also ChatTables, ChatBubbleDelegate.

Member function documentation

ChatProseView

[explicit] ChatProseView::ChatProseView(std::unique_ptr<QTextDocument> document, QWidget *parent = nullptr)

Show document, which the view takes, in parent.

document

QTextDocument *ChatProseView::document() const

Returns the document that the view shows.

See also setDocument().

hasHeightForWidth

[override virtual] bool ChatProseView::hasHeightForWidth() const

Reimplements: QWidget::hasHeightForWidth() const.

Returns true: the height of the prose follows its width.

heightForWidth

[override virtual] int ChatProseView::heightForWidth(int width) const

Reimplements: QWidget::heightForWidth(int w) const.

Returns the height of the prose at width, with its tables fitted to it.

minimumSizeHint

[override virtual] QSize ChatProseView::minimumSizeHint() const

Reimplements an access function for property: QWidget::minimumSizeHint.

Returns no width, and the height of one line: the bubble sets the width (TNX-33).

setDocument

void ChatProseView::setDocument(std::unique_ptr<QTextDocument> document)

Show document in place of the one shown, as a new body size of the chat does.

The table offsets stay; paint() clamps them to the new layout.

See also document().

setTableOffset

bool ChatProseView::setTableOffset(int index, qreal offset)

Moves table index to offset, clamped to the table. Returns true when it moved.

See also tableOffset().

sizeHint

[override virtual] QSize ChatProseView::sizeHint() const

Reimplements an access function for property: QWidget::sizeHint.

Returns the natural width of the prose, and its height at that width.

tableOffset

qreal ChatProseView::tableOffset(int index) const

Returns the offset of table index, from 0, in pixels.

See also setTableOffset().

In this section