X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fchatitem.h;h=1f61fff6d6ffe988dda922bb473c69edfe436b6c;hb=eab5c456972d723fb3c67fe366548608f3bbeadc;hp=51b59f975c5b1a7be3cf6f54b8e80c34fdb921bf;hpb=2e023191fb47f5cbd186f7274f8ee1b5d1cc94c3;p=quassel.git diff --git a/src/qtui/chatitem.h b/src/qtui/chatitem.h index 51b59f97..1f61fff6 100644 --- a/src/qtui/chatitem.h +++ b/src/qtui/chatitem.h @@ -69,7 +69,9 @@ protected: inline QTextLayout *layout() const; + virtual QTextLayout::FormatRange selectionFormat() const; virtual inline QVector additionalFormats() const { return QVector(); } + qint16 posToCursor(const QPointF &pos); inline bool hasPrivateData() const { return (bool)_data; } @@ -83,8 +85,12 @@ protected: _boundingRect.setWidth(width); _boundingRect.setHeight(height); } - inline void setHeight(const qreal &height) { _boundingRect.setHeight(height); } - inline void setWidth(const qreal &width) { _boundingRect.setWidth(width); } + inline void setHeight(const qreal &height) { + _boundingRect.setHeight(height); + } + inline void setWidth(const qreal &width) { + _boundingRect.setWidth(width); + } private: // internal selection stuff @@ -133,7 +139,8 @@ public: virtual inline ChatLineModel::ColumnType column() const { return ChatLineModel::SenderColumn; } protected: - virtual inline ChatItemPrivate *newPrivateData() { return new ChatItemPrivate(createLayout(QTextOption::WrapAnywhere, Qt::AlignRight)); } + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + virtual inline ChatItemPrivate *newPrivateData() { return new ChatItemPrivate(createLayout(QTextOption::ManualWrap, Qt::AlignRight)); } }; // ************************************************************ @@ -172,10 +179,6 @@ private: void showWebPreview(const Clickable &click); void clearWebPreview(); - - // WARNING: setGeometry and setHeight should not be used without either: - // a) calling prepareGeometryChange() immediately before setColumns() - // b) calling Chatline::setPos() immediately afterwards qreal setGeometryByWidth(qreal w); friend class ChatLine; friend struct ContentsChatItemPrivate; @@ -207,7 +210,8 @@ struct ContentsChatItemPrivate : ChatItemPrivate { ContentsChatItem::Clickable currentClickable; bool hasDragged; - ContentsChatItemPrivate(QTextLayout *l, const QList &c, ContentsChatItem *parent) : ChatItemPrivate(l), contentsItem(parent), clickables(c), hasDragged(false) {} + ContentsChatItemPrivate(QTextLayout *l, const QList &c, ContentsChatItem *parent) + : ChatItemPrivate(l), contentsItem(parent), clickables(c), hasDragged(false) {} }; //inlines regarding ContentsChatItemPrivate