Qt.labs.plarform is not installed only in release mode - qt

I am using FileDialog from Qt.labs.platform 1.1 on win 10 in Qt creator, compilator I use is Desktop Qt 5.15.2. MinGW 64 bit.
In the debug mode is working everthing fine but when I change to release mode I get following error in from the compilator:
QQmlApplicationEngine failed to load component
qrc:/main.qml:6:1: module "Qt.labs.platform" is not installed
I tried things like clean and rebuild or restart the computer and also change the number of import version but nothing helps. Any ideas how to solve that, please?

Check folder, where you are building your release (where *.exe is generated):
does it contains some Qt's *.dll's?
If yes: there is two ways to resolve your problem:
Remove all Qt *.dll's and run your application from Qt Creator (then Qt Creator will take all Qt *.dll's from folder, where Qt is installed).
Or add all needed Qt *.dll's with correct folder structure to folder with your release *.exe (to do it for Windows release use windeployqt tool: https://doc.qt.io/qt-6/windows-deployment.html )
Why you have such error from the compilator?
Because you have some Qt *.dll's in your release folder (beside the *.exe), but not all needed (e.g. you have only Qt6Core.dll). So Qt Creator will find this dll and will try to find other dll's in your release folder. Qt Creator will not check its installation directory to get dll's.
But if you have no Qt *.dll's in your release folder, then Qt Creator will find them in its installation directory.

Related

open a Qt cmake project in Qt Creator always re-run cmake

I took over a Qt project using cmake on Windows platform; every time I open this project in Qt Creator IDE (by open the top level CMakeLists.txt), Qt Creator always re-run cmake for this project. Then when I run this project, even without changing anything, cmake will re-build the complete project (because cmake is re-run).
How can I avoid such re-build? I use cmake 3.12 and Qt Creator 4.10
p/s: I noticed that there is a similar question [1], but the answer there doesn't help to avoid the re-run.
[1] Can I prevent auto-run of CMake at startup of Qt Creator 4?

Build qt5.8 with desktop opengl option (ubuntu)

I built the sources of Qt5.8 with the option ./configure -opengl desktop
Then, I did a make and finally sudo make install. Now I changed the .profile file as pointed here: http://doc.qt.io/qt-5/linux-building.html
But I have a question: How can I start now qt creator ide?
It seems you're looking for qt creator, which isn't bundled in the qt sources and must be compiled separately, however if you want qt creator alongside with your new qt build, download the qt creator alone and install it, after that open the qt creator, go to Settings -> Build & Run -> Qt Versions , from there you can add new qt versions, just point to qmake which is located in your new qt installation (Probably /usr/local/qt5/bin/qmake) , now add a new kit via Kit's tab and then you can use your newly installed qt with qt creator.

Where can I download qmlscene for Ubuntu

MMMMMM#unbuntu:~/QT/test4Qml$ qmlscene main.qml
qmlscene: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmlscene': No such file or directory
My Qt Development Environment does not have qmlscene. I googled it, and I only found *.deb. How should I do it?
As far as I know, Qt is not installed by default in /usr/lib/x86_64-linux-gnu/qt4. That directory is the default path when linux detects a dependency which requires Qt.
Where did you installed Qt? How did you installed it? Did you set the PATH environment variable to where Qt binaries are installed?
Usually, you have to follow the next steps:
1.- Install the the basic requirements for building Qt applications.
2.- Download Qt. I recommend Qt 5 using an offline installer. Otherwise, you'd need to compile from the source. Here you have a list of older versions of Qt.
3.- Set the environment variable PATH to the directory where you Qt bin directory is installed.

QT building project -- static build

I am new to QT. I have just installed Qt 4.7.4 (32 bit) which uses mingw compiler. I have few questions.
Please try to answer these :--
I have created a gui application in QT creator. With build configuration For each QT version one debug & one release now it created a build folder geny-build-desktop-Qt_4_8_1_for_Desktop_-MinGW_Qt_SDK__Debug
Inside this folder three makefiles are there :---
Makefile
Makefile.Debug
Makefile.Release
Inside this folder two folder are there :---
debug ---> contains compiled .exe file
release ---> empty
Q-1> How can I change settings in QT creator to compile my project for the release build ?
On the left toolbar of Qt Creator you will find the button to set the build for your project, set it to release.
With your settings a folder named geny-build-desktop-Qt_4_8_1_for_Desktop_-MinGW_Qt_SDK__Release will be created with a release subfolder in it, containing your compiled binary.
Anyway, it doesn't have to do with static build, it is simply a release build of your binary, still depending on Qt dynamic libraries. The difference is that the debug build is linked to the debug libraries (for example: Qt5Cored.dll), while the release build is linked to the release libraries (for example: Qt5Core.dll).
Release builds are usually optimized and don't include debug symbols, so they are also smaller.
If you think about static linking Qt to your program (i.e. getting a binary which not depends on Qt dynamic libraries) you should be aware that you should get a commercial license.
Try using the CTRL + T combination.

Importing a CMake project in QtCreator

I'm trying to import my Cmake project in QtCreator, which I'd want to use as code editor, but with completition for Qt classes an the possibility to do the build via Ctrl+R
When importing the Cmake project, the QtCreator ide hangs when running CMakeWizard when I try to select RunCmake. If I cancel an empty windows pops up and the project is not generated.
Is it possible to import an existing cmake project in QtCreator?
Ubuntu 10.10 x86_64, QtCreator 2.6
Normally you just do "Open Project" and then select the CMakeLists.txt as the project file. QtCreator will then ask you to run CMake once (to generate a CodeBlocks build file, which is then interpreted by QtCreator). After that you have native support for your CMake project.
It even works with rather complicated CMake scripts.
If you observe hangs etc., you should probably file a bug report with the QtCreator project.
I had a similar issue when qtcreator crashed when opening cmake projects created in older versions of qtcreator. Removing CMakeLists.txt.user and running qt from terminal resolved issue for me.
cd /path/to/project/
qtcreator .

Resources