2

1) I am creating a Qwidget Form or QDialogBox using QT Designer. I am using the following code to move the form:

sDialog.move(50,450)

But i want to fit the dialogBox to fit in the left corner.How can i do that using Python programming?

2) When i am using the Canvas events if i click on the map dialogBox/Form is hiding but i want to fit the position so if we do any thing on the map also the DialogBox should nt hide.How can i do that using python programming?

4

I'll answer the question that is stated in the title.

You can use the following code to show your dialog in the bottom-left corner (do all this right before the call to self.dlg.show()):

    ph = self.dlg.parent().geometry().height()
    px = self.dlg.parent().geometry().x()
    py = self.dlg.parent().geometry().y()
    dw = self.dlg.width()
    dh = self.dlg.height()   
    self.dlg.setGeometry( px, py+ph-dh, dw, dh )

If you want your dialog at the top-left corner, change the second parameter of setGeometry() to py.

As for your second question, I cannot replicate that. Have a look at my plugin Synchronize QGIS with a directory, the dialog is not hidden when I interact with the map via map tools.


By the way, you should really ask a single question per post. Otherwise you discourage people to answer your questions.

  • Thank you for your answer.But i am using this method also to position the dialog but i want to fit box in the main window itself.How can i do that? offset_x = 50 offset_y = 450 sDialog.setGeometry(offset_x, offset_y, 212, 190) – user99 Feb 11 '15 at 6:17
  • 1
    Thanks @gcarrillo your plugin reference has solved my issue. Thank u so much – user99 Feb 11 '15 at 9:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.