I'm getting this message when I try to add any resource to the project via Add > Qt resource file
Qt Creator v8.0.1 Qt 6.3.1
How could I set it to add the files automatically?
I also have no 'resources' folder under the project tab.
Related
The application version i setted it is not displayed on the properties of the created .exe file.
I use cmake not .pro file.
QApplication::setApplicationVersion("1.0.0");
I have opened a CMake project using QtCreator. The project builds successfully; however, I cannot see the source tree in the repository browser. My question is, how do I make the source tree visible in QtCreator after importing a CMake project?
Qt won't show files in the projects tab if they aren't used as a source for some target. If you add your source files path to CMakeLists.txt add_executable(), they will show up correctly.
I have a QML plugin compiled (to a .so) by another project. I want to re-use this in my own QML application without re-building it each time. I want to copy the .so over and, with minimal additional code, be able to write:
import QQuickMapboxGL 1.0
at the top of my QML files and have it work.
Where do I need to copy the .so in my QML project, and how do I need to add it to the project so that the QML runtime can find it?
What I've tried:
Create a QQuickMapboxGL directory with libqmapboxgl.so in it.
Create a qmldir file in that directory with the contents:
plugin qmapboxgl
Add the following to my .pro file:
INSTALL_DIR = $$PWD/../install
target.path = $$INSTALL_DIR
# Copy the QQuickMapboxGL folder to the install directory
plugin.files = QQuickMapboxGL/*
plugin.path = $$INSTALL_DIR/QQuickMapboxGL
INSTALLS += target plugin
Add a make install build step.
The result of this mad hackery was:
plugin cannot be loaded for module "QQuickMapboxGL": Plugin verification data mismatch in '/my/build/QQuickMapboxGL/libqmapboxgl.so'
I have verified that the plugin and my application are both being compiled with the same version of g++ (g++-5 (Ubuntu 5.4.1-2ubuntu1~14.04) 5.4.1 20160904) and the same Qt download (5.7.0).
The main problem is that the .so is not a QML Plugin; no class inherits from QQmlExtensionPlugin or related. It is just a shared library of code.
Was able to workaround this by:
Adding the header files for MapboxGL to my project
In my main.cpp:
#include "3rdparty/mapbox-gl-native/platform/qt/include/qmapbox.hpp"
Calling QMapbox::registerTypes(); (inside main)
Copying libmapboxgl.so (built via Mapbox's make/cmake) inside a libs directory.
In myproject.pro adding: LIBS += -L./libs -lqmapboxgl
In my QML code import QQuickMapboxGL 1.0 and then using MapboxMap
Copying libmapboxgl.so to somewhere that is referenced by LD_LIBRARY_PATH
I have a custom Manifest file and would like to embed it inside the executable. I use MS Visual Studio 2010 compiler and Qt 5.2.1.
I use Qt Creator as the IDE and CMake for making release builds.
What options should I set in .pro and CMake files?
I tried to pass '/MANIFEST...' like flags to the linker, but they seem to be unsupported by VS 2010 linker.
Eventually I've found the solution.
First it is necessary to add the following line to the .pro file:
CONFIG -= embed_manifest_exe
this will disable embedding of the default manifest file. After that it is necessary to add a windows resource file:
RC_FILE = app_resources.rc
.rc file is usually included to embed version information into .exe, but as soon as manifest is also a part of the executable resources we could reference a custom manifest file in it, just add the following line into app_resources.rc:
1 24 myapp.exe.manifest
where 1 is the resource ID, 24 is the resource type - RT_MANIFEST, and myapp.exe.manifest is the file with our custom manifest.
If you don't need version info then app_resources.rc may contain just this single line.
That's it.
For CMake the steps are as follows:
1) include app_resources.rc in the list of sources of the target
2) add the following line to disable embedding of a default manifest file:
set(CMAKE_EXE_LINKER_FLAGS "/MANIFEST:NO")
For some unknown for me reasons /MANIFEST:NO didn't work in .pro file. The linker failed with an unknown option error. However it works in CMake. The linker is the same from VS 2010...
Using below qmake script based manifest injection you do not need to include the manifest in any *.rc file (works for MakeFile based compile where qmake does generate the MakeFile)
QMAKE_MANIFEST = $$PWD/x86_user.manifest.xml
Note:
this works even if we have set the RC_FILE = Res.rc (i.e. since this takes action and injects the manifest to .exe after the compile is done)
you need to recompile to see effect...
I can't help you with the qmake side, but for CMake, you should be able to just list the manifest file as one of the sources of the target. This requires CMake 3.4 or later (see release notes).
The path to the static Qt library is wrongly setup by cmake under QtCreator (windows):
it should be C:\Qt\Qt5.2.0\msvc2012-static_64\qtbase
instead it get configured to D:\GitHub\MyProject where the project lives.
So linking fails.
Here is what i checked so far:
The QTDIR environnement var is correctly set by QtCreator to C:\Qt\Qt5.2.0\msvc2012-static_64\qtbase
The project works well with a dynamic version of Qt 5.1.1, both with QtCreator 2.8 and 3.0
For what i understand, the cmake command find_package(Qt5Widgets REQUIRED) is responsible for finding and including the Qt modules.
Here is the corresponding part of CmakeCache.txt:
//The directory containing a CMake configuration file for Qt5Core.
Qt5Core_DIR:PATH=C:/Qt/Qt5.2.0/msvc2012-static_64/qtbase/lib/cmake/Qt5Core
//The directory containing a CMake configuration file for Qt5Gui.
Qt5Gui_DIR:PATH=C:/Qt/Qt5.2.0/msvc2012-static_64/qtbase/lib/cmake/Qt5Gui
//The directory containing a CMake configuration file for Qt5Multimedia.
Qt5Multimedia_DIR:PATH=C:/Qt/Qt5.2.0/msvc2012-static_64/qtbase/lib/cmake/Qt5Multimedia
//The directory containing a CMake configuration file for Qt5Network.
Qt5Network_DIR:PATH=C:/Qt/Qt5.2.0/msvc2012-static_64/qtbase/lib/cmake/Qt5Network
//The directory containing a CMake configuration file for Qt5Widgets.
Qt5Widgets_DIR:PATH=C:/Qt/Qt5.2.0/msvc2012-static_64/qtbase/lib/cmake/Qt5Widgets
Here is what's shown in QtCreator (v3.0.0):
The missing icons indicate that the file has not been found by QtCreator.
When i right click on one of them and click on "Show in Explorer", it opens the explorer in "Computer"(where you see all your drives) so not on the right place !
I already spent a few days on the problem, any idea is welcome :)