Deployment QML app with minimum Qt libraries - qt

I have an app wirtten with C++ (just simple QML loader) and QML (all GUI and logics).
Now I want to create some package for deployment to other systems. Currently I need it only for Windows so I create a package with Inno Setup.
I packaged my exe file and couple of Qt libraries. To view what libraries I need I used Dependency Walker. But I was surprized that my app was linked with unused libraries:
Qt5Multimedia.dll
Qt5MultimediaWidgets.dll
Qt5Sensors.dll
Qt5Positioning.dll
Also I see these libraries in compiler output: -lQt5Positioning -lQt5Sensors ... etc.
But I don't use no multimedia no sensors no positioning at all!!
In .pro file I use that:
QT += qml quick sql widgets xml webkitwidgets
So my qustion - how can I compile my app without these superfluous libraries?

Related

Integrating ros to an existing qt application

I have a QML, OpenCV application on qt5 which uses qmake and has a .pro file. I want to add publishers/subscribers to my qt project to publish video stream and instructions etc. I tried to use catkin_create_qt_pkg command to create a template and transfer my project to the template but there were numerous problems which made me question my approach. The ros-qt template uses Cmakelist and .ui instead of qml. So, I will need to change some things to integrate them.
First, is it possible to use ros with qmake and .pro instead of cmake. It would be easier to add just ros publishers and listeners to my existing application than changing the entire QML application. If not, how do I convert qmake and .pro to cmake and Cmakelist.txt (assuming that I can use QML with ros). Also, although it doesn't sound well, is it possible to use .pro for qt and Cmakelist.txt for ros in the same package?
Second, is it safe to use qt5 and qml with ros? The ros_qt app template uses qt4, not qt5. Here is the app template.

Deploy Qt-project without QML

It is possible to build Qt-project without QML ? For example, for building project without GUI we should use key -no-gui ? What about QML ? Thanks.
Your project only needs to depend on Qt modules that it actually needs.
In a QMake project file, for example. this is handled via the QT variable.
E.g. to use the QtNetwork module one would do this
QT += network
By default the core and gui modules are enabled, to remove the gui module do this
QT -= gui
The mechanism knows about module inter-dependencies, for example qml depends on core and network so
QT += qml
results in core, gui, network and qml being selected.
Since qml does not depend on gui that could still be removed
QT += qml
QT -= gui
resulting in core, network and qml
Obviously, if you where to select qtquick, then this would also imply gui as qtquick depends on gui and qml

Re-built Qt5.0.2 with OpenGL, how to use with Qt Creator

I need to move my code from a C++/OpenGL and Config.txt situation to a UI friendly space. I was told here to try Qt and installed it in Windows.
The issue I ran into is that it did not support the OpenGL version I needed out of the box and I had to rebuild with the -opengl desktop parameter.
First time doing this, but was able to follow the instructions (and a ton of Google) and it "succesfully" was built. My issue now is I am unsure how to make the files I have work with Qt Creator.
I copied over all the folders from the qt5 folder created by git over to the Src folder in Qt5.0.1/5.0.1/Src but the hellogl example still wouldn't build.
I checked the options and it was pointing to a qmake in Qt5.0.1/5.0.1/msvc2010/bin so I copied over the qmake.exe from qtbase/qmake over to this folder (renaming the old one) and now Qt Creator builds the hellogl example on my Windows system.
My worry is, did I do this the right way? I fumbled around and got something, but is this the way I should have proceeded after I built the qt5 from git? If not what was the way I should have gone about making it all work with the Qt Creator?
The typical way to utilize the modern OpenGL the feature set (post fixed-function pipeline) in Qt is by utilizing a extension wrangler (GLEW) that finds all the OpenGL functions your graphics drivers support BEFORE Qt includes any OpenGL headers.
To accomplish this simply do the following:
If you already haven't, download GLEW (or another extension wrangler if you wish) and install it in your system path. I would recommend the 32 bit package as it will be easier to work with.
#include glew.h in your source code before any other Qt header includes that may use OpenGL headers. Just to be safe, make glew.h the first header included in your source code.
In your Qt project's .pro file add the line LIBS += -lGLEW (mac/linux) or LIBS += -lglew32 (windows).
Note: Beware of using Qt OpenGL wrappers when implementing an application that uses post fixed-function pipeline facilities. Qt 5's OpenGL wrappers all operate using the OpenGL ES 2.0 specification which may cause problems when interleaved with your OpenGL 3/4 code. Even QPainter can become troublesome when performing overpainting on a QGLWidget due to it's heavy use of the fixed-function transformation stack. I am currently developing a library called QGLX that provides alternative Qt wrappers designed for complying to the modern desktop OpenGL specification. The beta will hopefully be released by the end of this year for Qt 4 & Qt 5.

How can I create a new Qt localisation for Qt itself?

Our application is localised and I have pulled in all the standard Qt_*.qm files as well so that my Qt dialogs are translated as much as possible.
However one of our distributors wants to add the Danish translation and its not in the standard Qt translation files.
How can I get Qt to create the file so I can send it off for translation?
There is some information about translation of Qt itself:
http://doc.trolltech.com/4.6/internationalization.html#produce-translations
it's said that templates for qt translation (*.ts files) should be in the ${QTDIR}/translations directory. I can't see them in my Qt4 installation from official Ubuntu repository but I think they should be included in distributions provided by Nokia on official download page.
Edit
Idea how to generate new empty *.ts file for qt itself can be found in translations/translations.pri directory of qt sources. For Qt 4.6.3 it will be
lupdate -locations relative -no-ui-lines -I../include -I../include/Qt corelib gui-ts ../qt_my.ts

Linking GUI app against a static lib in QtCreator

What is the right way to build a library from source using MinGW and then reference it in the GUI application's project? I'm not familiar with gcc and makefiles, but I think there must be a utility which generates makefiles from existing source.
The library itself doesn't depend on anything except the standard C lib.
Thanks!
In the pro file write
LIBS += path/to/your/lib
This will add the reference to the static library. See the documentation.

Resources