Results 1 to 5 of 5

Thread: ui_mainwindow.h file not found

  1. #1
    Join Date
    Mar 2009
    Posts
    104
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X

    Default ui_mainwindow.h file not found

    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!

    Qt Code:
    1. #ifndef MAINWINDOW_H
    2. #define MAINWINDOW_H
    3.  
    4. #include <QtWidgets/QMainWindow>
    5. #include <ui_mainwindow.h>
    6. #include <info.h>
    7.  
    8. namespace Ui {
    9. class MainWindow;
    10. }
    11.  
    12. class MainWindow : public QMainWindow
    13. {
    14. Q_OBJECT
    15.  
    16. public:
    17. explicit MainWindow(QWidget *parent = 0);
    18. ~MainWindow();
    19.  
    20. private slots:
    21. void on_actionNew_triggered();
    22.  
    23. void on_actionSettings_triggered();
    24.  
    25. void on_actionAbout_triggered();
    26.  
    27.  
    28.  
    29. void on_actionGroup_triggered();
    30.  
    31. void on_actionInfo_triggered();
    32.  
    33. private:
    34. Ui::MainWindow *ui;
    35. };
    36.  
    37. #endif // MAINWINDOW_H
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. #include "mainwindow.h"
    2. #include "invoice.h"
    3. #include "settings.h"
    4. #include "customers.h"
    5. #include <QtWidgets/QMessageBox>
    6.  
    7. MainWindow::MainWindow(QWidget *parent) :
    8. QMainWindow(parent),
    9. ui(new Ui::MainWindow)
    10. {
    11. ui->setupUi(this);
    12.  
    13. Info *i=new Info(this);
    14. ui->stackedWidget->addWidget(i);
    15. ui->stackedWidget->setCurrentWidget(i);
    16.  
    17. }
    18.  
    19. MainWindow::~MainWindow()
    20. {
    21. delete ui;
    22. }
    23.  
    24. void MainWindow::on_actionNew_triggered()
    25. {
    26.  
    27. Invoice *inv=new Invoice(this);
    28. ui->stackedWidget->addWidget(inv);
    29. ui->stackedWidget->setCurrentWidget(inv);
    30.  
    31. }
    32.  
    33. void MainWindow::on_actionSettings_triggered()
    34. {
    35. Settings *settings=new Settings(this);
    36. ui->stackedWidget->addWidget(settings);
    37. ui->stackedWidget->setCurrentWidget(settings);
    38. }
    39.  
    40. void MainWindow::on_actionAbout_triggered()
    41. {
    42. //ABOUT DIALOG
    43. QMessageBox msgBox;
    44. 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");
    45. msgBox.exec();
    46. }
    47.  
    48.  
    49. void MainWindow::on_actionGroup_triggered()
    50. {
    51. Clients *c=new Clients(this);
    52. ui->stackedWidget->addWidget(c);
    53. ui->stackedWidget->setCurrentWidget(c);
    54. }
    55.  
    56. void MainWindow::on_actionInfo_triggered()
    57. {
    58. Info *info=new Info(this);
    59. ui->stackedWidget->addWidget(info);
    60. ui->stackedWidget->setCurrentWidget(info);
    61. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by unix7777; 16th February 2013 at 18:47.

  2. #2
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: ui_mainwindow.h file not found

    Porting C++ Applications to Qt 5

    Step 2 is what you need.

  3. #3
    Join Date
    Sep 2011
    Posts
    1,245
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: ui_mainwindow.h file not found

    #include <ui_mainwindow.h>
    #include <info.h>

    You shouldnt be using angle brackets for these includes
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  4. #4
    Join Date
    Mar 2009
    Posts
    104
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: ui_mainwindow.h file not found

    Thanks a lot.
    Adding QT += widgets did the trick

  5. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,419
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: ui_mainwindow.h file not found

    If you do the includes without the module path part then the same include can be used for Qt4 and Qt5, e.g.

    Qt Code:
    1. #include <QMainWindow>
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

Similar Threads

  1. [release/qrc_ICON.cpp] Error 1:File not found
    By nimingzhe2008 in forum Qt Programming
    Replies: 1
    Last Post: 9th September 2012, 23:23
  2. Replies: 0
    Last Post: 23rd May 2011, 10:01
  3. Replies: 3
    Last Post: 2nd December 2010, 22:44
  4. Replies: 2
    Last Post: 12th November 2009, 19:05
  5. QSqlDataBase file not found
    By sdastagirmca in forum Qt Programming
    Replies: 3
    Last Post: 5th February 2009, 07:53

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.