How to retrieve location from plasmoid

Onur-Hayri Bakici thehayro at gmail.com
Tue Aug 23 21:50:16 UTC 2011


> On Tuesday 23 August 2011, Onur-Hayri Bakici wrote:
> > 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);
> >     
> >     }
> >   
> >   }
> > 
> > }
> 
> better using btn..
> anyways, you should position it on every mouse click, before showing it, so
> in onClicked: {
>        var pos = popupPosition(btn);
>        dialog.x = pos.x
>        dialog.y = pos.y
>        dialog.visible = true;
> }
> 
> also, exactly why you are making it a dock?
I am implementing the currentappcontrol in qml :)


More information about the Plasma-devel mailing list