I did what you told, and the errors that had to do with 'connect' are gone. I also moved the
function bodies outside the class declarations, but i still get this error:
Qt Code:
  1. main.cpp: In member function ‘void UI::exit()’:
  2. main.cpp:30: error: invalid use of incomplete type ‘struct application’
  3. main.cpp:6: error: forward declaration of ‘struct application’
To copy to clipboard, switch view to plain text mode 

This is the code:
Qt Code:
  1. #include <QtGui/QApplication>
  2. #include <QtGui/QMainWindow>
  3. #include <QtGui/QPushButton>
  4. #include <QtCore/QObject>
  5.  
  6. class application;
  7.  
  8.  
  9. class UI : public QObject {
  10. Q_OBJECT
  11. public:
  12. UI( application* );
  13. public slots:
  14. void exit();
  15. private:
  16. application* app;
  17. QMainWindow* frame;
  18. QPushButton* button;
  19. };
  20.  
  21. UI::UI( application* a ){
  22. app = a;
  23. frame = new QMainWindow;
  24. button = new QPushButton( frame );
  25. connect( button, SIGNAL( clicked() ), this, SLOT( exit()) );
  26. frame -> show();
  27. }
  28.  
  29. void UI::exit( ) {
  30. app->exit();
  31. }
  32. /*******************************************************************/
  33. class application {
  34. public:
  35. application( int , char** ) ;
  36.  
  37. void exit( int = 0 );
  38. private:
  39. QApplication* qapp;
  40. UI* ui;
  41. };
  42.  
  43. application::application( int argc, char** argv) {
  44. qapp = new QApplication( argc, argv);
  45. ui = new UI( this);
  46. qapp -> exec();
  47. }
  48.  
  49. void application::exit( int code ){
  50. qapp->exit(code);
  51. exit(code);
  52. }
  53. /******************************************************************/
  54. int main( int argc, char** argv ){
  55. application( argc, argv );
  56. return 0;
  57. }
To copy to clipboard, switch view to plain text mode 

hannesvdc