it's perfectly valid to get no view at a random screen position; not all plasma apps are full screen after all
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=862097
This commit is contained in:
parent
1459f1cd32
commit
2a979b4e00
@ -207,7 +207,9 @@ class ExtenderItemPrivate
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_ASSERT(found);
|
if (!found) {
|
||||||
|
return QPointF();
|
||||||
|
}
|
||||||
|
|
||||||
return found->mapToScene(found->mapFromGlobal(pos));
|
return found->mapToScene(found->mapFromGlobal(pos));
|
||||||
}
|
}
|
||||||
@ -706,7 +708,11 @@ void ExtenderItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
setZValue(parentApplet->zValue());
|
setZValue(parentApplet->zValue());
|
||||||
|
|
||||||
if (d->extender) {
|
if (d->extender) {
|
||||||
d->extender->itemHoverMoveEvent(this, d->extender->mapFromScene(d->scenePosFromScreenPos(event->screenPos())));
|
QPointF mousePos = d->scenePosFromScreenPos(event->screenPos());
|
||||||
|
|
||||||
|
if (!mousePos.isNull()) {
|
||||||
|
d->extender->itemHoverMoveEvent(this, d->extender->mapFromScene(mousePos));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
d->extender->d->removeExtenderItem(this);
|
d->extender->d->removeExtenderItem(this);
|
||||||
@ -785,18 +791,21 @@ void ExtenderItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
|
|
||||||
//find the extender we're hovering over.
|
//find the extender we're hovering over.
|
||||||
Extender *targetExtender = 0;
|
Extender *targetExtender = 0;
|
||||||
foreach (Containment *containment, corona->containments()) {
|
|
||||||
foreach (Applet *applet, containment->applets()) {
|
|
||||||
if (applet->d->extender &&
|
|
||||||
(applet->sceneBoundingRect().contains(mousePos) ||
|
|
||||||
applet->d->extender->sceneBoundingRect().contains(mousePos))) {
|
|
||||||
targetExtender = applet->d->extender;
|
|
||||||
|
|
||||||
//check if we're hovering over an popupapplet, and open it up in case it does.
|
if (!mousePos.isNull()) {
|
||||||
PopupApplet *popupApplet = qobject_cast<PopupApplet*>(applet);
|
foreach (Containment *containment, corona->containments()) {
|
||||||
if (popupApplet && (applet->formFactor() == Plasma::Horizontal ||
|
foreach (Applet *applet, containment->applets()) {
|
||||||
applet->formFactor() == Plasma::Vertical)) {
|
if (applet->d->extender &&
|
||||||
popupApplet->showPopup();
|
(applet->sceneBoundingRect().contains(mousePos) ||
|
||||||
|
applet->d->extender->sceneBoundingRect().contains(mousePos))) {
|
||||||
|
targetExtender = applet->d->extender;
|
||||||
|
|
||||||
|
//check if we're hovering over an popupapplet, and open it up in case it does.
|
||||||
|
PopupApplet *popupApplet = qobject_cast<PopupApplet*>(applet);
|
||||||
|
if (popupApplet && (applet->formFactor() == Plasma::Horizontal ||
|
||||||
|
applet->formFactor() == Plasma::Vertical)) {
|
||||||
|
popupApplet->showPopup();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -869,12 +878,14 @@ void ExtenderItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
|
|
||||||
corona->removeOffscreenWidget(this);
|
corona->removeOffscreenWidget(this);
|
||||||
|
|
||||||
foreach (Containment *containment, corona->containments()) {
|
if (!mousePos.isNull()) {
|
||||||
foreach (Applet *applet, containment->applets()) {
|
foreach (Containment *containment, corona->containments()) {
|
||||||
if (applet->d->extender &&
|
foreach (Applet *applet, containment->applets()) {
|
||||||
(applet->sceneBoundingRect().contains(mousePos) ||
|
if (applet->d->extender &&
|
||||||
applet->d->extender->sceneBoundingRect().contains(mousePos))) {
|
(applet->sceneBoundingRect().contains(mousePos) ||
|
||||||
targetExtender = applet->d->extender;
|
applet->d->extender->sceneBoundingRect().contains(mousePos))) {
|
||||||
|
targetExtender = applet->d->extender;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -891,12 +902,14 @@ void ExtenderItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
//TODO: maybe we alow the user to choose a default extenderapplet.
|
//TODO: maybe we alow the user to choose a default extenderapplet.
|
||||||
kDebug() << "Instantiate a new ExtenderApplet";
|
kDebug() << "Instantiate a new ExtenderApplet";
|
||||||
mousePos = d->scenePosFromScreenPos(event->screenPos() - d->mousePos);
|
mousePos = d->scenePosFromScreenPos(event->screenPos() - d->mousePos);
|
||||||
foreach (Containment *containment, corona->containments()) {
|
if (!mousePos.isNull()) {
|
||||||
if (containment->sceneBoundingRect().contains(mousePos)) {
|
foreach (Containment *containment, corona->containments()) {
|
||||||
Applet *applet = containment->addApplet("internal:extender",
|
if (containment->sceneBoundingRect().contains(mousePos)) {
|
||||||
QVariantList(),
|
Applet *applet = containment->addApplet("internal:extender",
|
||||||
QRectF(mousePos, size()));
|
QVariantList(),
|
||||||
setExtender(applet->d->extender);
|
QRectF(mousePos, size()));
|
||||||
|
setExtender(applet->d->extender);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user