Creating a Win32 Application in Qt Creator - qt

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.

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.

Add MFC to Qt Creator (QMake) project

I need to add some huge classes (non-GUI) that use CString, CArray etc. to my Qt project on Windows, but I am not sure how to use MFC outside of Visual Studio, via Qt Creator QMake (with VS 2017 compiler).
What libraries do I need to link for that?
I found some examples for CMake that use built-in CMAKE_MFC_FLAG but not much information about QMake.

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

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.

QT OpenGL QGLWidget cannot be found

I am new to Qt and I have problem. I downloaded Qt SDK for Open Source C++ development from http://qt.nokia.com/downloads/sdk-windows-cpp, I add C:\QT\2010.05\bin in my PATH. When I start some demo projects it works, but when I create same project (I create a new project and copy the source code from the demo) it shows an error like "QGLWidget cannot be found" (I need to create an OpenGL project). Do I need to add anything else to my PATH? Does anybody know what could be the problem?
Edit your .pro file and add opengl as an option to QT:
QT += core gui opengl
You need to add the OpenGL module in your project file (.pro) as explain in the doc: http://doc.qt.io/qt-5/qtopengl-index.html#details
From Qt 6, you need to use cmake to access this. This is how you would do it:
find_package(Qt6 REQUIRED COMPONENTS OpenGL)
target_link_libraries(mytarget Qt::OpenGL)
For Qt 6+, add QT += openglwidgets instead of opengl, as per the documentation.

Resources