ChatStreamWidget

Reusable Telegram-style chat widget with streaming support and interactive bubbles.

Declared in src/libs/libwidgets/widgets/chat/ChatStreamWidget.hpp
Inherits QWidget
Group libwidgets

Detailed description

Wraps a QListView with a ChatMessageModel and ChatBubbleDelegate, adding a streaming bubble (outside the model for zero-churn token appending), a typing indicator, auto-scroll, viewport-aware persistent editor lifecycle, and a right-click context menu.

Layout is controlled by three Q_PROPERTYs: maxBubbleWidth, maxBubbleWidthPct, and leftAlignThreshold.

See also ChatMessageModel, ChatBubbleDelegate, OpalChatOverlay.

Property documentation

leftAlignThreshold property

leftAlignThreshold : float

This property holds the fraction of the view width below which every bubble aligns to the left.

When the bubble width limit is less than this fraction of the view width, the view is wide. Then the user's bubbles also align to the left, as the other bubbles do. Otherwise the user's bubbles align to the right. The default is 0.5.

Access functions:

  • float leftAlignThreshold() const
  • void setLeftAlignThreshold(float threshold)

maxBubbleWidth property

maxBubbleWidth : int

This property holds the largest width of a message bubble, in pixels.

A bubble is never wider than this value, and never wider than maxBubbleWidthPct of the view width. The smaller of the two limits applies. The default is 450.

Access functions:

  • int maxBubbleWidth() const
  • void setMaxBubbleWidth(int width)

maxBubbleWidthPct property

maxBubbleWidthPct : float

This property holds the largest width of a message bubble, as a fraction of the view width.

The value is a fraction, not a percentage: 0.9 is 90 percent. The smaller of this limit and maxBubbleWidth applies. The default is 0.9.

Access functions:

  • float maxBubbleWidthPct() const
  • void setMaxBubbleWidthPct(float pct)
In this section