How to retrieve location from plasmoid

Marco Martin notmart at gmail.com
Tue Aug 23 10:39:05 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?

-- 
Marco Martin


More information about the Plasma-devel mailing list