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

#include </tmp/quassel/src/uisupport/styledlabel.h>

Collaboration diagram for StyledLabel:

Public Types

enum  ResizeMode { NoResize, DynamicResize, ResizeOnHover }

Signals

void clickableActivated (const Clickable &click)

Public Member Functions

 StyledLabel (QWidget *parent=0)
void setText (const QString &text)
void setCustomFont (const QFont &font)
virtual QSize sizeHint () const
QTextOption::WrapMode wrapMode () const
void setWrapMode (QTextOption::WrapMode mode)
Qt::Alignment alignment () const
void setAlignment (Qt::Alignment alignment)
bool toolTipEnabled () const
void setToolTipEnabled (bool)
ResizeMode resizeMode () const
void setResizeMode (ResizeMode)

Protected Member Functions

virtual void paintEvent (QPaintEvent *event)
virtual void resizeEvent (QResizeEvent *event)
virtual void enterEvent (QEvent *)
virtual void leaveEvent (QEvent *)
virtual void mouseMoveEvent (QMouseEvent *event)
virtual void mousePressEvent (QMouseEvent *event)
int posToCursor (const QPointF &pos)

Private Member Functions

void layout ()
void updateSizeHint ()
void updateToolTip ()
void setHoverMode (int start, int length)
void endHoverMode ()

Private Attributes

QSize _sizeHint
QTextOption::WrapMode _wrapMode
Qt::Alignment _alignment
QTextLayout _layout
ClickableList _clickables
bool _toolTipEnabled
ResizeMode _resizeMode
QList< QTextLayout::FormatRange > _layoutList
QVector< QTextLayout::FormatRange > _extraLayoutList

Detailed Description

Definition at line 29 of file styledlabel.h.

Member Enumeration Documentation

enum ResizeMode
Enumerator:
NoResize 
DynamicResize 
ResizeOnHover 

Definition at line 34 of file styledlabel.h.

Constructor & Destructor Documentation

StyledLabel ( QWidget *  parent = 0)

Definition at line 29 of file styledlabel.cpp.

References _alignment, _layout, and _wrapMode.

Member Function Documentation

void setCustomFont ( const QFont &  font)

Definition at line 45 of file styledlabel.cpp.

References _layout, and setText().

QSize sizeHint ( ) const
virtual

Definition at line 102 of file styledlabel.cpp.

References _sizeHint.

QTextOption::WrapMode wrapMode ( ) const
inline

Definition at line 48 of file styledlabel.h.

References _wrapMode.

void setWrapMode ( QTextOption::WrapMode  mode)

Definition at line 53 of file styledlabel.cpp.

References _layout, _wrapMode, and layout().

Referenced by enterEvent(), leaveEvent(), and setResizeMode().

Qt::Alignment alignment ( ) const
inline

Definition at line 51 of file styledlabel.h.

References _alignment.

Referenced by setAlignment().

void setAlignment ( Qt::Alignment  alignment)

Definition at line 67 of file styledlabel.cpp.

References _alignment, _layout, alignment(), and layout().

bool toolTipEnabled ( ) const
inline

Definition at line 54 of file styledlabel.h.

References _toolTipEnabled.

void setToolTipEnabled ( bool  )
ResizeMode resizeMode ( ) const
inline

Definition at line 57 of file styledlabel.h.

References _resizeMode.

Referenced by enterEvent(), and leaveEvent().

void setResizeMode ( ResizeMode  mode)

Definition at line 81 of file styledlabel.cpp.

References _resizeMode, DynamicResize, and setWrapMode().

void clickableActivated ( const Clickable click)
signal

Referenced by mousePressEvent().

void paintEvent ( QPaintEvent *  event)
protectedvirtual

Definition at line 191 of file styledlabel.cpp.

References _extraLayoutList, and _layout.

void resizeEvent ( QResizeEvent *  event)
protectedvirtual

Definition at line 94 of file styledlabel.cpp.

References layout().

void enterEvent ( QEvent *  )
protectedvirtual

Definition at line 232 of file styledlabel.cpp.

References resizeMode(), ResizeOnHover, and setWrapMode().

void leaveEvent ( QEvent *  )
protectedvirtual

Definition at line 239 of file styledlabel.cpp.

References endHoverMode(), resizeMode(), ResizeOnHover, and setWrapMode().

void mouseMoveEvent ( QMouseEvent *  event)
protectedvirtual
void mousePressEvent ( QMouseEvent *  event)
protectedvirtual
int posToCursor ( const QPointF &  pos)
protected

Definition at line 201 of file styledlabel.cpp.

References _layout.

Referenced by mouseMoveEvent(), and mousePressEvent().

void layout ( )
private

Definition at line 169 of file styledlabel.cpp.

References _layout, updateSizeHint(), and updateToolTip().

Referenced by resizeEvent(), setAlignment(), setText(), and setWrapMode().

void updateSizeHint ( )
private

Definition at line 108 of file styledlabel.cpp.

References _layout, and _sizeHint.

Referenced by layout().

void updateToolTip ( )
private

Definition at line 156 of file styledlabel.cpp.

References _layout.

Referenced by layout().

void setHoverMode ( int  start,
int  length 
)
private

Definition at line 261 of file styledlabel.cpp.

References _extraLayoutList.

Referenced by mouseMoveEvent().

void endHoverMode ( )
private

Definition at line 278 of file styledlabel.cpp.

References _extraLayoutList.

Referenced by leaveEvent(), mouseMoveEvent(), and setText().

Member Data Documentation

QSize _sizeHint
private

Definition at line 74 of file styledlabel.h.

Referenced by sizeHint(), and updateSizeHint().

QTextOption::WrapMode _wrapMode
private

Definition at line 75 of file styledlabel.h.

Referenced by setWrapMode(), StyledLabel(), and wrapMode().

Qt::Alignment _alignment
private

Definition at line 76 of file styledlabel.h.

Referenced by alignment(), setAlignment(), and StyledLabel().

QTextLayout _layout
private
ClickableList _clickables
private

Definition at line 78 of file styledlabel.h.

Referenced by mouseMoveEvent(), mousePressEvent(), and setText().

bool _toolTipEnabled
private

Definition at line 79 of file styledlabel.h.

Referenced by toolTipEnabled().

ResizeMode _resizeMode
private

Definition at line 80 of file styledlabel.h.

Referenced by resizeMode(), and setResizeMode().

QList<QTextLayout::FormatRange> _layoutList
private

Definition at line 82 of file styledlabel.h.

QVector<QTextLayout::FormatRange> _extraLayoutList
private

Definition at line 83 of file styledlabel.h.

Referenced by endHoverMode(), paintEvent(), and setHoverMode().


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