OpenCV in Qt Creator - qt

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?

Related

QT application on BeagleboneBlack

Hi I have a debian image on BBB I have already installed QT creator on B^3 but the problem is whenever I try to start a new project in qt creator, couldn't see any option of kit. Infact when i add qmake and compiler path the application throws error.
What can I do to solve the problem. Can i directly get the full pack of SDK from qt.io/download ?
You must compile Qt libraries for your device (BBB) on your own, using specified compiler. You can find more information on this topic, here:
Qt Cross-Compilation Options
As soon as you compile Qt libraries for your device, you must move them to appropriate directories (on your BBB).
First, I would suggest learning to cross-compile, it's much faster & more easily maintained when you want to move to new versions. There's a ton of documentation and community around doing this. Windows & Linux both of which are probably dated, but info is still relavent. I've heard it's much easier from a linux host, but that could be biased.
That being said, if you don't want to cross-compile I believe you can simply install the qt embedded libraries. This question may offer some good advice. Once you have the libraries installed, you should be able to use qmake directly to create the Makefile for your project, then you can use cmake, or g++, etc.. to do the actual compiling.
You're likely going to work in command line though, I'm not sure you can run QT Creator on the BBB directly. I could be wrong.

Compiling Qt5: Adding a postfix to the Qt libs and dlls (-qtlibinfix)

I am in the process of upgrading from Qt4 to Qt5.
When I compiled the Qt4 sources I used to configure like this:
configure –qtlibinfix _64_
We did this for the x64 build so that the resulting Qt dlls would be renamed QtCore_64_.dll etc...
We are supporting both 64 and 32 bit builds and this made it a lot easier for us.
However, now with Qt5 it seems the -qtlibinfix option is gone. Is there an equivalent? Or another way a similar thing can be accomplished.
I have been scouring the Qt doc, and I have not found anything yet. Any help would be appreciated.
I'm also porting an app from Qt4 to Qt5. -qtlibinfix works for me as expected on Windows, building Qt 5.4.0.

Where to obtain qmake (QT) compiler for netbeans?

I would like to use netbeans 8 for make QT applications. How ever, I have to specify the qmake file, which is for compiling QT apps. Is there any official source where I can get it? I tried google a lot, but haven't found any normal place. Thanks for the help in advance.
qmake is a program that compiles Project Files (.pro) into a Makefile. Think of it as "autoconf" of Qt world. To compile a Qt project, you only need to perform 2 steps,
run qmake to generate a Makefile from the Project File (.pro)
run make to build your application
netbeans.org has a step-by-step guide how do set things up,
https://netbeans.org/kb/72/cnd/qt-applications.html
qmake is a Qt specific replacement for the make utility, not a compiler. It is part of the Qt distribution actually... Just checked here, yes, it is part of the libqt4-devel package. Note that obviously you need the Qt development packages in addition to the runtime Qt packages.

Convert project Qt to file .exe for window

Hello i'm a young develop on Qt. I want to know that can we convert project Qt (header, source, form, resource) to a file can run without Qt Creator? And how can we convert it to a file executable on window (.exe)?
The compiler is responsible for making an executable out of the source code. This has nothing to do with Qt.
When you start a program from the QtCreator an executable file is built by the compiler, then started. Have a look in your project folder to find that .exe file.
You dont have to do anything special. Each Qt project has a .pro file that is used for compiling. You need to use qmake on the command line with the .pro file as input. This will generate a makefile that you can then give to nmake.exe (if using Visual Studio compilers) or mingw-make (if you are uisng mingw compilers) to build. These steps will compile your source code into the .exe. Look through documentation of qmake to know more. Qt Creator also does the same steps and you can check out the buildlog in Qt Creator to see it working.
Yes, the exe file that you compile with Qt Creator or alternatively some other IDE or compiler is technically all you need to run the project from there on, except you need to have the linked Qt libraries somehow available to the executable. This is especially important if you plan to run it on a machine different from the one you developed it on. See the Qt documentation on Deploying Qt Applications for other details you may need to consider in that case.

Qt3 on Windows?

I need to port one of my old program to Windows. The current version uses Qt 3 on Linux.
I'd like to see it within few days only to do some tests.
Instead of porting my code on Qt 4 (no time now), is it possible to recompile on Windows with Qt 3? Do I also need minGW? Which problems may I have doing this porting?
I can't find Qt 3 for windows, can someone give me a link? or I can use the same qt source I use on Linux?
Yes, you can !
Download the qt-win-3.3.x-8 project on Sourceforge.
QT4 still has back-compatible QT3 classes, prefixed with Q3* (see http://qt-project.org/doc/qt-4.8/qt3support.html)
You should be able to compile & run you QT3 app on QT4 via those classes with minimal adaptations.
Qt-3.2 for Windows was also distributed in a CD bundled with the book "C++ GUI programming with Qt3" at no additional cost with a license for non-commercial use.
ISBN: 978-0131240728
The supported compilers were MSVC and Borland. MingW is not mentioned.

Resources