Ram
Ram

Reputation: 11

How to convert .ui(user interface) files into .exe file in QT

I am a fresher in qt,i don't have much knowledge on qt, but i created some of file in qt for my application (regaurding to GUI format).I was created some .ui files in qt,but i wanted these files into .exe format.I think u had unerstand my problem,so please help me

Upvotes: 0

Views: 2806

Answers (3)

Sebastian Dusza
Sebastian Dusza

Reputation: 2528

Try using QtCreator (official IDE for Qt development). One way to use your *.ui file would bet to:

  1. create *.h and *.cpp files containing a class that will load your widget structure.
  2. add your new files to qt project file - *.pro

If your haven't used Qt Creator yet, then I suggest try it.

  1. Create new project (ctrl+n) - Qt C++ Project / Qt Gui Application
  2. Add new form to your project (ctrl+n) - Qt / Qt Designer Form Class

Look at files that where created by IDE. There is *.h file, *.cpp file and *.ui file.

Look into *.pro file, there are 3 sections SOURCES, HEADERS, FORMS


Here are some learning materials:

http://qt.nokia.com/services-partners/qt-in-education/qt-in-education-course-material

Upvotes: 0

Hari Kishan
Hari Kishan

Reputation: 29

Hallo Ram,

I think you are asking about the inclusion of .ui files within your .exe file. If I am not wrong, then you need to include you .ui file within your projects specific resource file. It will be usually named .qrc in Qt projects.

The contents of .qrc file will look something like this:

<RCC>
    <qresource prefix="/ui">
        <file>ui/command/spiwidget.ui</file>
        <file>ui/command/SPIMicroCommandWidget.ui</file>
        <file>ui/command/utility/externdatawidget.ui</file>
        <file>ui/sequencerwidget.ui</file>
        <file>ui/command/watchdogwidget.ui</file>
        <file>ui/command/utility/repdatawidget.ui</file>
    <file>ui/command/core.png</file> 
    <file>ui/command/LastOpenedFiles.ui</file>
    </qresource>
</RCC>

In the code above, you can see the inclusions for .ui and .png(image file) too. After including it in .qrc file, you can use this resource in your .cpp code as follows:

QFile file(":ui/ui/command/LastOpenedFiles.ui");

Where :ui/ui/command is the path of to the .ui file being used.

Hope this explanation is useful to you!

Upvotes: 1

Kaleb Pederson
Kaleb Pederson

Reputation: 46469

uic (sometimes installed as uic-4) takes the .ui files and generates a C++ header file that you can inherit from. There are a few different ways you can work with the .ui files. See the manual for more information. Feel free to come back with specific questions.

Upvotes: 4

Related Questions