PyQT: QDialog and QMainWindow interacting with each other

F

Fabian Steiner

Hello!

I have got a QMainWindow with a QListView, in which the different
entries of a database are shown to the user. Moreover it has got a
QPushButton, so that another QDialog can be opened where the user is
able to add a new entry:

....

self.connect(self.btnNew, SIGNAL('clicked()'), self.openNewDialog)
....

def openNewDialog(self):
dialog = MyDialog(self)
dialog.show()
self.showListViewItems() # this line isn't recognized


MyDialog is closed by calling MyDialog.accept(). What can I do so that
self.showListViewItems() is called after MyDialog has been closed?

Thank you for any input!

Cheers,
Fabian Steiner
 
K

Kai Teuber

Fabian said:
MyDialog is closed by calling MyDialog.accept(). What can I do so that
self.showListViewItems() is called after MyDialog has been closed?

Thank you for any input!


Hi Fabian,

override the accept() method and call self.showListViewItems() there.
But remember to call QDialog.accept() at the end.

def accept( self ):
self.showListViewItems()
QDialog.accept( self )


Kai Teuber
 
F

Fabian Steiner

Hi Kai!

Kai said:
> Hi Fabian,

override the accept() method and call self.showListViewItems() there.
But remember to call QDialog.accept() at the end.

def accept( self ):
self.showListViewItems()
QDialog.accept( self )


Thank you very much, I got it working :)

Cheers,
Fabian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top