Whenever I use OpenCV's cv::imshow alongside with Qt's QApplication, I get this error:
Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init()
I did some searching and ended up reading more and more about stuff I don't fully understand, but got some ideas how OpenCV and GTK+ are connected. And since the warning is obviously an instruction to call something before something, I included gtk.h and called gtk_disable_setlocale(), but ended up with even more errors.
My code runs despite the warning without any problem, but it really bugs me! And I assume that behind the warning, there are some essential stuff a programmer should understand. So maybe somebody can explain the whole thing in a way an advanced newbie can understand? ;)
Edit:
I'm using ubuntu 12.10, OpenCV 2.4, GTK 2.24.13 and qmake -v tells me
QMake version 2.01a
Using Qt version 4.8.3 in /usr/lib/x86_64-linux-gnu
If you are going to use Qt windowing system, it's best to avoid creating OpenCV windows alongside with Qt windows.
Convert IplImage or cv::Mat to QImage and draw that on a Qt window. Check cvImage, a simple Qt/OpenCV example that displays an image loaded with OpenCV on a Qt window, and also shows the RGB values of a pixel based on mouse coordinates.
Related
I am getting started with qt and especially qt quick now and wanted to do the example from here: https://doc.qt.io/qt-5/qtquick3d-simple-example.html
However already the line import QtQuick3D 1.15 has been giving me headaches. The error that is printed says QML Module not found (QtQuick3D). If I am trying to import other things, I get the corresponding errors.
The error message also tells me "for qmake projects use the QML_IMPORT_PATH variable to add import paths" however I don't know what path and how I should set this?
Another solution I have seen is the one suggested here: https://stackoverflow.com/a/64952178/13533641.
Again I am unsure which path to add here. I tried "/usr/lib/qt5/bin" and "/home/Qt/5.15.2/gcc_64/bin". After setting the value I restarted Qt Creator but the error remained.
The project I have been using is an empty QT Quick application which you get if you create a new project. I just added that one import line.
I have used the Mainainance Tools to check the plugins and I installed something that was named 3D. I am unsure if this is the "normal" qtwidget thing or the one I am trying to use in the code. (Or maybe there is no difference anyway, who knows)
I use qt version 5.15 right now but I also tried installing the 5.9 and 6. Everywhere I have the same problem.
My machine runs ubuntu 20.04 and I installed qt using the official download for linux.
If I am correct, it got installed in the directory /home/Qt.
Does anybody know how to solve this?
After trying different paths and versions of Qt, I found this this instruction here
However I only needed to follow until the picture of the mainaintance tool and not the building afterwards. Before I had already added the additional library for Qt3d. This enough wasn't enough apparently, after adding the Qt-shader tools it and conan it worked however.
I did this after yet another fresh installation of Qt (this time version 6) and it worked now.
Regarding the suggested change for the qml emulation layer: the path that is now set is /home/Qt/5.15.2/gcc_64/bin.
Hope this helps someone in the future!
I would like to know where I'm missing something in my project. In fact, I'm successfully embedding all the files I need in my recipe and all the packages I need (I think). Qt5 is installed in my recipe (I have the meta-qt5 layer) and my app is launching but immediately crashing with this error :
QQmlCOmponent : Component is not ready
qml : actionView test for Vid? is null
QQmlComponent : Component is not ready
qml : action imageTest for Image is null
qt.qpa.xcb : xcb_shm_create_segment() failed for size 1228800
Segmentation fault
I first thought that these error were here because the binary could not find my qml files. I've made some changes to my recipe so that every needed files are embedded and nothing has changed. Then I thought that I was missing some QtQuick packages like the qml plugin one. I also added it, but the error is still the same. My only last thought is that I'm missing another package or that on the yocto side, reading qrc files is not done in the same way then on the pc side ( my app is working perfectly in Qt Creator using Qt 5.12.3).
PS : I also tested to use the binary of my application made by qt creator in the directory "sent" in the yocto image and it works like in Qt Creator. That is make me thinking that the tree of files deployed in yocto is good (it is the same as in my qt project so that make senses but I'm trying everything I can to debug this problem)
If you have any idea on where these errors could come from, I would be glad to hear it.
NB: I have tried asking this question here (on the Qt Project forums), but to no avail for the moment, so I'm trying my luck here.
I’m using Qt 5.0.1 (on a laptop with Ubuntu 13.04), the compiler is gcc 4.7.3 (and I'm working with Qt Creator 2.7.0).
In order to have C++11 working, it seems that simply adding the following line to the .pro file of the project does the trick (or at least it's supposed to):
CONFIG += c++11
However, when I do that, I get a ton of errors in the file qobjectdefs_impl.h upon compilation.
Anyone know how to fix this problem? Thanks in advance!
Edit: Here is a screenshot so that you can see what the errors look like (apparently the errors happen when I do #include <QColor>):
NB: link to the image if it shows too small here.
Edit: I still have the errors after having upgraded to gcc 4.8.1 and Qt 5.1.2, which I compiled from the sources.
Yay, someone (JKSH) found what the problem was on Qt Project forums (here).
In short:
The problem was that I had written somewhere #define I complex(0.0, 1.0), which created a name clash in qobjectdefs_impl.h (where complex was a typedef for std::complex<double>). For some (weird) reason that didn’t cause any problems as long as I didn’t write CONFIG = c+11 in the pro file, but not it did after writing it.
Many thanks to JKSH, and also Greenflow for helping!
Edit: The credit for finding the issue should go to Thiago Macieira from the Qt Project Interest mailing list, see comment.
I am currently using QtCreator 2.4.1 with Qt 4.7.4 development libraries (in Ubuntu) and am trying to track down a bug which after profiling with valgrind seems to occur internally within QGraphicsView::paintEvent(…) method
To help isolate this problem I would like to step into the Qt sources. Having done some searching through both the Qt forums and stack overflow and have not being able to find a way to integrate the sources with my version of QtCreator.
I have currently tried downloading the sources via the QtSDK manager and adding a “Source Path Mapping” within Tools->Options->Debugger. I am sure that this step is where I am making a mistake as I am unable to even switch to source when viewing internal Qt header files i.e. from QGraphicsView.h
I have so far tried adding the following Source Path Mappings
Source Path=/var/tmp/qt-src
TargetPath=/home/paul/QtSDK/QtSources/4.7.4
and
Source Path=/var/tmp/qt-src
TargetPath=/home/paul/QtSDK/QtSources/4.7.4/src
Neither works.
I have also tried building Qt directly from source, adding this to my "Qt versions" list within Qt Creator and creating a new project configuration using this version. This also did not work.
Likewise I have tried adding the src folders to my gdbinit file. This also fails to work.
I am completely lost with this.
Paul
Someone asked a similar question here: Need to step into Qt sources (my IDE is Qt Creator).
Someone else asked about Valgrind errors with Qt here: Suppression files for Qt memory leaks with Valgrind
And here is a little more info about Using Valgrind with Qt Creator along with some explanation about how to read the results. Its a little dated from late 2010.
Related Suggestions
I wouldn't debug the QGraphicsView class just because of all the effort to make it work or find the problem might be for nothing... Qt is moving to using the SceneGraph as the backend for QML and the rendering engine for QGraphicsView might become obsolete.
Updating to the latest stable build of the Qt libraries may make a big difference for QGraphicsView.
If you post the valgrind error you are getting to the Qt Trolls, someone might be able to explain what is going on for you.
There are other debugging techniques besides the traditional debugger. I've been programming in Qt in Windows (without valgrind) and with a large multi-threaded application, that loads a bunch of Dll's. I've had to put some faith into the Object Tree Model clean up and work on all the new calls I put in. Most of the time I just use QDebug to find errors. Then I am also using a combination of qInstallMessageHandler() with QDebug to implement decent logging for the hard to track bugs.
See also Qt Debugging Techniques.
I'm trying to make an unsigned sis package of my application, however I get the aforementioned error from QtCreator.
What am I doing wrong?
Best regards
I've got the same problem with Qt 4.6.3. Qt 4.7.3 creates unsigned .sis files without any issues, but 4.6.x doesn't. If the version of Qt isn't important for you, upgrade to 4.7.
I'm looking for another way to solve this, because I want to support old devices that don't work with Qt 4.7
UPD:
I found two ways to create unsigned sis:
Create a signed sis file with QtCreator and remove signature with Syscontents tool
Copy template .pkg, edit it a bit and create sis with makesis commandline tool.
I used the second way, because I use localized installation file. Localized installations work bad in Qt 4.6.3 out of box, so I had to create custom .pkg file
You can't install unsigned application to the phone. Try to sign it and see if it works better