Review Request 116028: Add a hover effect for the selection toggle.
Emmanuel Pescosta
emmanuelpescosta099 at gmail.com
Wed Feb 26 17:15:54 GMT 2014
> On Feb. 26, 2014, 5:28 p.m., Frank Reininghaus wrote:
> > Thanks for analyzing this problem.
> >
> > I actually thought that QGraphicsView/QGraphicsScene send hover events not only to one item (the KItemListView, which lets KItemListController handle its events), but also to other items (which may be children of another item), like the selection toggle (indirect child of the KItemListView) in our case. Is that wrong? I found nothing in the QGraphics* docs that says that children will not get hover events anymore if their parent receives and handles hover events.
> Is that wrong?
Yes it forwards the events to the children, but when you override the event function, you have to call the base::*Event to make it working.
Some time ago I worked with others on a project, where you can build networks (nodes, connections, ...), we did that with QGraphics*.
We had multiple editing modes (normal, connection, node adding, ...) and we made use of the event forwarding.
E.g. (no real world code):
void EditorGraphicsViewWidget::mousePressEvent(QMouseEvent* event)
{
switch (m_editMode) {
case NodeAdding:
/* code for node adding */
break;
case ConnectionAdding:
/* code */
break;
case Normal:
default:
QGraphicsView::mousePressEvent(event); // only these events are forwarded to the connections/nodes/other graphics items
}
}
I thinks it's the same with hover events. Always view -> widget -> child widget -> child child widget -> ...
void KItemListView::event(QEvent* event) does the event handling in Dolphin views, all events which can be processed in the controller aren't forwarded to the children.
The next thing is, every graphics item needs a bounding rect to make it working as far as I know (Dolphin doesn't implement this) - Dolphin has the controller for that, maybe to handle the to more complex item list widget bounding rects (icon bounding rect + text bounding rect + spacing between them).
- Emmanuel
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/116028/#review50959
-----------------------------------------------------------
On Feb. 24, 2014, 6:27 p.m., Emmanuel Pescosta wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/116028/
> -----------------------------------------------------------
>
> (Updated Feb. 24, 2014, 6:27 p.m.)
>
>
> Review request for Dolphin.
>
>
> Bugs: 299328
> http://bugs.kde.org/show_bug.cgi?id=299328
>
>
> Repository: kde-baseapps
>
>
> Description
> -------
>
> Add a hover effect for the selection toggle.
>
> The KItemListController handles all hover events, so we can't use the hoverMoveEvent in the KItemListWidget directly.
> Instead, if the current widget is valid, we set the widget hover position in KItemListController::hoverMoveEvent, so that the widget can react on it.
>
> KItemListSelectionToggle has setHovered instead of hoverEnterEvent/hoverLeaveEvent now, we set the hover state in
> KItemListWidget::setHoverPosition.
>
> The icon state toggles now between ActiveState and DisabledState (I hope these are the right states for this usecase)
>
>
> Diffs
> -----
>
> dolphin/src/kitemviews/kitemlistcontroller.cpp 7344b99
> dolphin/src/kitemviews/kitemlistwidget.h 954629d
> dolphin/src/kitemviews/kitemlistwidget.cpp 85cd70c
> dolphin/src/kitemviews/private/kitemlistselectiontoggle.h ba29293
> dolphin/src/kitemviews/private/kitemlistselectiontoggle.cpp 6bbf3c2
>
> Diff: https://git.reviewboard.kde.org/r/116028/diff/
>
>
> Testing
> -------
>
> Works.
>
>
> Thanks,
>
> Emmanuel Pescosta
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20140226/36bbf5c2/attachment.htm>
More information about the kfm-devel
mailing list