[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyKDE] Issue with QDialog and lifetime
From:       "Giovanni Bajo" <rasky () develer ! com>
Date:       2005-05-26 12:16:56
Message-ID: 00e801c561ec$cf6e0fc0$bf03030a () trilan
[Download RAW message or body]

Toby Dickenson <tdickenson@devmail.geminidataloggers.co.uk> wrote:

>> class QDialog2(QDialog):
>>    def __init__(self, parent=0, name=0, modal=False, flags=0)
>>        QDialog.__init__(self, parent, name, modal, flags |
>> Qt.WDestructiveClose)

Actually, for my project, I'm better off with:

class QDialog2(QDialog):
   def __init__(self, parent=0, name=0, modal=False, flags=0)
        if modal:
            flags |= Qt.WDestructiveClose
       QDialog.__init__(self, parent, name, modal, flags)

Becuase modeless dialogs really need their ownership to be transferred to
the parent.

> That works, but Im not sure I would recommend it. It leads to a bigger
change
> should you ever need to access the dialog after it has been closed. (or,
more
> likely, the value of a control widget on the dialog)

Notice that WDestructiveClose does not collect the Python object (of
course). So you can easily do something like:

class MyDialog(QDialog2):
     # bla bla

     def accept(self):
         self.value = self.lineedit.text()

and then later access that string.
-- 
Giovanni Bajo

_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic