no more popup position; this is handled by the GSS
This commit is contained in:
parent
7d0de68cd4
commit
cf2858a893
@ -255,42 +255,6 @@ bool isNonSceneEvent(QEvent *event)
|
||||
return dynamic_cast<QEvent *>(event) == 0;
|
||||
}
|
||||
|
||||
QPoint ContainmentActions::popupPosition(const QSize &s, QEvent *event)
|
||||
{
|
||||
if (isNonSceneEvent(event)) {
|
||||
return screenPosFromEvent(event);
|
||||
}
|
||||
|
||||
Containment *c = containment();
|
||||
if (!c) {
|
||||
return screenPosFromEvent(event);
|
||||
}
|
||||
|
||||
//TODO: port to new architecture
|
||||
Applet *applet = 0;//c->d->appletAt(scenePosFromEvent(event));
|
||||
QPoint screenPos = screenPosFromEvent(event);
|
||||
QPoint pos = screenPos;
|
||||
if (applet && containment()->d->isPanelContainment()) {
|
||||
pos = applet->popupPosition(s);
|
||||
if (event->type() != QEvent::ContextMenu ||
|
||||
static_cast<QContextMenuEvent *>(event)->reason() == QContextMenuEvent::Mouse) {
|
||||
// if the menu pops up way away from the mouse press, then move it
|
||||
// to the mouse press
|
||||
if (c->formFactor() == Vertical) {
|
||||
if (pos.y() + s.height() < screenPos.y()) {
|
||||
pos.setY(screenPos.y());
|
||||
}
|
||||
} else if (c->formFactor() == Horizontal) {
|
||||
if (pos.x() + s.width() < screenPos.x()) {
|
||||
pos.setX(screenPos.x());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
void ContainmentActions::setContainment(Containment *newContainment) {
|
||||
d->containment = newContainment;
|
||||
}
|
||||
|
@ -160,16 +160,6 @@ class PLASMA_EXPORT ContainmentActions : public QObject
|
||||
*/
|
||||
static QString eventToString(QEvent *event);
|
||||
|
||||
/**
|
||||
* Returns a popup position appropriate to the event and the size.
|
||||
*
|
||||
* @param s size of the popup
|
||||
* @param event a pointer to the event that triggered the popup
|
||||
* @return the preferred top-left position for the popup
|
||||
* @since 4.6
|
||||
*/
|
||||
QPoint popupPosition(const QSize &s, QEvent *event);
|
||||
|
||||
/**
|
||||
* @p newContainment the containment the plugin should be associated with.
|
||||
* @since 4.6
|
||||
|
Loading…
Reference in New Issue
Block a user