I have made a gui in QTDesigner for QGIS2.10 (as a dialog). When I press the ok button (if result == QtGui.QFileDialog.Accepted:) everything works just fine but the gui is disappeared. How can the gui stay there - be visible till all the work is done (it is set to be on top)? Do I need something like a timer or should I look for some kind of relative property?

  • 3
    You can add a simple QPushButton, then connect a function to do the stuff to the clicked signal. At the end of that function just close dialog.
    – dmh126
    Commented Nov 18, 2015 at 19:09

1 Answer 1


As dmh126 said, you can work with signals and events.

Let's say you have a QPushButton called runButton labelled as "OK" or anything. Put the following line at the end of the initGui function:

self.dlg.runButton.clicked.connect( self.onStart )

(replacing dlg with whatever applies to you).

The declare a onStart function that will call your main function :

def onStart(self):

That should do the trick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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