// This is a deliberate trade-off. (-> selectFmt creation, data() call)
void ChatItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
Q_UNUSED(option); Q_UNUSED(widget);
+ painter->save();
+ painter->setClipRect(boundingRect());
paintBackground(painter);
QTextLayout layout;
// }
// 3) draw bounding rect
// painter->drawRect(_boundingRect.adjusted(0, 0, -1, -1));
+
+ painter->restore();
}
void ChatItem::overlayFormat(UiStyle::FormatList &fmtList, int start, int end, quint32 overlayFmt) const {
void SenderChatItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
Q_UNUSED(option); Q_UNUSED(widget);
+ painter->save();
+ painter->setClipRect(boundingRect());
paintBackground(painter);
QTextLayout layout;
} else {
layout.draw(painter, pos(), additionalFormats(), boundingRect());
}
+ painter->restore();
}
void SenderChatItem::handleClick(const QPointF &pos, ChatScene::ClickMode clickMode) {
void ChatScene::setHandleXLimits() {
_firstColHandle->setXLimits(0, _secondColHandle->sceneLeft());
_secondColHandle->setXLimits(_firstColHandle->sceneRight(), width() - minContentsWidth);
+ update();
}
void ChatScene::setSelectingItem(ChatItem *item) {