Results 1 to 3 of 3

Thread: Forward Declaration of struct QCloseEvent ????

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2007
    Posts
    31
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Forward Declaration of struct QCloseEvent ????

    Hi everybody!!!
    I have a problem using QCloseEvent inside a Widget .When I'm try to compile my program I get two errors:
    - invalid use of incomplete type 'struct QCloseEvent'
    - forward declaration of 'struct QCloseEvent'

    I have read the Qt4 Doc about closeEvent but I can find the problem.


    This is my widget.h
    Qt Code:
    1. #ifndef WIDGET_H
    2. #define WIDGET_H
    3.  
    4. #include <QtGui/QWidget>
    5.  
    6. namespace Ui
    7. {
    8. class WidgetClass;
    9. }
    10.  
    11. class Widget : public QWidget
    12. {
    13. Q_OBJECT
    14.  
    15. public:
    16. Widget(QWidget *parent = 0);
    17. ~Widget();
    18.  
    19. protected:
    20. void closeEvent( QCloseEvent *event);
    21. private:
    22. Ui::WidgetClass *ui;
    23. };
    24.  
    25. #endif // WIDGET_H
    To copy to clipboard, switch view to plain text mode 

    and this my widget.cpp
    Qt Code:
    1. #include "widget.h"
    2. #include "ui_widget.h"
    3.  
    4. Widget::Widget(QWidget *parent)
    5. : QWidget(parent), ui(new Ui::WidgetClass)
    6. {
    7. ui->setupUi(this);
    8. }
    9.  
    10. Widget::~Widget()
    11. {
    12. delete ui;
    13. }
    14.  
    15. void Widget::closeEvent(QCloseEvent *event)
    16. {
    17. event->ignore();
    18. }
    To copy to clipboard, switch view to plain text mode 


    Any help?
    Thanks!!!
    Last edited by drake1983; 3rd February 2009 at 06:08. Reason: reformatted to look better

Similar Threads

  1. error: forward declaration of 'struct QPushButton'
    By prykHetQuo in forum Qt Programming
    Replies: 2
    Last Post: 23rd January 2009, 23:20
  2. Replies: 16
    Last Post: 23rd May 2008, 10:12
  3. problem with forward declaration
    By MarkoSan in forum General Programming
    Replies: 14
    Last Post: 6th January 2008, 21:45
  4. Make error with Qt Jambi 4.3.2_01
    By pamalite in forum Installation and Deployment
    Replies: 0
    Last Post: 22nd November 2007, 12:05
  5. Forward declaration with std namespace
    By Raistlin in forum General Programming
    Replies: 2
    Last Post: 5th March 2007, 20:45

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
  •  
Qt is a trademark of The Qt Company.