Hello everyone.
In the books I have reading regarding qt4 the designer programm was used to create dialogs. But this time I thought the best solution was to create the ui form in designer, describe it as widget and after - use such widget as main windget in mainwindow.
I was looking in google form a lolution. I coold find some information regarding it, but it didn't work well.
What I did:
there is the ui file "mainwidget.h" as qwidget.
For the first try all I want is to see it's working:
mainwidget.h
#ifndef MAINWIDGET_H
#define MAINWIDGET_H
#include <QWidget>
#include "ui_mainwidget.h"
class MainWidget
: public QWidget,
public Ui
::MainWidget{
Q_OBJECT
public:
};
#endif
#ifndef MAINWIDGET_H
#define MAINWIDGET_H
#include <QWidget>
#include "ui_mainwidget.h"
class MainWidget : public QWidget, public Ui::MainWidget
{
Q_OBJECT
public:
MainWidget(QWidget *parent = 0);
};
#endif
To copy to clipboard, switch view to plain text mode
and mainwidget.cpp
#include "mainwidget.h"
{
}
#include "mainwidget.h"
MainWidget::MainWidget(QWidget *parent) : QWidget(parent)
{
}
To copy to clipboard, switch view to plain text mode
Then i create the main.cpp:
#include <QApplication>
#include "mainwidget.h"
int main(int argc, char **argv){
MainWidget wgt;
wgt.show();
return app.exec();
}
#include <QApplication>
#include "mainwidget.h"
int main(int argc, char **argv){
QApplication app(argc, argv);
MainWidget wgt;
wgt.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Then I create the .pro file, add the RESOURCES line, copy the icon's folder.
It compiles with no errors. It even does launch, but I cannot see anything - just empty window of the desired size.
Is there anything I am doing wrong in here?
Bookmarks