PDA

View Full Version : ui_mainwindow.h file not found



unix7777
16th February 2013, 18:27
Hi ,

I have project made in QT 4.7.
Now i see that QT 5 is released and have installed it.
I noticed that a lot of clases has changed.A lot of them now are in QtWidgets/ i changed my code in accordance with this change.
Now i have only one problem before run my code.

The error:
ui_mainwindow.h file not found

I didn't change nothing in the mainwindow.ui file neither in mainwindow.

PLEASE HELP!


#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtWidgets/QMainWindow>
#include <ui_mainwindow.h>
#include <info.h>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
Q_OBJECT

public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();

private slots:
void on_actionNew_triggered();

void on_actionSettings_triggered();

void on_actionAbout_triggered();



void on_actionGroup_triggered();

void on_actionInfo_triggered();

private:
Ui::MainWindow *ui;
};

#endif // MAINWINDOW_H



#include "mainwindow.h"
#include "invoice.h"
#include "settings.h"
#include "customers.h"
#include <QtWidgets/QMessageBox>

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);

Info *i=new Info(this);
ui->stackedWidget->addWidget(i);
ui->stackedWidget->setCurrentWidget(i);

}

MainWindow::~MainWindow()
{
delete ui;
}

void MainWindow::on_actionNew_triggered()
{

Invoice *inv=new Invoice(this);
ui->stackedWidget->addWidget(inv);
ui->stackedWidget->setCurrentWidget(inv);

}

void MainWindow::on_actionSettings_triggered()
{
Settings *settings=new Settings(this);
ui->stackedWidget->addWidget(settings);
ui->stackedWidget->setCurrentWidget(settings);
}

void MainWindow::on_actionAbout_triggered()
{
//ABOUT DIALOG
QMessageBox msgBox;
msgBox.setText("<html><p align=center><font size=3 face=Arial>Faktura 1.0<br><br>Programming: George Stoichev<br><br><a href=mailto:admin@iabalka.eu>admin@iabalka.eu</a><br><br>CAPRICORN Ltd. &copy; 2011");
msgBox.exec();
}


void MainWindow::on_actionGroup_triggered()
{
Clients *c=new Clients(this);
ui->stackedWidget->addWidget(c);
ui->stackedWidget->setCurrentWidget(c);
}

void MainWindow::on_actionInfo_triggered()
{
Info *info=new Info(this);
ui->stackedWidget->addWidget(info);
ui->stackedWidget->setCurrentWidget(info);
}

norobro
16th February 2013, 19:42
Porting C++ Applications to Qt 5 (http://qt-project.org/doc/qt-5.0/qtdoc/portingcppapp.html)

Step 2 is what you need.

amleto
16th February 2013, 20:17
#include <ui_mainwindow.h>
#include <info.h>

You shouldnt be using angle brackets for these includes

unix7777
17th February 2013, 09:47
Thanks a lot.
Adding QT += widgets did the trick :)

anda_skoa
17th February 2013, 18:50
If you do the includes without the module path part then the same include can be used for Qt4 and Qt5, e.g.



#include <QMainWindow>


Cheers,
_