projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Properly handle hover events in ChatView
[quassel.git]
/
src
/
qtui
/
chatline.cpp
diff --git
a/src/qtui/chatline.cpp
b/src/qtui/chatline.cpp
index
6032cbe
..
2af3269
100644
(file)
--- a/
src/qtui/chatline.cpp
+++ b/
src/qtui/chatline.cpp
@@
-49,7
+49,8
@@
ChatLine::ChatLine(int row, QAbstractItemModel *model,
_width(width),
_height(_contentsItem.height()),
_selection(0),
_width(width),
_height(_contentsItem.height()),
_selection(0),
- _mouseGrabberItem(0)
+ _mouseGrabberItem(0),
+ _hoverItem(0)
{
Q_ASSERT(model);
QModelIndex index = model->index(row, ChatLineModel::ContentsColumn);
{
Q_ASSERT(model);
QModelIndex index = model->index(row, ChatLineModel::ContentsColumn);
@@
-247,14
+248,17
@@
void ChatLine::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
void ChatLine::hoverEnterEvent(QGraphicsSceneHoverEvent *event) {
ChatItem *item = mouseEventTargetItem(event->pos());
void ChatLine::hoverEnterEvent(QGraphicsSceneHoverEvent *event) {
ChatItem *item = mouseEventTargetItem(event->pos());
- if(item)
+ if(item) {
+ Q_ASSERT(!_hoverItem);
+ _hoverItem = item;
item->hoverEnterEvent(event);
item->hoverEnterEvent(event);
+ }
}
void ChatLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) {
}
void ChatLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) {
-
ChatItem *item = mouseEventTargetItem(event->pos()
);
- if(item)
-
item->hoverLeaveEvent(event)
;
+
Q_ASSERT(_hoverItem
);
+ _hoverItem->hoverLeaveEvent(event);
+
_hoverItem = 0
;
}
void ChatLine::hoverMoveEvent(QGraphicsSceneHoverEvent *event) {
}
void ChatLine::hoverMoveEvent(QGraphicsSceneHoverEvent *event) {