Friend group map item. More...
#include <friendgroupitem.h>
Signals | |
void | locationItemClicked (const QList< QString > &userIDs) |
Signal is emitted when l item is clicked. | |
Public Member Functions | |
FriendGroupItem (FriendLocationItem *item) | |
Constructor. | |
void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
Paint event. | |
bool | dropFriends (int zoomLevel) |
Drop all FriendLocationItem items which bounding rect is not colliding with this group anymore. | |
void | dropFriend (FriendLocationItem *item) |
Drop single FriendLocationItem from this group. | |
void | joinFriend (FriendLocationItem *item) |
Join new FriendLocationItem to this group. | |
void | mergeWithGroup (FriendGroupItem *group) |
Merge this group to another FriendGroupItem. | |
Protected Member Functions | |
void | mouseMoveEvent (QGraphicsSceneMouseEvent *event) |
Mouse move event. | |
void | mousePressEvent (QGraphicsSceneMouseEvent *event) |
Mouse press event. | |
void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event) |
Mouse release event. | |
Private Attributes | |
QList< FriendLocationItem * > | m_friends |
List of joined FriendLocationItem items. | |
QPoint | m_mousePressPosition |
Mouse press position. | |
bool | m_clickEvent |
Mouse click event flag. |
Friend group map item.
Contains grouped FriendLocationItem items and draws group image with number of grouped friends
FriendGroupItem::FriendGroupItem | ( | FriendLocationItem * | item | ) |
Constructor.
Create new group, set picture and join first FriendLocationItem to the group. Group position is set to be exactly same as item given as parameter.
item | First FriendLocationItem to be joined to new group |
void FriendGroupItem::dropFriend | ( | FriendLocationItem * | item | ) |
Drop single FriendLocationItem from this group.
item | FriendLocationItem to be dropped |
bool FriendGroupItem::dropFriends | ( | int | zoomLevel | ) |
Drop all FriendLocationItem items which bounding rect is not colliding with this group anymore.
Dropped items are set to visible again.
void FriendGroupItem::joinFriend | ( | FriendLocationItem * | item | ) |
Join new FriendLocationItem to this group.
Given item is also hidden.
item | FriendLocationItem to be joined |
void FriendGroupItem::locationItemClicked | ( | const QList< QString > & | userIDs | ) | [signal] |
Signal is emitted when l item is clicked.
userIDs | list of friends user IDs in the group |
void FriendGroupItem::mergeWithGroup | ( | FriendGroupItem * | group | ) |
Merge this group to another FriendGroupItem.
Removes all FrienLocationItem items from this group and joins then to given group. Group item is not deleted, so caller must delete group after merging.
group | FriendGroupItem which takes all this group FriendLocationItem items |
void FriendGroupItem::mouseMoveEvent | ( | QGraphicsSceneMouseEvent * | event | ) | [protected] |
Mouse move event.
Disables m_clickEvent flag if press and release where not in same area.
event | QGraphicsSceneMouseEvent. |
void FriendGroupItem::mousePressEvent | ( | QGraphicsSceneMouseEvent * | event | ) | [protected] |
Mouse press event.
Sets mouse press position.
event | QGraphicsSceneMouseEvent. |
void FriendGroupItem::mouseReleaseEvent | ( | QGraphicsSceneMouseEvent * | event | ) | [protected] |
Mouse release event.
Emits friendGroupItemClicked signal if press and release where in same area.
event | QGraphicsSceneMouseEvent. |
void FriendGroupItem::paint | ( | QPainter * | painter, | |
const QStyleOptionGraphicsItem * | option, | |||
QWidget * | widget | |||
) |
Paint event.
Draw amount of joined FriendLocationItem items over the image.