Qt creator 4 cannot find QCamera - c++

I want to use QCamera, but Qt Creator 4.0.1 with Qt 5.6.1 says that such files do not exist, when I'm trying to include it:
#include <QtMultimedia/QCamera>
I've tried it also without the QtMultimedia/ beforehand. And also autocomplition menu.
My System is Debian Testing. This is a C++11 project.
My Project.pro file looks like this:
QT += core gui opengl multimedia
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Classifier
TEMPLATE = app
QMAKE_CXXFLAGS += -std=c++11
[..]
I have deleted QT += multimediawidgets, because QT warns, that it is unknown.
Although libqt5multimediawidgets5 is installed. Or do I need more packages for that?
I have tried the following:
I have rerun qmake,
Closed Qt Creator, deleted Project.pro.user and reconfigured the project
Checked if all packages are installed - I hope so. qtmultimedia5-dev qt5base-dev. And libqt5multimediawidgets5 ... Would be to long, to list all, which does not mean, that I have all necessary ones.
Added the options QT_SELECT=qt5 and QTDIR=/usr/share/qt5 qmake --version to the project.pro file. Found it in some stackoverflow answer where a user guessed you could use that to enforce qt5. Because I wasn't sure, if it doesn't use Qt4. But the options do not even get highlighted. But not marked as errors either.
Tried to write 'class QCamera' to my mainwindow.h and include QCamera in the mainwindow.cpp file as seen in a Youtube tutorial
Tried the Camera Example Project, which doesn't work either
Checked, if Qt5 is available in the options menu
As mentioned, I have also Qt4 stuff installed. I have also an old project, which was set up in Windows and uses QCamera. There Qt Creator cannot find it either.
If this does not work anyway on Debian for some reason, what is an alternative -compatible with Qt?

Ubuntu 14.04 with qt5-base, qtcreator and qtmultimedia5-dev recognizes it. And there was an error in the ui mainwindow.h which occurs, if you use a qt4 project with qt5. So it used qt4 on Debian, even though qt5 is installed. But I have no idea how I can enforce qt5 in Qt Creator. So it seems to be a Qt Creator problem. This is actually no direct solution, but it works now (for me). But if anyone knows how to enforce qt5, I would appriciate it. Because Ubuntu is only a workaround

Related

Where is Qt QOpenGLWidget?

I'm trying to write a C++ application that uses QOpenGLWidget, but Qt Creator gives a "'QOpenGLWidget' file not found" error on this line:
#include <QOpenGLWidget>
The documentation says QOpenGLWidget was introduced in Qt 5.4, and I believe I am running Qt 5.12.1; qmake --version gives:
QMake version 3.1
Using Qt version 5.12.1 in /home/oreilly/Qt5.12.1/5.12.1/gcc_64/lib
Moreover, in the Qt Creator menu Tools -> Options... -> Kits also indicates Qt 5.12.1. And Qt Creator allows me to use #include <QOpenGLWindow> (also introduced in Qt 5.4 along with QOpenGLWidget), compile and link the OpenGL application without error.
What am I doing wrong? Where is QOpenGLWidget?
QOpenGLWidget is not part of the main QtCore/QtWidgets libraries; rather it is part of a separate (QtOpenGL) library whose headers are in a directory that is not part of the Qt include-path by default.
Fortunately, it's easy to add QtOpenGL's headers to the include-path; just insert the following line into your .pro file:
QT += opengl
... and then run qmake to update your Makefile/Project file, and you should be able to compile using the OpenGL classes.
At least for Qt 6 for the QOpenGLWidget Class one wants:
qmake: QT += openglwidgets
Source: https://doc.qt.io/qt-6/qopenglwidget.html
For the QOpenGLWindow Class one wants:
qmake: QT += opengl
Source: https://doc.qt.io/qt-6/qopenglwindow.html

How to make Qt Creator 4.5 to show build-in documentation in tool-tip?

I have problem with Qt Creator version 4.5. I made fresh installation of QT opensource 5.9.4. When You place the mouse over any Qt function/class it shows a pop-up, but in my case without documentation: broken tool-tip. How to fix it?
P.S. I'm using ClangCodeModel.
EDIT: I wasn't able to fix this issue, but in QtCreator 4.13.3 problem is fixed.

QMainWindow: No Such File Or Directory

