Quassel IRC  Pre-Release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
ChatItem Class Reference

#include </tmp/quassel/src/qtui/chatitem.h>

Inheritance diagram for ChatItem:
Collaboration diagram for ChatItem:

Public Member Functions

const QAbstractItemModel * model () const
ChatLinechatLine () const
ChatScenechatScene () const
ChatViewchatView () const
int row () const
virtual ChatLineModel::ColumnType column () const =0
QRectF boundingRect () const
qreal width () const
qreal height () const
QPointF pos () const
qreal x () const
qreal y () const
QPointF mapToLine (const QPointF &) const
QPointF mapFromLine (const QPointF &) const
QPointF mapToScene (const QPointF &) const
QPointF mapFromScene (const QPointF &) const
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
virtual int type () const
QVariant data (int role) const
QString selection () const
void clearSelection ()
void setFullSelection ()
void continueSelecting (const QPointF &pos)
bool hasSelection () const
bool isPosOverSelection (const QPointF &pos) const
QList< QRectF > findWords (const QString &searchWord, Qt::CaseSensitivity caseSensitive)
virtual void addActionsToMenu (QMenu *menu, const QPointF &itemPos)
virtual void handleClick (const QPointF &pos, ChatScene::ClickMode)
void initLayoutHelper (QTextLayout *layout, QTextOption::WrapMode, Qt::Alignment=Qt::AlignLeft) const
virtual void clearCache ()
 Remove internally cached data.

Protected Types

enum  SelectionMode { NoSelection, PartialSelection, FullSelection }

Protected Member Functions

 ChatItem (const QRectF &boundingRect, ChatLine *parent)
virtual ~ChatItem ()
virtual void mouseMoveEvent (QGraphicsSceneMouseEvent *event)
virtual void mousePressEvent (QGraphicsSceneMouseEvent *event)
virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *event)
virtual void hoverEnterEvent (QGraphicsSceneHoverEvent *)
virtual void hoverLeaveEvent (QGraphicsSceneHoverEvent *)
virtual void hoverMoveEvent (QGraphicsSceneHoverEvent *)
QTextLayout * layout () const
virtual void initLayout (QTextLayout *layout) const
virtual void doLayout (QTextLayout *) const
virtual UiStyle::FormatList formatList () const
void paintBackground (QPainter *)
QVector< QTextLayout::FormatRange > selectionFormats () const
virtual QVector
< QTextLayout::FormatRange > 
additionalFormats () const
void overlayFormat (UiStyle::FormatList &fmtList, int start, int end, quint32 overlayFmt) const
qint16 selectionStart () const
void setSelectionStart (qint16 start)
qint16 selectionEnd () const
void setSelectionEnd (qint16 end)
SelectionMode selectionMode () const
void setSelectionMode (SelectionMode mode)
void setSelection (SelectionMode mode, qint16 selectionStart, qint16 selectionEnd)
qint16 posToCursor (const QPointF &pos) const
void setGeometry (qreal width, qreal height)
void setHeight (const qreal &height)
void setWidth (const qreal &width)
void setPos (const QPointF &pos)

Private Member Functions

void setSelection (int start, int length)

Private Attributes

ChatLine_parent
QRectF _boundingRect
SelectionMode _selectionMode
qint16 _selectionStart
qint16 _selectionEnd
QTextLayout * _cachedLayout

Friends

class ChatLine

Detailed Description

Definition at line 41 of file chatitem.h.

Member Enumeration Documentation

enum SelectionMode
protected
Enumerator:
NoSelection 
PartialSelection 
FullSelection 

Definition at line 95 of file chatitem.h.

Constructor & Destructor Documentation

ChatItem ( const QRectF &  boundingRect,
ChatLine parent 
)
protected

Definition at line 43 of file chatitem.cpp.

~ChatItem ( )
protectedvirtual

Definition at line 53 of file chatitem.cpp.

References _cachedLayout.

Member Function Documentation

const QAbstractItemModel * model ( ) const

Definition at line 77 of file chatitem.cpp.

