[Qt-interest] X button does not close modeless dialog

Stephen Jackson spjackson42 at gmail.com
Fri Sep 4 09:24:50 CEST 2009


On Fri, Sep 4, 2009 at 3:40 AM, Malyushytsky, Alex wrote:
> Hi,
>
> After upgrading to QT 4.5.2 on Linux (CentOS, gcc, kde 3.5.4),
> my modeless dialogs stopped closing when user click x button at the top right corner of the dialog.
> Simple test code can be found in the zipped attachment.
> Build, run, click /Edit/Show Modeless dialog, click the X button.
>
> In short, all I do is creating an instance of the dialog with a few attributes.
> Also 3 functions are overridden. In example they are simply calling base class prototypes as below.
>
> FlexModelessDialogBase::FlexModelessDialogBase(QWidget * parent)
> : QDialog (parent, Qt::Dialog | Qt::WindowMinimizeButtonHint| Qt::WindowSystemMenuHint )
> {
>        this->setAttribute( Qt::WA_DeleteOnClose );
> }
>
> I would appreciate, if anybody could test it and say, if the dialog is closing on his (Linux) system.
>

When I build and run your code on my Linux system (Kubuntu 9.04, Qt
4.5.1, kde 4.1.4), no close button appears on the title bar.
Furthermore, in the system menu, Close is disabled.

If I change your window flags to include Qt::WindowCloseButtonHint,
the close button then appears and works correctly. I suggest you try
this.

-- 
Regards,

Stephen Jackson




More information about the Qt-interest-old mailing list