arninio123
29th February 2012, 11:22
Hello
I want to make a score board white a timer but i get a error message and i dont know what i can do about it
pls can someone help me?? :D
Error Message
mainwindow.cpp:16: error: `btstart' undeclared (first use this function)
mainwindow.cpp:16: error: (Each undeclared identifier is reported only once for each function it appears in.)
mainwindow.cpp:17: error: `btstop' undeclared (first use this function)
mainwindow.cpp:18: error: `btreset' undeclared (first use this function)
mainwindow.cpp: At global scope:
mainwindow.cpp:21: error: `MaindWindow' has not been declared
mainwindow.cpp: In function `void count()':
mainwindow.cpp:22: error: `seconds' undeclared (first use this function)
mainwindow.cpp:24: error: `minute' undeclared (first use this function)
mainwindow.cpp:28: error: `lcdSeconds' undeclared (first use this function)
mainwindow.cpp:29: error: `lcdMinutes' undeclared (first use this function)
mainwindow.cpp:29: error: `minutes' undeclared (first use this function)
mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <Qtime>
#include <Qtimer.h>
#include <QPalette>
MainWindow::MainWindow(QWidget *parent, Qt::WFlags f) :
QMainWindow(parent, f),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
seconds = minutes = 0;
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(count()));
connect(btstart, SIGNAL(clicked()), this, SLOT(start()));
connect(btstop, SIGNAL(clicked()), this, SLOT(stop()));
connect(btreset, SIGNAL(clicked()), this, SLOT(reset()));
}
void MaindWindow::count(){
seconds++;
if(seconds==60) {
minute++;
seconds=0;
}
lcdSeconds->display(seconds);
lcdMinutes->display(minutes);
}
void MainWindow::start(){
timer->start(1000);
}
void MainWindow::stop(){
timer->start();
}
void MainWindow::reset(){
seconds = minutes = 0;
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
void MainWindow::on_lcdNumber_overflow()
{
}
mainwindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QTimer>
#include "ui_mainwindow.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow {
Q_OBJECT
public:
QTimer * timer;
int seconds;
int minutes;
MainWindow(QWidget *parent = 0, Qt::WFlags f = 0);
~MainWindow();
protected:
void changeEvent(QEvent *e);
private:
Ui::MainWindow *ui;
private slots:
void on_btstart_clicked();
void count();
void start();
void stop();
void reset();
void on_lcdNumber_overflow();
};
#endif // MAINWINDOW_H
I want to make a score board white a timer but i get a error message and i dont know what i can do about it
pls can someone help me?? :D
Error Message
mainwindow.cpp:16: error: `btstart' undeclared (first use this function)
mainwindow.cpp:16: error: (Each undeclared identifier is reported only once for each function it appears in.)
mainwindow.cpp:17: error: `btstop' undeclared (first use this function)
mainwindow.cpp:18: error: `btreset' undeclared (first use this function)
mainwindow.cpp: At global scope:
mainwindow.cpp:21: error: `MaindWindow' has not been declared
mainwindow.cpp: In function `void count()':
mainwindow.cpp:22: error: `seconds' undeclared (first use this function)
mainwindow.cpp:24: error: `minute' undeclared (first use this function)
mainwindow.cpp:28: error: `lcdSeconds' undeclared (first use this function)
mainwindow.cpp:29: error: `lcdMinutes' undeclared (first use this function)
mainwindow.cpp:29: error: `minutes' undeclared (first use this function)
mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <Qtime>
#include <Qtimer.h>
#include <QPalette>
MainWindow::MainWindow(QWidget *parent, Qt::WFlags f) :
QMainWindow(parent, f),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
seconds = minutes = 0;
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(count()));
connect(btstart, SIGNAL(clicked()), this, SLOT(start()));
connect(btstop, SIGNAL(clicked()), this, SLOT(stop()));
connect(btreset, SIGNAL(clicked()), this, SLOT(reset()));
}
void MaindWindow::count(){
seconds++;
if(seconds==60) {
minute++;
seconds=0;
}
lcdSeconds->display(seconds);
lcdMinutes->display(minutes);
}
void MainWindow::start(){
timer->start(1000);
}
void MainWindow::stop(){
timer->start();
}
void MainWindow::reset(){
seconds = minutes = 0;
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
void MainWindow::on_lcdNumber_overflow()
{
}
mainwindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QTimer>
#include "ui_mainwindow.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow {
Q_OBJECT
public:
QTimer * timer;
int seconds;
int minutes;
MainWindow(QWidget *parent = 0, Qt::WFlags f = 0);
~MainWindow();
protected:
void changeEvent(QEvent *e);
private:
Ui::MainWindow *ui;
private slots:
void on_btstart_clicked();
void count();
void start();
void stop();
void reset();
void on_lcdNumber_overflow();
};
#endif // MAINWINDOW_H