How to change Qt Creator build tool? - c++

Is there anyway to change the build tool Qt Creator uses? Currently, Qt Creator has defaulted to the Qt5 version of qmake. I would like to use the Qt4 version of qmake, or the /usr/bin/make/ option. What are the steps needed to make this happen?

Go to Tools->Options->Build&Run
Then select Qt Versions tab. You can add qmake there by giving path manually
While building project you can select the respective toolchain as well. That can be done from left panel option project then select the configured toolchain.

Go to Project folder in the left sidebar (under the debug button). Then click 'Manage kits' and create a new kit including the Qt4 make path or change the qmake path of your current path for the qt4 one. The QMake is chosen under the tab QtVersions.

Related

Use a QT Widget plugin using static qmake

i have built an QT GUI app using Visual Studio 2017 with Qt VS Tools extension and QT version 5.6 (the one provided by QT precompiled), using Qled widget plugin.
With this Default Dynamic Qt version, the app runs fine with the widget and i have no problems.
But now, i want to build the same app, but static, for use without dependencies.
So, i built QT 5.6 from source with -static parameter, to be more exact i follow this blog's guide. Here problems started to show up:
I tried to rebuild the widget plugin using the static qmake, but i got this error: "Project ERROR: Unknown module(s) in QT: designer"
I tried to use the plugin compiled by the dynamic qmake, and surprisingly, it built with success but the GUI app didn't open at all.
Its worth mentioning that i can use and build a simple default application using a qmake static build.
I think i need to add the Qt Designer Module, but i don't know how to do this, i even tried to rebuild qmake without the "-nomake tools" paramter, but got the same error building the plugin.
just don't build the plugin, you don't need it. Just add the qrc file, and the actual widget *.cpp and *.h file into your project
fix the linkage, delete the QDESIGNER_WIDGET_EXPORT in the *.h file inside your project
This comment managed to solved my problem, thanks to #PeterT

How to debug xcode project in qt?

I want to embed some UI written using Qt and QML via QMacNativeWidget.
And I want to debug QML using Qt Creator, cause I can't debug QML with XCode. Do you know if it's possible?
You can debug Qt/QML in Xcode since it's essentially just a regular C/C++ project. The only thing you need is a proper Xcode project (.xcodeproj).
You could use CMake for project configuration/generation instead of relying on QtCreator's .pro format. With CMake you could switch between IDEs (project generators is the better term) on demand and try things out when it gets OS specific.
If that's not an option (there might be several reasons), you still can generate an Xcode project from an existing .pro solution via qmake in the command line:
qmake -spec macx-xcode project.pro
This can be found in the Qt for macOS section of the docs.

qt creator still use the origin project after I move the project to another place

I build a project in directory A by Qt Creator, then I move the whole project folder into directory B, and use the *.pro file to open the project, but when I modify some code in the project, and found the project build and run still use the project in directory A. How should I fix this problem?
Follow these steps:
Goto Projects
Select Kit
Change Build directory
This will update projectname.pro.user specifically ProjectExplorer.BuildConfiguration.BuildDirectory key.
This will help!
Select "Projects"
Under "General", uncheck "Shadow build" to use current directory.

Specifying external Makefile options in Eclipse CDT

I'd like to (temporarily) migrate a C++ project from Netbeans to Eclipse (in order to use Eclipse's parallel debugger). So far I've created a "Makefile project with Existing Code" project in Eclipse that references the Netbeans project Makefile/directory. However the Netbeans project accepts config options for example
make -f Makefile CONF=GNU_Debug
How can I pass this option to the Makefile in Eclipse?
Eclipse version
Eclipse for Parallel Application Developers -- Mars.2 Release (4.5.2)
You can change the default make call in the projects properties dialog:
My version:
Version: Mars.1 Release (4.5.1)
Note that the -f Makefile should be superfluous.
In addition to πάντα ῥεῖ's answer, which changes settings "globally" for a project, you can define individual make targets in the Make Target view.
Steps:
Choose Window -> Show View -> Other... -> Make -> Make Target (or simpler, press Ctrl+3 then type Make Target and choose the view from the list.)
Right click on the project in the view and choose New...
Enter the make target you want to use, e.g. CONF=GNU_Debug and press OK
Double-click on target to build
Here is a screenshot:
Shortcuts
You can quickly rebuild last selected Make target by pressing F9
Bring up a pop-up to select Make target by pressing Shift+F9
Access the same UI as above by right-clicking on project in Project Explorer and choosing Make Targets -> Build or selecting the same from the Project menu.

Qt Creator creates both a debug and a release folder inside the designated debug folder

I am using the default build directory in Qt Creator which is something like build-project-blah-blah-Debug. However, when I build my app in debug mode both a debug and and a release folder are created inside. If I set the build directory as build-project-blah-blah for both the debug and release builds Qt Creator does not behave properly, i.e. it complaints and it does not clean the built files.
I deduced the solution from this answer to the reverse question.
In your .pro file, add the following line to prevent the subdirectories being created:
CONFIG -= debug_and_release debug_and_release_target
This issue only occurs on Windows, not on Unix-based OS's. Windows sets these flags by default, whereas Unix implementations of QT don't. To me it was mainly a problem due to compatibility of my project between both environments.
You can choose folder for debug and release builds on the projects mode (Ctrl + 5)
There you have a combo box which says "Edit build configuration", and lets you choose Release or Debug, and then you can edit the build directory of each one