References chatLine(), and ChatLine::model().

Referenced by data(), and findWords().

ChatView * chatView ( ) const

Definition at line 71 of file chatitem.cpp.

References chatScene(), and ChatScene::chatView().

Referenced by layout().

virtual ChatLineModel::ColumnType column ( ) const
pure virtual
QRectF boundingRect ( ) const
inline

Definition at line 300 of file chatitem.h.

References _boundingRect.

Referenced by ChatLine::itemAt(), mouseMoveEvent(), paint(), SenderChatItem::paint(), and paintBackground().

qreal height ( ) const
inline
QPointF pos ( ) const
inline
qreal y ( ) const
inline

Definition at line 305 of file chatitem.h.

References pos().

Referenced by findWords(), and ContentsChatItem::showWebPreview().

QPointF mapToLine ( const QPointF &  p) const

Definition at line 89 of file chatitem.cpp.

References pos().

QPointF mapFromLine ( const QPointF &  p) const

Definition at line 95 of file chatitem.cpp.

References pos().

Referenced by posToCursor().

QPointF mapToScene ( const QPointF &  p) const

Definition at line 102 of file chatitem.cpp.

References chatLine().

Referenced by ContentsChatItem::showWebPreview(), and ChatScene::startGlobalSelection().

QPointF mapFromScene ( const QPointF &  p) const
void paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget = 0 
)
virtual

Reimplemented in SenderChatItem.

Definition at line 218 of file chatitem.cpp.

References additionalFormats(), boundingRect(), layout(), paintBackground(), and pos().

Referenced by ChatLine::paint().

virtual int type ( ) const
inlinevirtual

Reimplemented in SenderChatItem, and TimestampChatItem.

Definition at line 70 of file chatitem.h.

References ChatScene::ChatItemType.

QString selection ( ) const
void clearSelection ( )
void setFullSelection ( )

Definition at line 351 of file chatitem.cpp.

References _selectionMode, chatLine(), and FullSelection.

Referenced by mouseMoveEvent().

void continueSelecting ( const QPointF &  pos)
bool hasSelection ( ) const
bool isPosOverSelection ( const QPointF &  pos) const
QList< QRectF > findWords ( const QString &  searchWord,
Qt::CaseSensitivity  caseSensitive 
)
void addActionsToMenu ( QMenu *  menu,
const QPointF &  itemPos 
)
virtual
void handleClick ( const QPointF &  pos,
ChatScene::ClickMode  clickMode 
)
virtual
void initLayoutHelper ( QTextLayout *  layout,
QTextOption::WrapMode  wrapMode,
Qt::Alignment  alignment = Qt::AlignLeft 
) const
void clearCache ( )
virtual

Remove internally cached data.

This removes e.g. the cached QTextLayout to avoid wasting space for nonvisible ChatLines

Definition at line 137 of file chatitem.cpp.

References _cachedLayout.

Referenced by ChatLine::clearCache(), setGeometry(), setHeight(), and setWidth().

void mouseMoveEvent ( QGraphicsSceneMouseEvent *  event)
protectedvirtual
void mousePressEvent ( QGraphicsSceneMouseEvent *  event)
protectedvirtual

Definition at line 452 of file chatitem.cpp.

Referenced by ChatLine::mousePressEvent().

void mouseReleaseEvent ( QGraphicsSceneMouseEvent *  event)
protectedvirtual
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent *  )
inlineprotectedvirtual

Definition at line 104 of file chatitem.h.

Referenced by ChatLine::hoverEnterEvent().

virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent *  )
inlineprotectedvirtual

Reimplemented in ContentsChatItem.

Definition at line 105 of file chatitem.h.

Referenced by ChatLine::hoverLeaveEvent().

virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent *  )
inlineprotectedvirtual

Reimplemented in ContentsChatItem.

Definition at line 106 of file chatitem.h.

Referenced by ChatLine::hoverMoveEvent().

void initLayout ( QTextLayout *  layout) const
protectedvirtual

