[PySide] Frameless dialog does not show

Ludo Visser l.c.visser at science-applied.nl
Wed Jul 25 12:48:35 CEST 2012


That works like a charm, thanks!
Is there an explanation why it should be done in this way?

Best,
Ludo

On Jul 25, 2012, at 12:16 pm, Juande Manjon wrote:

> Try to set the windows flag in the constructor
> 
> class ModalDialog(QtGui.QDialog):
>     def __init__(self, *args, **kwargs):
> 
>         kwargs['f'] = QtCore.Qt.FramelessWindowHint
>         QtGui.QDialog.__init__(self, *args, **kwargs)        
>         
>         #self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
> 
> 
> Regards
> Juande
> 
> 
> El 25/07/2012 11:18, Ludo Visser escribió:
>> Hi,
>> 
>> I'm trying to create a modal frameless window, because I don't want the user the
>> possibility to move the window or accidentally close it. However, there seems to
>> be an issue with my understanding of QDialogs.
>> 
>> I have attached two snippets that illustrate my problem. The first example
>> ('works-as-expected.py') shows the dialog as I intend to have it. The second
>> snippet ('does-not-work-as-expected.py') fails to do what I want: it doesn't
>> show the dialog.
>> 
>> Some things I have noticed in debugging this issue:
>> 1) If I comment out line 12:
>>       self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
>>    everything works fine!
>> 2) From my understanding of the documentation of QDialog, setting the parent of
>>    a top-level window  should result in the dialog being centered on top of its
>>    parent. However, setting the parent has no effect in this case.
>> 3) In the application I work on, I can see a little bit of the dialog peeking
>>    through the parent's layout: it seems the dialog has become a widget embedded
>>    in the parent somehow. I cannot reproduce this behavior in this simplified
>>    example.
>> 4) I have the same issue with PyQt4, so I don't think it is a bug in PySide.
>> 
>> Any ideas? I'm using Python 2.7 + PySide 1.1.0.
>> 
>> Best regards,
>> Ludo Visser
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> PySide mailing list
>> 
>> PySide at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/pyside
> 

-- 
Ludo C. Visser, M.Sc.
Science Applied
phone: +31 6 1066 3076
e-mail: l.c.visser at science-applied.nl
web: www.science-applied.nl




More information about the PySide mailing list