Deploy Qt-project without QML - qt

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

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.

how to add GUI to existing Qt project and how to disable qt shadow build

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

Qt Designer vs Qt Quick Designer vs Qt Creator?

I have seen references to all three of these applications on various parts of the Qt website but am completely unclear as to the exact differences between them and whether they are actually separate things or just different names for the same thing, or the name changed over time? Or is one no longer supported? What's the deal with these?
Qt Creator is Qt's IDE. You don't have to use it, but it greatly simplifies Qt development.
Qt Designer is a graphical tool that lets you build QWidget GUIs. Qt Quick Designer is similar, but for building QML GUIs. Both are built in to Qt Creator.
This is explained in a little more detail over at Wikipedia.
I will explain to you the difference between these tools by the approach for what they are used:
Qt Designer: Sub tool used to create/edit widget files (.ui). You can use it to create the graphical layouts (.ui files only). The most use is to design the graphical stuff in PyQt apps. It is installed always when you install Qt, for example it is in the path: Qt5.13.1\5.13.1\mingw73_64\bin\designer.exe. It also be used to edit any .ui file of a Qt C++ application, however it is very limited since only allows to edit the graphical stuff (not C++ logic).
Qt Quick Designer (it refers to Qt Creator): It does not exist, it is integrated in Qt Creator (see below). Is normal to say that Qt Quick Designer allows to edit QML files (.qml), however it is integrated in Qt Creator now.
Qt Creator: This is the so defacto and most powerfull IDE to create QT applications natively (C++ with Qt engine). It allows you to create, edit source code, debug applications, etc. In addition to that, yo can open a .ui file or a .qml file in Qt Creator and it will open and allow you to edit. For example if you open an .ui file it will show you the Qt Designer app embedded in the full integrated Qt Creator IDE. In summary, you can use Qt Creator to open/edit any .ui or .qml file and create Qt/C++ applications. Of course, if the file is .ui then Qt Creator will show you the Qt Designer tool, if it is .qml then it will allow you to edit the QML.
Qt Creator is just an IDE used to build QT applications; both Qt Widgets and Qt Quick can be composed. When writing Qt Widgets applications you can edit your GUI in Qt Designer but in case of Qt Quick applications you use Qt Quick Designer, both integrated into Qt Creator.
Also there is this new tool name Qt Design Studio which uses QML too and can integrate with Photoshop.
Easy way : Qt Creator (Editor with intellisence, autocomplete and Manual, etc + Graphical designer + Debug symbols + templates.) all for you...
Medium way : Qt Creator (Editor without designer, handcoding, intellisence, autocomplete, etc).
Medium-hard way : Any plain text editor + Qt Designer (to prototype your interface). This is my favorite way, I like Vim
Hard way : Any plain text editor..... you know.

Deployment QML app with minimum Qt libraries

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?

Creating a Win32 Application in Qt Creator

I'm looking to create a win32 application in Qt Creator - is this possible? If so, how would I go about doing it? My preference would definitely be to use native C code (and the native API) if possible.
Yes, you can use Qt Creator just as an IDE. It doesn't force you to use Qt or C++ only.
Create project for Qt Console Application
From .pro file remove "QT += core"
From main.cpp remove all Qt stuff
Include required WinAPI headers
Write C-code only
...
Profit
If you don't want to be tied to Qt at all, Qt Creator supports CMake. Create your CMakeLists.txt then open the file as a project in Qt Creator.

Resources