A folderview QGraphicsView related bug

Mark markg85 at gmail.com
Sun May 20 18:55:33 UTC 2012


On Fri, May 18, 2012 at 8:28 PM, Ignat Semenov <
ignat.semenov at blue-systems.com> wrote:

> Hello fellow plasma devs and users!
>
> Let me apologise for the long break, now I'm back to some intense bug
> fixing.
>
> Currently I'm investigating this bug in folderview:
>
> Sometimes folder peek popups appear at (0,0) (upper left corner of the
> screen)
> instead of a position depending on the relevant icon. Quickly narrowed the
> issue down to IconView::openPopup (iconview.cpp:2672). First, it computes
> the
> popup point relative to the icon view then it tries to find a
> QGraphicsView to
> map the point to. The bug occurs when the second branch of
>
> if (m_popupCausedWidget)
>
> is executed, i.e. when m_popupCausedWidget is false (if we're not
> dragging, it
> is false). In that second branch, all the views in the scene are iterated
> to
> find the view under mouse:
>
> foreach (QGraphicsView *view, scene()->views()) {
>            qDebug() << "view"' << view;
>            if (view->underMouse()) {
>                gv = view;
>                break;
>            }
>
> Now according to the docs for QGraphicsView::underMouse(), it returns an
> invalid value only if we're dragging, which is handled in the first
> branch. In
> practice, sometimes, none of the views returns true, and gv remains 0,
> which
> leads to the point being calculated as (0,0):
>
> const QPoint pos = gv ? gv->mapToGlobal(gv->mapFromScene(scenePos)) :
> QPoint();
>
> The debug output reads:
>
> view QGraphicsView(0x19b2ae0)
> view QGraphicsView(0x2193580)
> view QGraphicsView(0x1fd88b0)
> view PanelView(0x21c6dc0)
> view DesktopView(0x1837010)
> gv DesktopView(0x1837010)
>
> These are the views being checked in openPopup(). Sometimes, when the bug
> occurs, none of those returns true in underMouse().
>
> Now the questions are:
> 1)Why do we need to iterate through the views like this? Anything more
> elegant
> in the Plasma library?
> 2)Any ideas when underMouse() might fail like this when not dragging?
> Seems to
> be completely random.
>
> Basically, we need to change the iteration loop to something more
> reliable, and
> that will fix the bug.
>
> Best regards,
> Ignat Semenov
> _______________________________________________
> Plasma-devel mailing list
> Plasma-devel at kde.org
> https://mail.kde.org/mailman/listinfo/plasma-devel
>

I don't know the code so this is mainly based on assumptions..
When you hover an item it's visible (icon changes/highlight/whatever) so
isn't there some signal that emits the current QGraphicsView pointer? That
would solve the loop issue and make it neater i guess.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20120520/22d40cdc/attachment.html>


More information about the Plasma-devel mailing list