CollapsiblePreview

A titled body that shows a few lines, fades, and opens to scroll.

Inherits QFrame

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

Detailed description

The chat's read preview and the task plan's step list are both this (opal-chat-surface §OCSD-12). Collapsed, the body shows Metrics::collapsedLines over a fade that says there is more, and it shows no scroll bars: a reader who has not asked for the whole content has nothing to scroll. Expanded, the body shows up to Metrics::expandedLines and scrolls both ways. A body with no more lines than the collapsed count has no caret and no fade.

The height is a function of the line count, the state and the metrics alone: totalHeight(). A chat row measures itself with the same function, so what is measured and what is drawn cannot drift apart. They did in the plan card, which measured one text and drew another, and cut off the steps past about twenty.

The header toggles the state in place and emits expandedChanged(), so the owner can record it and have the row measured again.

In this section