Results 1 to 8 of 8

Thread: qmake not invoking uic?

  1. #1
    Join Date
    Nov 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default qmake not invoking uic?

    Hello.

    I have made an ui stub by using QT Designer following an example from the book C++ Gui Programming for QT. I saved the ui file (gotocelldialog.ui) in folder togehter with this main.cpp:

    #include <QApplication>
    #include <QDialog>

    #include "ui_gotocelldialog.h"

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

    Ui::GoToCellDialog ui;
    QDialog *dialog = new QDialog;
    ui.setupUi(dialog);
    dialog->show();

    return app.exec();
    }


    And then I run "qmake -project" which creates this gotocell.pro:

    TEMPLATE = app
    TARGET =
    DEPENDPATH += .
    INCLUDEPATH += .

    # Input
    FORMS += gotocelldialog.ui
    SOURCES += main.cpp

    After that i run "qmake gotocell.pro". This creates a makefile. Regarding the description in the book executing qmake should create a ui_gotocelldialog.h by invoking the uic but his is not happening. Thus, i cant compile it since the header which is inculded int he main.cpp is missing.
    I would be really happy if you could help me! For compilation i am using Visual Studio 10 with the QT plugin which has been working fine on the previous qt examples so far.

    Best Regards,
    Regenlied

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: qmake not invoking uic?

    Aren't you forgetting a step?
    I didn't use Qt from the cmd in a while, but the commands should be:
    Qt Code:
    1. 1) qmake -project
    2. 2) qmake NAME_OF_PRO.pro
    3. 3) make or nmake or mingw32-make
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: qmake not invoking uic?

    This creates a makefile.
    Does the make file contain an uic rule in it?
    (Please post it).
    Did you run nmake on it?

    For compilation i am using Visual Studio 10 with the QT plugin...
    But the way you describe here is the console way, not VS + plugin way...

    So, either really use VS and the plugin, then you only need to include the ui in to the project.
    Or, post the make file.

    As last resort on the console you can call uic explicitly on the your ui.
    But that usually should not come to that.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  4. #4
    Join Date
    Jul 2009
    Location
    Enschede, Netherlands
    Posts
    462
    Thanked 69 Times in 67 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qmake not invoking uic?

    Quote Originally Posted by Regenlied View Post
    Regarding the description in the book executing qmake should create a ui_gotocelldialog.h by invoking the uic but his is not happening.
    This is wrong. It is running qmake that gives you the makefile as you state. It is calling make (or nmake, jom, whatever) that will produce the ui_gotocelldialog.h before your source files are being compiled.
    Horse sense is the thing that keeps horses from betting on people. --W.C. Fields

    Ask Smart Questions

  5. The following user says thank you to franz for this useful post:

    Zlatomir (22nd November 2010)

  6. #5
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: qmake not invoking uic?

    Quote Originally Posted by franz View Post
    This is wrong. It is running qmake that gives you the makefile as you state. It is calling make (or nmake, jom, whatever) that will produce the ui_gotocelldialog.h before your source files are being compiled.
    Those files (ui_name_bla.h and makefiles) are generated by qmake projectName.pro second step from my previous post, those are generated before running make (any of them)

    LE: i just tested, i'm wrong about ui_file.h
    Is as Franz said those are generated by running nmake
    my bad, sorry
    Last edited by Zlatomir; 22nd November 2010 at 11:38.

  7. #6
    Join Date
    Nov 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: qmake not invoking uic?

    Thanks alot for the fast help. As you stated, I confused the steps which had to be done in the console/Visual Studio.

  8. #7

    Default Re: qmake not invoking uic?

    Quote Originally Posted by Regenlied View Post
    Thanks alot for the fast help. As you stated, I confused the steps which had to be done in the console/Visual Studio.
    I have met the same problem as yours and I still don't get it.
    Would you explain the way you create the "ui_gotocelldialog.h" file to me in more detail? What's the reason why qmake cannot create this header file automatically?

    Mnay thanks!

  9. #8
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: qmake not invoking uic?

    and I still don't get it.
    You don't get what? what is 'it'?
    What did you try?
    Show code.

    What's the reason why qmake cannot create this header file automatically?
    The reason is that its not qmakes job, as simple as that.
    qmake creates a make file.
    The make file will call uic which will create ui_xxxxx.h out of an xxxxxxx.ui file - as stated in post #4.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. invoking Matlb through QT
    By sal in forum Newbie
    Replies: 2
    Last Post: 22nd May 2010, 22:43
  2. Invoking a QFileDialog from another dialog
    By skimpax in forum Qt Programming
    Replies: 2
    Last Post: 24th March 2010, 17:16
  3. Invoking New Dialog
    By kb1lqc in forum Qt Programming
    Replies: 8
    Last Post: 5th November 2009, 15:23
  4. invoking microsoft word from qt
    By omprakash in forum Qt Programming
    Replies: 2
    Last Post: 31st October 2007, 20:43
  5. Invoking a browser...???
    By deepusrp in forum Newbie
    Replies: 4
    Last Post: 12th June 2007, 17:32

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.