Results 1 to 3 of 3

Thread: QCloseEvent

  1. #1
    Join Date
    Jun 2009
    Posts
    8
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question QCloseEvent

    I am trying to use 'QCloseEvent', but get this error:
    Qt Code:
    1. board.cpp:180: error: invalid use of incomplete type ‘struct QCloseEvent’
    2. /usr/include/qt4/QtGui/qwidget.h:83: error: forward declaration of ‘struct QCloseEvent’
    To copy to clipboard, switch view to plain text mode 

    This is the code I am using ( in board.cpp):
    Qt Code:
    1. void Board::closeEvent(QCloseEvent *event){
    2. //some code
    3. event->accept();
    4. //some more code
    5. }
    To copy to clipboard, switch view to plain text mode 

    in board.h I have:
    Qt Code:
    1. protected:
    2. void closeEvent(QCloseEvent *event);
    To copy to clipboard, switch view to plain text mode 

    Does anyone know what I have done wrong?

    Any help is appreciated.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QCloseEvent

    use
    Qt Code:
    1. #include <QCloseEvent>
    To copy to clipboard, switch view to plain text mode 
    in your code.

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

    sparticus_37 (3rd March 2011)

  4. #3
    Join Date
    Jun 2009
    Posts
    8
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCloseEvent

    Thanks, that works fine.

Similar Threads

  1. Forward Declaration of struct QCloseEvent ????
    By drake1983 in forum Newbie
    Replies: 2
    Last Post: 3rd February 2009, 15:16
  2. Event handling problem
    By Mel Seyle in forum Qt Programming
    Replies: 2
    Last Post: 23rd August 2007, 04:15

Tags for this Thread

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.