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.
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();
};
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();
};
To copy to clipboard, switch view to plain text mode
In mainwindow.cpp file, it has:
#include ...
MainWindow
::MainWindow(QWidget* parent,
const char* name, Qt
::WindowFlags fl
) : Q3MainWindow(parent, name, fl)
{
setupUi(this);
(void)statusBar();
}
...
#include ...
MainWindow::MainWindow(QWidget* parent, const char* name, Qt::WindowFlags fl)
: Q3MainWindow(parent, name, fl)
{
setupUi(this);
(void)statusBar();
}
...
To copy to clipboard, switch view to plain text mode
In my program, I defined a new class as following in TestMainWindow.h
#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();
...
}
#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();
...
}
To copy to clipboard, switch view to plain text mode
In compilation, I always get error that
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 -
Bookmarks