How to retrieve location from plasmoid
Onur-Hayri Bakici
thehayro at gmail.com
Tue Aug 23 10:24:09 UTC 2011
> On Tuesday 23 August 2011, Onur-Hayri Bakici wrote:
> > > On Tuesday, August 23, 2011 10:35:18 Onur-Hayri Bakici wrote:
> > > > is there any way to get the x,y position of plasmoids using
> > > > javascript?
> > >
> > > You mean on the screen? No, by design it's not possible.
> > >
> > > What do you want to achieve?
> >
> > I want to let a PlasmaCore.Dialog to appear underneath the applet. I use
> > QML. For the right position I need the x,y coordinates.
>
> use the popupposition method of PlasmaCore.Dialog
>
> never never ever try to calculate this kind of stuff by hand
Thanks for the quick response. However I still cannot go any further.
Since popupPosition gets a QGraphicsObject but always returns an emty QPoint.
A little example of what I did.
Item {
PlasmaWidgets.PushButton {
id: btn
text: "press me"
onClicked: {
dialog.visible = true;
}
}
PlasmaCore.Dialog {
id: dialog
Component.onCompleted: {
setAttribute(Qt.WA_X11NetWmWindowTypeDock, true);
var pos = popupPosition(parent); // or popupPosition(btn)?
print("QPoint: " + pos.x + "," + pos.y);
}
}
}
Can you tell me whats wrong with this code?
Thanks in advance.
More information about the Plasma-devel
mailing list