Compilation Error: base class undefined in the class created from UI file
Hi,
I am porting my Qt3.3 program to Qt4.4.3. I used qt3to4 program to compile my .pro file and run qmake to created a vc++ project.
One of the form (UI files in .PRO file) is compile and created a class, Ui::MainWindow.
Based on this, a new class is defined as in mainwindow.h file.
Code:
class MainWindow : public Q3MainWindow, public Ui::MainWindow
{
Q_OBJECT
public:
MainWindow
(QWidget* parent
= 0,
const char* name
= 0, Qt
::WindowFlags fl
= Qt
::WType_TopLevel);
~MainWindow();
protected slots:
virtual void languageChange();
};
In mainwindow.cpp file, it has:
Code:
#include ...
MainWindow
::MainWindow(QWidget* parent,
const char* name, Qt
::WindowFlags fl
) : Q3MainWindow(parent, name, fl)
{
setupUi(this);
(void)statusBar();
}
...
In my program, I defined a new class as following in TestMainWindow.h
Code:
#include "mainwindow.h"
....
class TestMainWindow : public MainWindow
{
Q_OBJECT
public:
TestMainWindow
( QWidget* parent
= 0,
const char* name
= 0, Qt
::WFlags fl
= Qt
::WType_TopLevel );
// | WStyle_Customize | WStyle_NoBorder ~TestMainWindow();
...
}
In compilation, I always get error that
Quote:
c:\project\TestMainWindow.h(19) : error C2504: 'MainWindow' : base class undefined
I open the "mainwindow.h", it exists and in the include path.
Could anyone help me find out the problem?
Thank you very much!
Richard -
Re: Compilation Error: base class undefined in the class created from UI file
Add
to the .pro file and re-run qmake.
Re: Compilation Error: base class undefined in the class created from UI file
Thank you for the input!
Actually, QT += qt3support, has been added to .PRO file.
Any other thoughts?
Thank you!
Re: Compilation Error: base class undefined in the class created from UI file
some additional info:
this error happens when it compiles moc_TestMainwindow.cpp.
Thank you!
Richard