QT OpenGL QGLWidget cannot be found - qt

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.

Related

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

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

QT multilanguage app

I am new in Qt framework and now, I want to create an app which supports multi-language display. I known there is a way to do: Qt Linguist. I searched, and archieved some information about lupdate, lrelease ... But I just have Qt Creator IDE, how can I run or compile lupdate, lrelease ???
How can I create *.ts file ?
Please give me some code example or guide to do. (I often use Qt Designer to create GUI)
As far as i know, there is no option in QtCreator to use QtLinguist - you have to do it manually. Here you have an excellent documentation about how to do it. I have learned from there also.

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.

compiling libspeex for symbian

I want to use libspeex library in my nokia Qt application. How do I compile speex for this purpose, and how do i add it to my qt project?
Did you check the README file for Symbian?
If you manage to compile it, basically you just need to add a line like this in your .pro file:
symbian:LIBS += c:/path/to/library/speex.lib
(or whatever the resulting library is called).

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