I am new to qt and I am trying to build a new project with QT. I have a nice GUI built in my login form and everything is compiling great until I try to connect my button to a function using signals and slots.

First I tried to use the QT editor. I would use the slots and signals editor and I couldn't figure out how to get it to my functions in my .cpp then I tried to do it outside of the editor by adding the connect button to my cpp and my header. I can get it to compile but i get an error saying "irst-chance exception at 0x670e98d8 in TheWGE.exe: 0xC0000005: Access violation reading location 0xffffffff.
Unhandled exception at 0x670e98d8 in TheWGE.exe: 0xC0000005: Access violation reading location 0xffffffff. BREAK OR CONTINUE"

this is my thewge.cpp

Qt Code:
  1. #include "thewge.h"
  2. #include <QtGui/QApplication>
  3. #include <QSignalMapper>
  4. #include <QPushButton>
  5.  
  6. TheWGE::TheWGE(QWidget *parent, Qt::WFlags flags)
  7. : QMainWindow(parent, flags)
  8. {
  9.  
  10. ui.setupUi(this);
  11.  
  12. QObject::connect(LoginBtn, SIGNAL(clicked()), this, SLOT(accept()));
  13.  
  14. }
  15.  
  16. TheWGE::~TheWGE()
  17. {
  18. //delete usrLineEdit;
  19. //delete pwdLineEdit;
  20. }
  21.  
  22. void TheWGE::readSettings()
  23. {
  24. //Set Focus to the right place
  25.  
  26. /* if (ui.usrLineEdit->text().trimmed().isEmpty() ) {
  27.   ui.usrLineEdit->setFocus();
  28.   } else {
  29.   ui.pwdLineEdit->setFocus();
  30.   } */
  31.  
  32. }
  33.  
  34. void TheWGE::accept()
  35. {
  36. //readSettings();
  37. }
To copy to clipboard, switch view to plain text mode 


my thewge.h

Qt Code:
  1. #ifndef THEWGE_H
  2. #define THEWGE_H
  3.  
  4. #include <QtGui/QMainWindow>
  5. #include "ui_thewge.h"
  6. #include <QPixmap>
  7. class TheWGE : public QMainWindow
  8. {
  9. Q_OBJECT
  10.  
  11.  
  12. public:
  13. TheWGE(QWidget *parent = 0, Qt::WFlags flags = 0);
  14. ~TheWGE();
  15.  
  16. private:
  17. Ui::TheWGEClass ui;
  18. QLineEdit* usrLineEdit;
  19. QLineEdit* pwdLineEdit;
  20. QPushButton* LoginBtn;
  21.  
  22. public slots:
  23.  
  24. void accept();
  25. void readSettings();
  26.  
  27. //QObject::connect(LoginBtn, SIGNAL(clicked()), thewge, SLOT(accept()));
  28.  
  29. };
  30.  
  31. #endif // THEWGE_H
To copy to clipboard, switch view to plain text mode