Moving IconApplets when clicking on the icon
Christopher Blauvelt
cblauvelt at gmail.com
Thu Jan 3 05:59:12 CET 2008
On Jan 2, 2008 10:45 PM, Jason Stubbs <jasonbstubbs at gmail.com> wrote:
> On Thursday 03 January 2008 13:20:15 JST, Christopher Blauvelt wrote:
> > Attached is a patch which will allow you to move icons when clicking on
> the
> > icon itself rather than just the clicking on the handle. This time with
> > fewer style violations. :)
>
>
> - if (boundingRect().contains(event->pos())) {
> - if (~d->states & Private::HoverState) {
> - d->states |= Private::HoverState;
> - update();
> - }
> - } else {
> - if (d->states & Private::HoverState) {
> - d->states &= ~Private::HoverState;
> - update();
> - }
> - }
> + d->states |= Private::MovedState;
>
>
> Why is the HoverState stuff being removed? In fact, it looks like none of
> the
> libs/plasma/widgets/icon.* changes are necessary...
The hover state is removed because the icon now moves with the cursor. You
don't have to worry about the cursor not being on the icon during a
mouseMoveEvent.
>
>
> +#include <plasma/corona.h>
>
>
> This also doesn't look necessary...
You're right it's not. I meant to remove it before submitting.
>
>
>
> - double width = qBound(minimumSize().width(), iconSize.width(),
> maximumSize().width());
> - double height = qBound(minimumSize().height(), iconSize.height(),
> maximumSize().height());
> + qreal width = qBound(minimumSize().width(), iconSize.width(),
> maximumSize().width());
> + qreal height = qBound(minimumSize().height(), iconSize.height(),
> maximumSize().height());
>
>
> These sorts of changes (while correct) make patches harder to review.
>
>
> + QGraphicsItem* appletHandle = parentItem();
> +
> + if(appletHandle) {
> + //don't move the icon as well because appletHandle will do it for
> us
> + appletHandle->moveBy(delta.x(),delta.y());
>
>
> I haven't tested this, but it looks like this would move the entire panel
> when
> dragging an icon applet that's within the panel. I wonder if AppletHandle
> can't listen for position changes somehow and update itself...
You're right it does. So either there needs to be a way to tell if we have
an applethandle or not or applethandle needs to be able to respond to applet
moves.
>
> --
> Jason Stubbs
> _______________________________________________
> Panel-devel mailing list
> Panel-devel at kde.org
> https://mail.kde.org/mailman/listinfo/panel-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/panel-devel/attachments/20080102/10919739/attachment.html
More information about the Panel-devel
mailing list