X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchatitem.h;h=996cb4323a9d1c13c37feaf46c7b58bd76f65800;hp=5877040cf33b2b914ba1545d6645f65f58d066d5;hb=114f8a14b8bc82669ffda0599ce30fc299be9396;hpb=e88a5b5f44c84f3892c120b98e6a376032a32644 diff --git a/src/qtui/chatitem.h b/src/qtui/chatitem.h index 5877040c..996cb432 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; } @@ -80,16 +82,13 @@ protected: // a) calling prepareGeometryChange() immediately before setColumns() // b) calling Chatline::setPos() immediately afterwards inline void setGeometry(qreal width, qreal height) { - prepareGeometryChange(); _boundingRect.setWidth(width); _boundingRect.setHeight(height); } inline void setHeight(const qreal &height) { - prepareGeometryChange(); _boundingRect.setHeight(height); } inline void setWidth(const qreal &width) { - prepareGeometryChange(); _boundingRect.setWidth(width); } @@ -140,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)); } }; // ************************************************************ @@ -162,6 +162,9 @@ protected: virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event); + virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event); + + virtual QVector additionalFormats() const; @@ -179,10 +182,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; @@ -214,7 +213,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