hvengel
26th February 2007, 23:13
I have converted the ui files for my app from designer 3 to designer 4. Now I am looking at the examples trying to figure what I need to do to use the files generated by uic 4. My qt 3 code is structured like this:
mydialogbase.ui contains the MyDialogBase dialog. Then in mydialog.h I subclass the MyDialogBase object like this:
#include "mydialogbase.h"
class MyDialog : public MyDialogBase
{
Q_OBJECT
public:
MyDialog(QWidget *parent = 0);
~MyDialog();
....
};
In mydialog.cpp I have
#include "mydialog.h"
MyDialog::MyDialog(QWidget *parent)
:MyDialog(parent)
{
...
}
MyDialog::~MyDialog()
{
...
}
Then in main.cpp I do this:
#include "mydialog.h"
int main( int argc, char **argv )
{
QApplication a( argc, argv );
MyDialog w;
w.show();
return a.exec();
}
The examples that I have looked at do not appear to be based on qt3 code that is already subclassing the ui object and I am having a hard time figuring out how to make my code work with the new code generated by uic 4. It seems like I should be able to make some minor changes to MyDialog in mydialog.h and possibly mydialog.cpp to make this work. But everything I have tried will not build. Is there someone here that can modify my little example code stubs so that this would correctly interface to the code generated by uic 4? It does not need to be totally perfect just enough so that I know I am on the right track.
mydialogbase.ui contains the MyDialogBase dialog. Then in mydialog.h I subclass the MyDialogBase object like this:
#include "mydialogbase.h"
class MyDialog : public MyDialogBase
{
Q_OBJECT
public:
MyDialog(QWidget *parent = 0);
~MyDialog();
....
};
In mydialog.cpp I have
#include "mydialog.h"
MyDialog::MyDialog(QWidget *parent)
:MyDialog(parent)
{
...
}
MyDialog::~MyDialog()
{
...
}
Then in main.cpp I do this:
#include "mydialog.h"
int main( int argc, char **argv )
{
QApplication a( argc, argv );
MyDialog w;
w.show();
return a.exec();
}
The examples that I have looked at do not appear to be based on qt3 code that is already subclassing the ui object and I am having a hard time figuring out how to make my code work with the new code generated by uic 4. It seems like I should be able to make some minor changes to MyDialog in mydialog.h and possibly mydialog.cpp to make this work. But everything I have tried will not build. Is there someone here that can modify my little example code stubs so that this would correctly interface to the code generated by uic 4? It does not need to be totally perfect just enough so that I know I am on the right track.