deploying c++/qml application - packing qml files into bin - c++

I have a c++/qml applicaiton. My/custom qml files are packed in a resource file and loading well. My problem is that when I deploy my application I need to have in bin directory also all the QtQuick/QtQuick2 directories with all their content. Is there a way to have them packed/included in compiled .exe file? In theory I could include all in a resource file, but that seems like overkill.
Is there some way how to handle this?

You can use static linking to make a standalone executable:
https://wiki.qt.io/Build_Standalone_Qt_Application_for_Windows

Related

How can I have dependent third-party library copied to target folder

I have a third-party, native library (API.DLL) that I use in my program. I have written a C++ wrapper (Wrapper.dll) for the API. My application (MyApp.exe) makes calls to methods in the wrapper. The MyApp project references the Wrapper project. When I run my application, I get a FileNotFoundException: Could not load file or assembly 'Wrapper.dll' or one of its dependencies.
The problem is that API.DLL isn't found. When I build Wrapper, the Wrapper.dll and API.DLL files both get placed in the Wrapper\Bin\Debug folder. When I build MyApp, the Wrapper.dll file gets placed in the MyApp\bin\Debug folder, but the API.DLL file does not!
What is the correct/best way to get the third-party DLL in the application target folder when I build my solution?
Add the file to your project, put it the root folder inside the project, make the solution Show All Files, then add it (if not already).
Then change the properties of the file (right click-> properties) to build action=None and Copy to output directory=always or newer (whatever you prefer).
The file will get copied when you build.

Qt5 move qrc to DLL

In my soluton I want to create second, helper app, which will be using the same resources as my main application. So I want do move all my .qrc files to DLL and use it in both apps on the same time.
I choosed dll format because in future my solution will contain shared functions which I will put in that dll.
How should I compile and attach DLL to use resources in both applications like standard .qrc files?
From the resource or build pointo f view there is no difference.
The .pro file of a DLL refers to its resource file exactly the same way as a .pro file of an application would.
The libraries resource "tree" can then be "imported" into the application with the QT_INIT_RESOURCE macro, see http://doc.qt.io/qt-5/resources.html#using-resources-in-a-library

how to make stand-alone setup file of a mfc project including all data files

I have a project in VC++ MFC and works fine with the .mdb files. But just copying the project's .exe file on other system does not let the project work as it searches for the same path as mentioned in the code for the .mdb files and fails to find one. Also, apart from .mdb files, theres a need for certain .ocx files and io library suite to be registered in the system prior to the project's execution. How to overcome this problem?
You need to wrap up all the files into a package also known as installer. One of the most popular (and free) at the moment is Inno Setup. This will produce a single exe file that you will be deploying to users / other machines. You need to make sure that you include all the needed files, libraries etc in your setup.

Qt - How to build a standalone app with OpenCV and Qt

I was able to connect Qtwith OpenCV and the my application is working properly. But now would like that my .exe file does not have any dependencies with .dll files. I would like be able to use my application in another computer without concerns.
I tried to search in several forums but i didnĀ“t find any solution to my problem.
Adding CONFIG += static to my .pro file is enough??
You need to add the CONFIG += static indeed, besides that you need to create a static build of OpenCV, Qt, and statically link it all into an exe.
I shared my setup here.
Just clone the repo and follow the instructions :)
check out bin2h. it can convert your dll file to a header file that you import into your project. you can then write out to file the generated header and then dynamically link it to your executable

How to create logical directory in Qt Creator?

All my source files are stored in one project (physical) directory. Qt creator shows this files in 3 folders: Headers (for *.hpp and *.h), Sources (for *.cpp and *.c) and Forms (for *.ui). But I would like to have a few another logical folder. For example I would like to create logical folder "protocol" logically containing *.hpp and *.cpp files which maintain network connection and so on. I don't want to create a new folder on my disk for these files. I want only logical one in Qt Creator. Is it possible?
One more reason why I need these logical folders is that I would like to see often used files in one place
QtCreator 3.0 has QBS support, a build system that will supersede qmake.
It has Group of files, which is displayed as a virtual folder.
Anyway, having too much files in one folder is always annoying and a bad practice.
By using prefix property of Group you can easily change the path of files.
For qmake projects, the only way it's possible, unfortunately, is by tweaking Qt Creator project manager plugin sources.
Remember that Qt Creator doesn't manage any of those files by itself. The file lists are extracted from project file(s) by a project manager plugin. If/when a plugin adds them, they are added to the project file(s).
You're most likely using the qmake project manager. A "simple" way to do it would be to extract the file grouping from variables with a common prefix. Let's say the intersection of each QTC_Foo with union of HEADERS and SOURCES would be displayed in Foo group.
I think it might be simple to implement, so I might come up with a patch later in this answer. The first step for you is downloading and compiling Qt Creator :)