PDA

View Full Version : Program that just shows a window



claudio-cit
4th July 2008, 17:07
As expected, when I build i get an error message that says that show method doesn't exist. In fact i didn't create it.

I created ui_ABase.h with qmake, giving as input the .ui file generated with Qt Designer.

How I can display the whole mainwindow created with Qt Designer?


#include <QApplication>
#include <QFont>
#include <QPushButton>
#include "ui_ABase.h"

int main(int argc, char* argv[])
{
QApplication app(argc, argv);

Ui_ABase base;

base.show();

return app.exec();
}

JimDaniel
5th July 2008, 05:52
I don't use the designer for my GUI, but when I create a new app in VS, it (annoyingly) always makes a .ui file, but it lives in a QMainWindow class. Its used in the main window's constructor like this: ui.setupUi(this);

So I would say, make a QWidget or something, and put your ui object in there, then in the widget's constructor call ui.setupUi(this); Then in main() create your QWidget:

QWidget myWidget;
myWidget.show();

Maybe that will do the trick...

claudio-cit
5th July 2008, 09:55
Yeah i found it here too, thank you: http://doc.trolltech.com/4.4/designer-using-a-component.html#the-multiple-inheritance-approach