Reimplemented in ContentsChatItem, and SenderChatItem.

Definition at line 161 of file chatitem.cpp.

References doLayout(), and initLayoutHelper().

Referenced by layout().

void doLayout ( QTextLayout *  layout) const
protectedvirtual

Reimplemented in ContentsChatItem.

Definition at line 168 of file chatitem.cpp.

References width().

Referenced by initLayout(), and SenderChatItem::initLayout().

UiStyle::FormatList formatList ( ) const
protectedvirtual

Reimplemented in ContentsChatItem.

Definition at line 180 of file chatitem.cpp.

References data(), and MessageModel::FormatRole.

Referenced by initLayoutHelper(), and selectionFormats().

void paintBackground ( QPainter *  painter)
protected
QVector< QTextLayout::FormatRange > selectionFormats ( ) const
protected
QVector< QTextLayout::FormatRange > additionalFormats ( ) const
protectedvirtual

Reimplemented in ContentsChatItem.

Definition at line 286 of file chatitem.cpp.

References selectionFormats().

Referenced by paint(), and SenderChatItem::paint().

void overlayFormat ( UiStyle::FormatList fmtList,
int  start,
int  end,
quint32  overlayFmt 
) const
protected

Definition at line 260 of file chatitem.cpp.

References data(), and MessageModel::DisplayRole.

Referenced by ContentsChatItem::formatList().

qint16 selectionStart ( ) const
inlineprotected

Definition at line 119 of file chatitem.h.

References _selectionStart.

void setSelectionStart ( qint16  start)
inlineprotected

Definition at line 120 of file chatitem.h.

References _selectionStart.

Referenced by ContentsChatItem::handleClick().

qint16 selectionEnd ( ) const
inlineprotected

Definition at line 121 of file chatitem.h.

References _selectionEnd.

void setSelectionEnd ( qint16  end)
inlineprotected

Definition at line 122 of file chatitem.h.

References _selectionEnd.

Referenced by ContentsChatItem::handleClick().

SelectionMode selectionMode ( ) const
inlineprotected

Definition at line 123 of file chatitem.h.

References _selectionMode.

void setSelectionMode ( SelectionMode  mode)
inlineprotected

Definition at line 124 of file chatitem.h.

References _selectionMode.

Referenced by ContentsChatItem::handleClick().

void setSelection ( SelectionMode  mode,
qint16  selectionStart,
qint16  selectionEnd 
)
protected

Definition at line 342 of file chatitem.cpp.

References _selectionEnd, _selectionMode, _selectionStart, and chatLine().

Referenced by ContentsChatItem::handleClick().

qint16 posToCursor ( const QPointF &  pos) const
protected
void setGeometry ( qreal  width,
qreal  height 
)
inlineprotected
void setHeight ( const qreal &  height)
inlineprotected

Definition at line 130 of file chatitem.h.

References _boundingRect, and clearCache().

Referenced by ChatLine::setGeometryByWidth(), and ChatLine::setSecondColumn().

void setWidth ( const qreal &  width)
inlineprotected

Definition at line 131 of file chatitem.h.

References _boundingRect, and clearCache().

void setPos ( const QPointF &  pos)
inlineprotected

Definition at line 132 of file chatitem.h.

References _boundingRect.

Referenced by ChatLine::setFirstColumn(), and ChatLine::setSecondColumn().

void setSelection ( int  start,
int  length 
)
private

Friends And Related Function Documentation

friend class ChatLine
friend

Definition at line 146 of file chatitem.h.

Member Data Documentation

ChatLine* _parent
private

Definition at line 135 of file chatitem.h.

Referenced by chatLine().

QRectF _boundingRect
private

Definition at line 136 of file chatitem.h.

Referenced by boundingRect(), height(), pos(), setGeometry(), setHeight(), setPos(), setWidth(), and width().

QTextLayout* _cachedLayout
mutableprivate

Definition at line 141 of file chatitem.h.

Referenced by clearCache(), layout(), and ~ChatItem().


The documentation for this class was generated from the following files: