I created a plain C++ with Qt program. I failed to achieve any application output. The fix for me was to disable the 'run in terminal' option in Qt Creator.
Anyway, I'd rather use the built-in application output pane for output than a separate terminal. I know I can change it per build configuration, but can make it disabled by default?
I'm using Qt Creator 3.4.2
Default state of this option depends on your project file.
For qmake, if you have CONFIG += console - then this checkbox is checked.
For qbs it's consoleApplication: true
If you want different behavior for new projects - you can create your own Qt Creator project wizard template.
Related
My project unlike this issue is going through MSVC and I'm having troubles with nmake. Is there a way to just see what commands Qt Creator uses when I press Ctrl+R?
Simply click down on the "Compile Output" pane, and it will show you the exact commands that are issued to build the project.
Update:
Because this was partly to have a project to code-browse the whole of qt, here is a much better way to do this: Code Browser by Woboq for C & C++
This even lets you browse into the includes outside the project like the system includes or the standard library.
Old Post:
My question is about Qt project in git://code.qt.io/qt/qt5.git repository. I checked out version 5.12.
My assumption is that qtcreator knows the qmake file but nothing about the configure command. Hence
I used the configure command to prepare the build in a shadow build directory
In QTCreator I opened qt.pro located in the git workspace
QTCreator opens the build settings dialog and I import them from the shadow build directory
Finally I click build in QTCreator.
But the compile window stalls when asking me for input. Qmake asks me about the licence type I want to choose. I had answered that already in the configure phase and even if I would agree to answer the question again, there is no prompt function in qtcreator's compile output window. Where did I go wrong?
If I forget about QTCreator and call make in the shadow build directory, then everything is build fine and without any licensing questions. When I then import the shadow build directory into a QTCreator, then I can build in QTCreator. But then I clicked Run qmake out of curiosity and I was back to square one, i.e. compile window asks me for input again and stops there forever.
Apart from my specific question I found no general documentation about building the qt libraries using QTCreator. I only find descriptions about compiling projects that use the Qt library.
Qt is not really meant to be compiled from within an IDE. However, this does not mean it's impossible to do. There are two ways to archive this:
First approach: Add the developer build as custom kit:
Run the configure script (and add the -developer-build option)
Open QtCreator and go to "Tools > Options > Kits"
Go to "Qt Versions" add press "Add" - select the qmake executable generated by the configure script. Then hit "Apply"
Go to "Kits" and press "Add" - Make shure to select the correct compilers and debugger and select the previously create "Qt Version". Press "Ok"
Open the top level .pro file in QtCreator and choose the previously created Kit. QtCreator will now use the correct qmake executable
This is the "proper" way to go. You can now use the project as any normal project, including changes to pro-files. Also, QtCreator now correctly detects the build directory, so you won't have to change that, even when opening one of the modules.
Second approach: Use as a normal project without qmake:
Run the configure script (and add the -developer-build option)
Run make qmake_all in the same terminal to let Qt prepare all makefiles, create headers etc.
Open the top level .pro file in QtCreator. You can choose any kit.
Go to Project > Your Kit > Build and disable the "qmake" step (the first of the default 2 steps)
Change the "build directory" to be wherever you built Qt - either a shadow build or the source directory
Hit Build and QtCreator will invoke make only, archieving the same behaviour as running make from the console.
This is kind of a workaround and I would not recommend using it for a full Qt build, unless the first approach does not work for you for whatever reason.
This can also be useful if you only want to make changes to a single Qt module, without compiling the whole Qt framework, i.e. you can clone one of the submodules and use your "existing" qmake on it instead of compiling QtBase (in that case, you skip step 4)
Final notice: When I tried opening the whole Qt-Project, QtCreator crashed on my system because the project was to big to handle. I would recommend you to only open one of the modules within the super repostitory, i.e. "qtbase", "qtdeclarative", etc.
Whenever I make a Qt project, the qmake command includes this parameter:
"CONFIG+=qml_debug"
I never use qml and dont want to manually click three times and ignore the warning every time I generate a new project.
It happened to me in a project. I just added this to the .pro file :
CONFIG -= qml_debug
It seems to work.
You can download Microsoft Visual Studio 2017 Community Edition, it's free to use. And it is not only a great IDE but also it has got Qt support. By downloading Qt plug in for Microsoft Visuals Studio you can create Qt projects and build and debug them...
Everything that you do with Qt Creator and it has got no such problem as yours.
Also if you want to stay with Qt creator, check Projects -> Build & Run -> Run Settings. There is Enable QML setting which mine is disabled. Maybe you can disable it from there.
If not I advice you to check Tools -> Options -> Build & Run and Tools -> Options -> Debuggers. If it can be solved within Qt Creator it must be solved from these places.
After migration to QBS my QML debugging stopped working.
I made sure that:
I'm building a debug build, C++ debugging works
I've checked "Enable QML Debugging" in qt creator's Project tab
I've even tried to add qbs properties manually Qt.declarative.qmlDebugging:true Qt.quick.qmlDebugging:true
Still QtCreator says:
Some breakpoints cannot be handled by the debugger languages currently active, and will be ignored.
QML debugging works with an old .pro
My system:
Linux archlinux 4.15.7-1-ARCH
QBS 1.10.1
Qt 5.10.1
It's not so clear, but there are TWO checkboxes.
One at the build step, and another one in the run step.
So to get QML Debugging working you have to check both of them.
I missed the one under the "Projects->Run->Debugger settings->Enable QML"
The upcoming 4.6 release of Qt Creator should be smarter about this and auto-enable the checkbox in the run settings if the one in the build settings gets enabled.
I am new to QT. And I want to use qt to add GUI to an existing project. I moved the original project to a Qt console application. Then I need to add GUI to it. Where should I start from? I took a look at some qt tutorial tutorials which start from creating new widget project. But there are not many about adding gui to an existing project.
I tried to add "QT += widgets gui" and "FORMS = myproject.ui" in the pro file. But I got error: No rule to make target 'myproject.ui', needed by 'ui_myproject.h'.
Also, can someone tell me how to disable shadow build in Qt creator 3.4.2 (based on Qt 5.5.0)? Thanks.
First of all, to disable Shadow build open "Projects" page from the left menu in QtCreator (right after "Debug") - there you can disable Shadow build option both for debug and release builds.
As for adding GUI I recommend you to create an empty Qt project (if you are using Qt 5.0 or greater you should add QT += widgets to your .pro file). There you can create a GUI you need - using forms or manualy as you wish. When your interface part will be complete you can add a non-gui functional part from existing source code. But that is a rather general recommendation as you see