Convert project Qt to file .exe for window - qt

Hello i'm a young develop on Qt. I want to know that can we convert project Qt (header, source, form, resource) to a file can run without Qt Creator? And how can we convert it to a file executable on window (.exe)?

The compiler is responsible for making an executable out of the source code. This has nothing to do with Qt.
When you start a program from the QtCreator an executable file is built by the compiler, then started. Have a look in your project folder to find that .exe file.

You dont have to do anything special. Each Qt project has a .pro file that is used for compiling. You need to use qmake on the command line with the .pro file as input. This will generate a makefile that you can then give to nmake.exe (if using Visual Studio compilers) or mingw-make (if you are uisng mingw compilers) to build. These steps will compile your source code into the .exe. Look through documentation of qmake to know more. Qt Creator also does the same steps and you can check out the buildlog in Qt Creator to see it working.

Yes, the exe file that you compile with Qt Creator or alternatively some other IDE or compiler is technically all you need to run the project from there on, except you need to have the linked Qt libraries somehow available to the executable. This is especially important if you plan to run it on a machine different from the one you developed it on. See the Qt documentation on Deploying Qt Applications for other details you may need to consider in that case.

Related

How to use qt creator for non qt, non cmake project?

I want to use qt creator for modifying a project that just uses makefiles. How i can do it? Right now i can just open project files one by one and there is no auto code completion or other advantages of ide. My main concern is use the ide over ssh actually.
I tried open all folder but it didnt work too.
You can use Qt Creator for non-Qt projects, but it will always assume you want to use qmake, CMake, or QBS as your build system. It's not going to read your plain Makefiles and recognize what source files you are using.
In the New Project wizard, you can select non-Qt application. I recommend selecting qmake as your build system, which will create a .pro file, even if you won't end up using it. Then after it creates the project, go into your Project settings under Build Steps. You can delete the built-in steps and add your own custom build steps to do whatever you want. Call make or whatever. Do the same for the Clean Steps.

QT Creator build qml application

I build a simple qml app that I want to send to a customer (preferably as a .exe)
When i run build project the executable in the release directory is not doing anything.
With most languages ide's that was all I have to do, click a specific build button that would generate a executable and send it.
Do I need to take extra steps in qt to generate a release for customers?
Please read Qt documentation on how to deploy Qt programs on Windows: https://doc.qt.io/qt-5/windows-deployment.html
Most often you only need to call windeployqt to copy all the Qt related DLLs next to your exe file:
windeployqt --qmldir path_to/my/src/qml myprogram.exe
Then you can zip the folder and send it.
Note: If you are using MSVC, you will have a vc_redist.exe file. This is a setup to install the latest Visual C++ runtime, you need to make sure this setup is run before running your program. Usually this is done as part of the installation process of your program, when you distribute it as a "setup.exe".
If you want to send a single exe to a customer, you have 2 choices:
Make a setup. Meaning that the user will have to install the program.
Link Qt (and all libraries) statically. This means that you have to build your own static Qt library from source. It is not impossible but it is not simple. Also if you are using Qt under an open source license, that your program will be impacted more severely by the LGPLv3.
You can compress the folder into a self-extractible zip file. When the customer launch the program, it will extract all files (your main exe file + Qt dlls) into a tmp folder and then start your exe. This adds a significant start up time to your program because you have to unzip all files each time.

Qt Creator won't open CMake C++ Project in OSX

I'm trying to work on an open-source project in Qt Creator on OSX. When I open the CMakeLists.txt like other CMake projects in Qt Creator it doesn't open the project. No folders, source files, not even the CMakeList.txt shows up in Qt Creator, just a completely blank project.
What could cause a project to do this?
Edit: the project opens properly in Ubuntu. It shows the CMakeLists.txt, source files, and everything. It even builds properly when I CMake in the command line on OSX. Qt Creator in OSX just does not open this project properly.
Eit 2: My build settings are completely empty too. There are no General Messages or messages of any kind.
Open your Preferences (Cmd+, on Mac) and go to the Build & Run and then CMake tab, do you see any CMake version listed there? For me, I have to add a manual entry because it doesn't automatically find my CMake. My manual entry is set to /Applications/CMake.app/Contents/bin/cmake so compare that with what you have in your settings.
Then restart Qt Creator and reopen your project. Go to Build & Run again and make sure the Kit you have selected for your project has a CMake Tool set (should be automatic if you have just the one CMake entry listed on the CMake tab).
Background Information
It looks like you are using Qt Creator 4.0. With that version, they changed a number of things related to how CMake projects are handled. When you first open a project, it won't create the build directory if it doesn't exist. Instead, it will run CMake in a temporary directory. This would be shown in the General Messages output pane if you had it open. Once you manually create the output directory as it appears in your project's Build Settings, Qt Creator will switch to running CMake in there instead. There's no indication this is happening apart from what is logged in the General Messages output pane, even if there's a problem with your CMakeLists.txt.
In your case, if there's genuinely nothing appearing in your General Messages output pane and CMake is working fine from the command line, that suggests something may be wrong with your Qt Creator settings.

Autocomplete in Qt Creator: how to add header files for a cmake project

If I am making a Qt Creater project using cmake, rather than qmake, how can I tell Qt Creator where to look for header files for autocompletion? In CMakeLists.txt, I can specify where to look for heading in compilation, but Qt Creator will not read this until I build the project.
You can make headers show up in CMake by including them in the sources list for a target you're building, alongside the source files. This works for files that are part of your project.
For header files somewhere on your system where the compiler can find them, I'd guess that running CMake (to generate the Makefile) should be enough for Qt Creator to find them.

Where to obtain qmake (QT) compiler for netbeans?

I would like to use netbeans 8 for make QT applications. How ever, I have to specify the qmake file, which is for compiling QT apps. Is there any official source where I can get it? I tried google a lot, but haven't found any normal place. Thanks for the help in advance.
qmake is a program that compiles Project Files (.pro) into a Makefile. Think of it as "autoconf" of Qt world. To compile a Qt project, you only need to perform 2 steps,
run qmake to generate a Makefile from the Project File (.pro)
run make to build your application
netbeans.org has a step-by-step guide how do set things up,
https://netbeans.org/kb/72/cnd/qt-applications.html
qmake is a Qt specific replacement for the make utility, not a compiler. It is part of the Qt distribution actually... Just checked here, yes, it is part of the libqt4-devel package. Note that obviously you need the Qt development packages in addition to the runtime Qt packages.

Resources