So I'm really new to QT and there's this problem i'm facing which i can't understand at all. I've got a program that has a next button on each page and a back button on some. All the next buttons i've implemented are working perfectly fine, but the back button isn't, even though i implemented it the same way as i did the others, which i saw online.
This is the header file for the third page which has the back button:
//ThirdPage header file
#ifndef THIRDPAGE_H
#define THIRDPAGE_H
#include <QDialog>
#include "secondpage.h"
namespace Ui {
class ThirdPage;
}
class ThirdPage : public QDialog
{
Q_OBJECT
public:
explicit ThirdPage(QWidget *parent = 0);
~ThirdPage();
private slots:
void on_backButton_clicked();
private:
Ui::ThirdPage *ui;
SecondPage *secPage;
};
#endif // THIRDPAGE_H
This is the cpp file for the third page:
//third page cpp file
#include "thirdpage.h"
#include "ui_thirdpage.h"
#include "secondpage.h"
ThirdPage::ThirdPage(QWidget *parent) :
QDialog(parent),
ui(new Ui::ThirdPage)
{
ui->setupUi(this);
//setFixedSize(854,480);
setMinimumSize(854,480);
}
ThirdPage::~ThirdPage()
{
delete ui;
}
void ThirdPage::on_backButton_clicked()
{
hide();
secPage = new SecondPage(this);
secPage->show();
}
And these are the header and cpp files for the second page, that should open when the back button is pressed
//Second Page header file
#ifndef SECONDPAGE_H
#define SECONDPAGE_H
#include <QDialog>
#include "thirdpage.h"
namespace Ui {
class SecondPage;
}
class SecondPage : public QDialog
{
Q_OBJECT
public:
explicit SecondPage(QWidget *parent = 0);
~SecondPage();
private slots:
void on_pushButton_clicked();
private:
Ui::SecondPage *ui;
ThirdPage *thirdPage;
};
#endif // SECONDPAGE_H
Second Page cpp:
//Second Page cpp file
#include "secondpage.h"
#include "ui_secondpage.h"
#include "thirdpage.h"
SecondPage::SecondPage(QWidget *parent) :
QDialog(parent),
ui(new Ui::SecondPage)
{
ui->setupUi(this);
//setFixedSize(854,480);
setMinimumSize(854,480);
}
SecondPage::~SecondPage()
{
delete ui;
}
void SecondPage::on_pushButton_clicked()
{
QString nameOfClient = ui->NameOfClient->text();
QString designation = ui->DesignationOfCompany->text();
QString nameOfCompany = ui->NameOfIndustry->text();
QString addressOfCompany = ui->Address->text();
QString contactNumber = ui->ContactNumber->text();
QString annualProductionCapacity = ui->AnnualProductionCapacity->text();
QString clientDetails[6] = {nameOfClient,designation,nameOfCompany,addressOfCompany,contactNumber,};
hide();
thirdPage = new ThirdPage(this);
thirdPage->show();
}
The error i'm getting is in thirdpage.h which is:
error: 'SecondPage' does not name a type
SecondPage *secPage;
^
Anybody can see where the problem is?