Home · All Classes · Main Classes · Deprecated |
MBubbleItem is a speech bubble like widget for conversation views. More...
Inherits MWidgetController.
MBubbleItem is a speech bubble like widget for conversation views.
MBubbleItem, MListItem and MContentItem can usually be used for the same type of purposes, however the MBubbleItem API is message-centric and therefore better suited for messaging applications. When several bubble items are put into a layout the visual impression is that of a back and forth conversation.
The speech bubble supports avatar images, separate styling for incoming and outgoing messages, as well as an area for application specific widgets.
MBubbleItem::MBubbleItem | ( | QGraphicsItem * | parent = 0 |
) | [explicit] |
Constructs a MBubbleItem instance. The optional parent argument is passed to MWidgetController's constructor.
MBubbleItem::~MBubbleItem | ( | ) | [virtual] |
Destroys the item.
void MBubbleItem::addInformationWidget | ( | QGraphicsWidget * | widget | ) | [slot] |
Adds the widget to the informational widgets stack.
Informational widgets are displayed as part of the message bubble main body. There are two pre-defined information widgets for the bubble: number of comments and thumbs up received.
The ownership of the widget is transfered to the item. If the widget must not be deleted by the item the caller must invoke removeInformationWidget() to remove the widget from the graphics hierarchy.
MImageWidget * MBubbleItem::avatar | ( | ) | const |
Returns the image widget used for the avatar.
void MBubbleItem::bubbleClicked | ( | ) | [signal] |
This signal is emitted if the bubble that contains the message is clicked.
QGraphicsWidget * MBubbleItem::centralWidget | ( | ) |
Returns the central widget.
For performance reasons, the central widget is not created by default. If the central widget has not been previously set the function returns 0.
QString MBubbleItem::commentsString | ( | ) |
Returns the string for the number of comments received for the bubble.
QStack< QGraphicsWidget * > MBubbleItem::informationWidgets | ( | ) |
Returns the stack of informational widgets attached to the bubble.
void MBubbleItem::linkActivated | ( | const QString & | url | ) | [signal] |
This signal is emitted if a link pointing to url in the message is clicked.
Links can be created using HTML notation, see the MLabel documentation for further information.
QString MBubbleItem::message | ( | ) |
Returns the body of the message.
MBubbleItem::MessageType MBubbleItem::messageType | ( | ) | const |
Returns the type of the message.
void MBubbleItem::removeInformationWidget | ( | QGraphicsWidget * | widget | ) | [slot] |
Removes the widget from the informational widgets stack.
Informational widgets are displayed as part of the message bubble main body. There are two pre-defined information widgets for the bubble: number of comments and thumbs up received.
The removed widget is removed from the scene hierarchy and the ownership is transfered to caller.
QString MBubbleItem::senderName | ( | ) |
Returns the name of the message sender.
void MBubbleItem::setAvatar | ( | MImageWidget * | avatar | ) | [slot] |
Replaces the current avatar image widget attached to the bubble with avatar.
Any previous avatar is deleted if its QGraphicsItem::parent() is set to this bubble widget, otherwise it is left untouched.
The avatar will always be deleted when the bubble is deleted.
void MBubbleItem::setAvatar | ( | const QPixmap & | pixmap | ) | [slot] |
Sets the avatar image to display the pixmap.
If there is an existing avatar() widget, this will set the pixmap for that avatar. Otherwise a new MImageWidget will be created and its QGraphicsItem::parent() set to this bubble widget.
void MBubbleItem::setCentralWidget | ( | QGraphicsWidget * | centralWidget | ) | [slot] |
Sets the centralWidget.
The central widget is the attachment point for application specific content inside the bubble item.
Example:
MBubbleItem *bubble = new MBubbleItem(); MWidget *container = new MWidget(); MImageWidget *image1 = new MImageWidget("foo"); MImageWidget *image2 = new MImageWidget("bar"); QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical, container); layout->addItem(image1); layout->addItem(image2); bubble->setCentralWidget(container);
void MBubbleItem::setCommentsString | ( | const QString & | comments | ) | [slot] |
Sets the string for number of comments received for the bubble item to comments.
This is a convenience method that creates widgets on the informationWidgets() stack for showing the number of comments attached to the bubble item. An example of a string could "+3", but it is up to the application to determine how the string is formatted.
void MBubbleItem::setMessage | ( | const QString & | message | ) | [slot] |
void MBubbleItem::setMessageType | ( | MessageType | messageType | ) | [slot] |
Sets type of the message (incoming or outgoing) to messageType.
void MBubbleItem::setSenderName | ( | const QString & | name | ) | [slot] |
Sets the name of the message sender to name.
This must be html escaped. E.g.
bubble->setSenderName(Qt::escape("I <3 everyone!"));
void MBubbleItem::setThumbsUpString | ( | const QString & | thumbsUp | ) | [slot] |
Sets the string for number of thumbs up received for the bubble item to thumbsUp.
This is a convenience method that creates widgets on the informationWidgets() stack for showing the number of "thumbs up" attached to the bubble item. An example of a string could "+3", but it is up to the application to determine how the string is formatted.
void MBubbleItem::setTimeStamp | ( | const QString & | timeStamp | ) | [slot] |
Sets the time stamp string of the message to timeStamp.
This must be html escaped.
QString MBubbleItem::thumbsUpString | ( | ) |
Returns the string for the number of thumbs-up received for the bubble.
QString MBubbleItem::timeStamp | ( | ) |
Returns the time stamp string displayed as part of the bubble.
MBubbleItem::commentsString [read, write] |
The number of comments received, displayed as part of the bubble.
MBubbleItem::message [read, write] |
The main body of the message.
MBubbleItem::senderName [read, write] |
Name of the message sender.
MBubbleItem::thumbsUpString [read, write] |
The number of thumbs up received, displayed as part of the bubble.
MBubbleItem::timeStamp [read, write] |
Time the message was sent, displayed as part of the bubble.
Copyright © 2010 Nokia Corporation | MeeGo Touch |