Results 1 to 4 of 4

Thread: [SOLVED] How to close a dialog window (it's a little too modal)

  1. #1
    Join Date
    Feb 2006
    Posts
    209
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default [SOLVED] How to close a dialog window (it's a little too modal)

    Hi.
    I'm using the Qt designer to create a dialog. I've added two buttons by hand, one Ok and one Cancel button.
    with the signal slot editor I've connected the cancel buttons clicked() signal to the reject() slot of the dialog.
    Clicking on the button when running the dialog has no effect. Not even clicking the windows "x" button in the window bar will close the window.

    I show the dialog with a call

    myDialog* dialog = new myDialog();
    dialog->exec();

    so what have I've done wrong?
    The dialog is set to ApplicationModal.
    (In the designer there is another modal button that can be checked in the propertyeditor for the QDialog)


    Btw. what has happend to the qt-interest mailinglist?
    Last edited by Morea; 1st February 2009 at 13:19. Reason: Problem solved

  2. #2
    Join Date
    Nov 2008
    Posts
    142
    Thanks
    3
    Thanked 20 Times in 20 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to close a dialog window (it's a little too modal)

    That's really odd behaviour. My first guess was that something went wrong when connecting the "clicked()" signal, but it's strange that even the window's close button shows no effect. Are you tampering with window flags in your dialog? Maybe you could post the code in question, it will probably help to find the source of the problem.

  3. #3
    Join Date
    Feb 2006
    Posts
    209
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default [SOLVED] Re: How to close a dialog window (it's a little too modal)

    Well... I'll be damned...
    It seems that I implemented a function called done(int) and that was not very clever...

    Now it works. I don't know exactly why, but I'll never write a done(int) function again.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: [SOLVED] Re: How to close a dialog window (it's a little too modal)

    Quote Originally Posted by Morea View Post
    I don't know exactly why, but I'll never write a done(int) function again.
    QDialog::done(int) happens to be virtual...
    J-P Nurmi

Similar Threads

  1. How to close parent window from child window?
    By montylee in forum Qt Programming
    Replies: 5
    Last Post: 14th October 2008, 11:40
  2. Modal dialog not behaving
    By tpf80 in forum Qt Programming
    Replies: 7
    Last Post: 16th September 2008, 22:03
  3. How to make window semi modal
    By kaushal_gaurav in forum Qt Programming
    Replies: 7
    Last Post: 29th August 2008, 08:27
  4. Replies: 3
    Last Post: 23rd July 2006, 18:02
  5. cannot make a main window modal
    By Dark_Tower in forum Qt Programming
    Replies: 12
    Last Post: 23rd March 2006, 10:21

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.