PDA

View Full Version : QDialog won't compile



McFreeze
26th April 2010, 01:16
I'm trying to compile a QDialog cpp file that was working before, but now refuses to compile. I even replaced it and the .h with files that came from a default QDialog, but I keep getting these errors:


invalid use of incomplete type 'struct Ui::Dialog'
forward declaration of 'struct Ui::Dialog'

and in Visual Studio:


error C2512: 'Ui::Dialog' : no appropriate default constructor available


Code is below. Anyone know what's wrong here? I'm completely baffled.


#ifndef DIALOG_H
#define DIALOG_H

#include <QDialog>

namespace Ui {
class Dialog;
}

class Dialog : public QDialog {
Q_OBJECT
public:
Dialog(QWidget *parent = 0);
~Dialog();

protected:
void changeEvent(QEvent *e);

private:
Ui::Dialog *ui;
};

#endif // DIALOG_H


#include "dialog.h"
#include "ui_dialog.h"

Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);
}

Dialog::~Dialog()
{
delete ui;
}

void Dialog::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}