How do I build Qt5.6 with xmlpatterns module enabled? - qt

I've found out that XmlListModel QML element resides in qtdeclarative git submodule and that to include it in the build I need somehow to enable xmlpatterns module of Qt (according to qtdeclarative/src/imports/imports.pro file). The question is how do I do that? The answer should definitely be simple and obvious but Google doesn't give it among the most popular results.

just add framework in you .pro file:
QT += core xml xmlpatterns

Related

Where is qtmultimedia located?

The docs mention how to include and link qtmultimedia:
https://doc.qt.io/qt-5/qtmultimedia-module.html#details
but looking at the maintenance tool:
there don't seem to be any intuitively named libraries. Where is qtmultimedia?
QMultimedia first beta has just been release at qt 6.2. source.
You do not have to dowload further qt extension.
If you want to use it, you have to include QMultimedia and add the following code into qmake: QT += multimedia

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.

Autocomplete in Qt Creator: how to add header files for a cmake project

If I am making a Qt Creater project using cmake, rather than qmake, how can I tell Qt Creator where to look for header files for autocompletion? In CMakeLists.txt, I can specify where to look for heading in compilation, but Qt Creator will not read this until I build the project.
You can make headers show up in CMake by including them in the sources list for a target you're building, alongside the source files. This works for files that are part of your project.
For header files somewhere on your system where the compiler can find them, I'd guess that running CMake (to generate the Makefile) should be enough for Qt Creator to find them.

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.

OpenCV in Qt Creator

Since I am very UNHAPPY with Visual Studio (It's just Junk!) I am trying to use Qt Creator, which seems to be the solution for my c++ projects to get easily run in my Mac also.
But I am using OpenCV. So, How do I set libraries in Qt?
(include folder and maybe some libs)
I am trying with this app:
http://www.qt-apps.org/content/show.php/Qt+Opencv+webcam+viewer?content=89995
But getting many errors since Qt does not know where to find the libraries, where should I enter the paths or something?
Help will be very well appreciated.
Ignacio
I think I have answered 2 Qt questions that recoup what you are asking :
The first answer is about OpenCV integration in Qt: OpenCV with other GUI (like Qt or WxWidgets) on Win32 VC++
And the second about using 3rd party libraries in Qt: How do i reference the qjson.dll file from my qt project?
I know that this is an old thread but this answer might help anyone on unix trying to link to OpenCV 2.3.1 +
It is actually quite simple with pkgconfig. All you have to do is in your qmake file *.pro add the following:
unix {
CONFIG += link_pkgconfig
PKGCONFIG += opencv
}
Thats it if you are on a unix based system.
Warning, the answers above are deprecated & misleading. Just set up your project with CMake, just like opencv 2.x itself is. Then you just set CMake to add $OPENCV_LIBS as a library to link to and you're done. In qt creator, file-->open project and open the CMakeLists.txt file, presto.
Don't use qmake or pro files unless you really want a QT gui. Even then, look at the QT samples in opencv 2.2+ first, I think they use cmake to handle the qt interface.
Partial answer to myself:
See qmake project files, declaring other libraries.
But I think I will have to compile OpenCV for Linux as I don't think opencv.framework will work with LIBS.
Is there any variable like FRAMEWORKS?

Resources