Hi,

Im pretty new to QT, and I tried following a tutorial on youtube (part1, part2) to build a simple timer.

When compiling my code, I get the warning:
Object::connect: No such slot MainWindow::start()
Object::connect: (sender name: 'bt_start')
Object::connect: (receiver name: 'MainWindow')

Here's my code so far:

main.cpp:
Qt Code:
  1. #include <QtGui/QApplication>
  2. #include "mainwindow.h"
  3. #include "ui_mainwindow.h"
  4. #include <QPushButton>
  5.  
  6. int main(int argc, char *argv[])
  7. {
  8. QApplication a(argc, argv);
  9. MainWindow w;
  10. w.show();
  11. return a.exec();
  12. }
To copy to clipboard, switch view to plain text mode 

mainwindow.h
Qt Code:
  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3.  
  4. #include <QMainWindow>
  5. #include <QTimer>
  6. #include "ui_mainwindow.h"
  7. #include <QTGui>
  8.  
  9. namespace Ui {
  10. class MainWindow;
  11. }
  12.  
  13. class MainWindow : public QMainWindow
  14. {
  15. Q_OBJECT
  16. public:
  17. QTimer *timer;
  18. int hours;
  19. int minutes;
  20. int seconds;
  21. explicit MainWindow(QWidget *parent = 0);
  22. ~MainWindow();
  23.  
  24. private:
  25. Ui::MainWindow *ui;
  26. void count();
  27. void start();
  28. void stop();
  29. void reset();
  30. };
  31.  
  32. #endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. #include "mainwindow.h"
  2. #include "ui_mainwindow.h"
  3.  
  4. MainWindow::MainWindow(QWidget *parent) :
  5. QMainWindow(parent),
  6. ui(new Ui::MainWindow)
  7. {
  8. ui->setupUi(this);
  9. hours = 1;
  10. minutes = 2;
  11. seconds = 3;
  12. timer = new QTimer(this);
  13. connect(timer, SIGNAL(timeout()), this, SLOT(count()));
  14. connect(ui->bt_start, SIGNAL(clicked()), this, SLOT(start()));
  15. connect(ui->bt_stop, SIGNAL(clicked()), this, SLOT(stop()));
  16. connect(ui->bt_reset, SIGNAL(clicked()), this, SLOT(reset()));
  17.  
  18. }
  19.  
  20. MainWindow::~MainWindow()
  21. {
  22. delete ui;
  23. }
  24.  
  25. void MainWindow::start(){
  26. timer->start(1000);
  27. }
  28.  
  29. << And the other functions >>
To copy to clipboard, switch view to plain text mode 

It seems the constructor doesn't get loaded properly, becausein the GUI hours/minutes/seconds = 0, while I've set them on different numbers.

Can anyone tell me what I'm doing wrong? Thanks!