Hello everyone! I am developing this modeling software that user can choose two diferent types of model to fill the parameters and run. The problem is this, i have to instantiate two objects (two diferent models) but Qt insists generate the message error “ISO C++ forbids declaration of ‘Coupled’ with no type”. I have already searched about this and i didn’t found anything helpful. Part of my code is that shown below.
dengueme.h:
#ifndef DENGUEME_H
#define DENGUEME_H
#include <QMainWindow>
#include <QtGui>
#include <QtCore>
#include "integrated.h"
#include "coupled.h"
namespace Ui {
class DengueME;
}
//class Coupled; --> i have tried this without success
//class Integrated; --> i have tried this without success
class DengueME : public QMainWindow
{
Q_OBJECT
public:
explicit DengueME(QWidget *parent = 0);
~DengueME();
public slots:
void loadCoupled();
void loadIntegrated();
void workspace();
void runModel();
private:
Ui::DengueME *ui;
QFileSystemModel *dirmodel;
Integrated *i;
Coupled *c; // HERE IS MY PROBLEM
int model;
};
#endif // DENGUEME_H
dengueme.cpp:
#include "dengueme.h"
#include "ui_dengueme.h"
#include "coupled.h"
#include "integrated.h"
DengueME::DengueME(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::DengueME)
{
ui->setupUi(this);
connect(this->ui->actionCoupled_Model, SIGNAL(triggered()), this, SLOT(loadCoupled()));
connect(this->ui->actionIntegrated_Model, SIGNAL(triggered()), this, SLOT(loadIntegrated()));
connect(this->ui->pushButton_run, SIGNAL(clicked()), this, SLOT(runModel()));
workspace();
}
DengueME::~DengueME()
{
delete ui;
}
void DengueME::workspace()
{
dirmodel = new QFileSystemModel(this);
QStringList filters;
filters << "*.lua";
dirmodel->setNameFilters(filters);
this->ui->treeView->setModel(dirmodel);
this->ui->treeView->setColumnHidden(1, true);
this->ui->treeView->setColumnHidden(2, true);
this->ui->treeView->setColumnHidden(3, true);
this->ui->treeView->setRootIndex(
dirmodel->setRootPath(
QFileInfo(QCoreApplication::applicationFilePath()).filePath()
)
);
}
void DengueME::loadCoupled()
{
this->c = new Coupled();
this->ui->scrollArea->setWidget(c);
model = 0;
}
void DengueME::loadIntegrated()
{
this->i = new Integrated();
this->ui->scrollArea->setWidget(i);
model = 1;
}
void DengueME::runModel()
{
if(model == 0){
this->ui->textBrowser_output->setText("Processing data...\n");
// this->ui->textBrowser_output->setText(this->c->executeModel());
} else if(model == 1) {
this->ui->textBrowser_output->setText("Processing data...\n");
this->ui->textBrowser_output->setText(this->i->executeModel());
}
}
coupled.h:
#ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
#include <QtGui>
namespace Ui {
class Coupled;
}
class Coupled : public QWidget
{
Q_OBJECT
public:
explicit Coupled(QWidget *parent = 0);
~Coupled();
public slots:
// (...)
private:
Ui::Coupled *ui;
};
#endif // WIDGET_H
integrated.h:
#ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
#include <QtGui>
namespace Ui {
class Integrated;
}
class Integrated : public QWidget
{
Q_OBJECT
public:
explicit Integrated(QWidget *parent = 0);
~Integrated();
public slots:
// (...)
private:
Ui::Integrated *ui;
};
#endif // WIDGET_H
Anyone have any idea about what should i do?
Ps 1: I’m sorry about my english;
Ps 2: Sorry if this topic looks like any other (i swear, i searched this A LOT!).
↧