Results 1 to 6 of 6

Thread: close window signal

  1. #1
    Join Date
    Apr 2009
    Location
    Valencia (Spain)
    Posts
    245
    Thanks
    38
    Thanked 19 Times in 19 Posts
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default close window signal

    hi, what's the signal emited when the user closes a QDialog by pressing ESC or clicking the upper-right close button?

    thanks!

  2. #2
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: close window signal

    Quote Originally Posted by jano_alex_es View Post
    hi, what's the signal emited when the user closes a QDialog by pressing ESC or clicking the upper-right close button?

    thanks!
    reimplement the closeEvent();
    void closeEvent(QCloseEvent *event);

    inside the virtual function
    emit your own signal
    ex:
    signals:
    void dialogClosed();

    dialog::closeEvent(QCloseEvent *event)
    {
    emit dialogClosed();
    event->accept();
    }
    "Behind every great fortune lies a crime" - Balzac

  3. The following user says thank you to wagmare for this useful post:

    jano_alex_es (21st May 2009)

  4. #3
    Join Date
    Apr 2009
    Location
    Valencia (Spain)
    Posts
    245
    Thanks
    38
    Thanked 19 Times in 19 Posts
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default Re: close window signal

    it works fine in some forms but in other I have the next error message

    "use of undefined type 'QKeyEvent'"

    I don't see any diferences between my forms, and the includes are the same... but the wrong ones let me compile if I add the "ui_FormThatWorksOK.h" include :S

  5. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: close window signal

    just include #include <QKeyEvent> in cpp-file and add forward declaration class QKeyEvent in h-file.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  6. #5
    Join Date
    Apr 2009
    Location
    Valencia (Spain)
    Posts
    245
    Thanks
    38
    Thanked 19 Times in 19 Posts
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default Re: close window signal

    uop! thanks! But I feel sorry... I paste my message here by mistake :P (it was supossed to be an email!)

    anyway, thanks again!

  7. #6
    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: close window signal

    J-P Nurmi

Similar Threads

  1. pthread instead QThread
    By brevleq in forum Qt Programming
    Replies: 8
    Last Post: 23rd December 2008, 07:16
  2. Connection of custon signals/slots
    By brevleq in forum Qt Programming
    Replies: 2
    Last Post: 23rd December 2008, 07:04
  3. How to close parent window from child window?
    By montylee in forum Qt Programming
    Replies: 5
    Last Post: 14th October 2008, 11:40
  4. Replies: 11
    Last Post: 15th July 2008, 13:11
  5. Replies: 3
    Last Post: 23rd July 2006, 18:02

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.