[PyKDE] modal dialog SLOT problem

Andreas Pakulat apaku at gmx.de
Mon Oct 9 20:41:28 BST 2006


On 09.10.06 20:20:22, Dave S wrote:
> I have aQT4  modal dialog and I need to know which of the three buttons have 
> been pressed. accept() & reject() are OK for two buttons giving me 0 & 1.
> 
> For the third I googled & read and thought of ...
> 
>  
>             justify_dialog = QtGui.QDialog(self)
>             os.chdir(self.config.get('paths','dialogs'))  # Use 'os.chdir' 
> else ui PNGs are lost
>             uic.loadUi('justify.ui', justify_dialog)

> I know I am on the right track because

IMHO not really.

Try this:

create a subclass from QDialog and the form and implement 3 slots,
connect each slot to one of the buttons. Then in each slot set a member
variable of self to 0, 1 or 2 and then call accept or reject
accordingly.

After dialog_instance.exec_() returned you can check the member variable
of dialog_instance to know which button was pressed.

I don't think your idea can work, because your slot is executed after
exec_() has finished.

Andreas

-- 
You will meet an important person who will help you advance professionally.




More information about the PyQt mailing list