I'm using QT Creator 3.5.1 and QT 4.8.2 on Ubuntu 14.04 LTS host machine, I configured my BeagleBone Kit for ARM crosscompiling like this:
I'm following these steps, but I'm getting an error when trying to compile the default QT project
Am I missing something? If it's not found, it is not located at place where compiler looks. How do you fix this?
Here is my project file
Using Qt 5.8.0 on Win 7 / MSVC2015x64bit;
I had the same issue and I found a way to fix it, even if its not the smartest:
1) Open your projectname.pro file
2) Between
QT += core gui
and
greaterThan(QT_MAJOR_VERSION, X): QT += widgets
paste QT += widgets
so this part looks kinda like this:
...
QT += core gui
QT += widgets
greaterThan(QT_MAJOR...
Save and close the .pro file and wait for Qt to automatic read the
file-changes and updating itself.
(If you have deaktivated this try restart Qt)
Aswell as this - replacing the "X" at greaterThan(QT_MAJOR_VERSION, X): QT += widgets with the pre-version's number works fine for me. (X = your_major_version - 1)
(In case using Qt 5.x place a 4 instead of 5, using Qt 3.x replace 3 with 2 and so on...)
I dont know if this also works for other platforms...
I hope i could help at least 1 person who has the same issue. ;)
Greetings Zitro
Mybe there was some error while your building qt from source, or something is missing. Try search QMainWindow.h in qt include dir. Seems like it is in /usr/local/qt4.8.2-armhf/include. For am example you can search like this find * /usr/local/qt4.8.2-armhf/include/ | grep QMainWindow.
First of all you need make sure, that cross compiler works,
compile hello world: std::cout << "hi\n" and run on device using cross comipler gcc from command line.
Second step is making sure that qmake from cross compiled Qt works as expected, run /usr/local/qt4.8.2-armhf/bin/qmake path/to/your/pro/file && make if all works then next step
Third, at last configure your Qt Creator
Look here: http://developer.toradex.com/how-to/how-to-set-up-qt-creator-to-cross-compile-for-embedded-linux
You need set sysroot to right value, for example in my case this is:
/usr/local/oecore-i686/sysroots/armv7ahf-vfp-neon-angstrom-linux-gnueabi/
inside this directory there "bin" and "lib" full of arm executables and arm libraries, this is what "sysroot", it is part of your device file system cloned to your cross compiler, that help you link your applications. Also make sure that you set right path to qmake for cross compilation in Qt creator preferences, it should like this: /usr/local/qt4.8.2-armhf/bin/qmake
Perhaps your QT Creator version is out of date. Projects can become corrupted if you install a version of QT Creator that is incompatible with them. You can download the latest version of QT Creator in the Software Center.
You also need to make sure your QT is up to date. Check using the Software Updater.
I found this; you might want to take a look at it: derekmolloy.ie/beaglebone/qt-with-embedded-linux-on-the-beaglebone/#Source_Code
On windows check that your project folder doesn't have strange characters like: ( , ) or # ...

1.Project ERROR: Unknown module(s) in QT: webkitwidgets

Well, I was trying to use QWebView. As I learned from the internet, I should, and also this line webkitwidgets in .pro file after QT +=. So I added it and get this error:
Project ERROR: Unknown module(s) in QT: webkitwidgets
I know that a lot of people already asked about this error, but most of the answers were to install libqt5webkit5-dev using this command line: sudo apt-get install libqt5webkit5-dev.
The problem is, that I am on Windows, not on Linux, so this can't be useful for me.
The weird thing is, that I have Qt5WebKitWidgets.dll and Qt5WebKit.dll in C:\Qt\Tools\QtCreator\bin, so I suppose, that I have everything I need to use QWebView and to add this line QT += webkitwidgets without getting any errors.
Also, I learned that WebKitWidgets is no longer supported after QT 5.0 and newer(or something like that), and I should use QtWebEngine, but I don't understand how to use it in Qt Widgets Application with QWebView.
You're mixing up Qt Creator (an IDE) and Qt — the development toolkit itself. It absolutely doesn't matter what's bundled with Qt Creator — whatever is there is used solely by Qt Creator since it is also built using Qt.
You need to look in your Qt's installation directory, under mkspecs/modules. Each module has a .pri file. You should see both qt_lib_webkit.pri and qt_lib_webkitwidgets.pri. If you don't, that would mean that the modules weren't built for the Qt that you're using. The modules folder is where qmake looks for Qt module definitions.
If you're using a prebuilt recent version of Qt, it's likely that it is built with WebKit turned off. The workaround would be to go to a previous minor version (say 5.4 instead of 5.5), or to build Qt yourself.
Similar to Kuba Ober's answer, I got it to work by copying the webkit and webkitwidgets pri files from a previous installation, 5.5.
~/Qt/5.5/clang_64/mkspecs/modules/
The weird thing is, that I have Qt5WebKitWidgets.dll and Qt5WebKit.dll in C:\Qt\Tools\QtCreator\bin, so I suppose, that I have everything I need to use QWebView and to add this line QT += webkitwidgets without getting any errors.
Thats because windows dlls must be on the path or on the base path of the app, is just the way of windows of doing things. You can see that if you install qtcreator on windows, the app will be without dlls on the lib folder. Everything will be on the bin folder

Header location issues while porting Qt code from Windows to Ubuntu

I'm trying to port code written in Qt on Windows to Qt on Ubuntu. The problem I'm facing is that it gives me this error for my ui_windowform.h header:
error: QtWidgets/QApplication: No such file or directory
I searched on Google for solutions but didn't find anything relevant. I've also added INCLUDEPATH += $QTDIR/include/qt4/QtGuito .pro file.
I mostly of agree with LukasT, but Qt 4 does still have QApplication, however it is located in a slightly different location :) .... or maybe :(
You should find it here: .../qt4/QtGui/QApplication .... or somthing like that, I can't quite recall now...
But I would definatley try to keep your Qt version the same on each platform then you garantee that you will have no Qt lib issues... compiler on the other hand is not garanteed :o (but I would not worry too much about that)
It looks like the original Qt code uses Qt5, QtWidgets/QApplication rings the bell from me [1] and you are pointing to Qt4 in Ubuntu. You should try to install Qt5 in Ubuntu.
[1] http://qt-project.org/doc/qt-5.0/qtwidgets/qtwidgets-index.html