Examples difficult to use - QtWebkit Examples in particular
I'm facing issues with getting the imageanalyzer example to work. It complains
File does not exist '../shared/shared.qrc'
which is true, but I'm not sure how to fix it (I copied over the examples folder to ~/Documents, imported it in Qt Creator and tried to build, afterwards I even copied the entire qt directory which also didn't help - not sure where shared.qrc is).
So there are two aspects here:
a) Could someone help me to get the example to run?
b) I think that Qt is selling itself under value here - it has amazing examples, but even regarding the normal examples and when I used Qt more regularly I always had problems to use them: Just running them from /usr/lib/x86_64-linux-gnu/qt5/examples won't work due to access constraints, copying parts over will not work because the projects rely on shared files and higher .pro files. Ultimately, I suggest to refactor the examples to be more self-contained. At least for me that would be very helpful.
Thank you in advance.
What seems to exacerbate the whole situation is that Anaconda apparently hijacked my Qt version - I can't switch from 5.6.1 to 5.9.1 or qt4 by setting QT_VERSION. Has this changed? How can I use my proper Qt outside Anaconda? Btw.: I'm on KDE Neon, 64bit on a Lenovo X1 Yoga.
Hi and welcome to devnet,
One way to build the example is to run an out of source build, place the shadow build folder where you have write access and that should simplify things.
Did you make a virtual environment with Conda or did you just install everything in the "root" environment ?
Conda should be entirely separate - it has virtual environments, but they are not active and I installed qt5 outside.
Shadow build is active when I use the copied directory, but if I try it with the original examples directory Qt Creator will complain that it cannot create examples.pro.user (Permission denied). Clear since it's in /usr/lib/x86_64-linux-gnu/qt5/examples
Any idea how to proceed from here? Should I try to compile inside Docker or can I fix my setup (copy example properly, switch Qt version and compile)? Thanks in advance.
I note that the shared.qrc error apparently stems from webkit QML, which I don't care about. If there was a way to only build the widgets example that would be fine by me. If I try to run qmake inside the webkitwidgets subdirectory I get "Could not find qmake configuration file linux-g++", so I still think my setup is broken. That led me to worry about Anaconda in the first place. I'm not sure why its Qt was set globally - I only needed it for PyQt and it was never supposed to be used outside that environment. I have another box (Ubuntu, the one I'm writing from) which has the same problem.
What do you mean by you installed Qt 5 outside ?
Well, if you want to play with the examples, the most simple is to grab Qt's sources, so you have everything at hand.
k0105 last edited by
No Anaconda environment active. I launched bash and did something like
sudo apt install qtdeclarative5-dev qtwebkit5-examples libqt5webkit5-dev libqt5xmlpatterns5 libqt5xmlpatterns5-dev
Thanks - I'll try the source code. I hope it contains the qtwebkit examples as well. Will report back in a few hours.
OK, turns out compiling Qt from sources is annoying, since I need QtWebkit, which is not included in the default compilation and the instructions I find are for compiling it on Windows only. Is there really no easier way? This is horribly tedious considering I just want to take a look at an example.
My systems were simply crap. I just installed an OpenSUSE VM and after an easy
zypper install libqt5-qtwebkit-examples libqt5-creator libqt5-qtxmlpatterns-devel libQt5WebKitWidgets-develQt Creator built my stuff just fine as shadow build (I opened /usr/lib64/qt5/examples/webkitwidgets directly).
Thank you for your help and my suggestion stands: Qt is an amazing platform and I think it could be even better for beginners if the amazing examples were refactored to be more self-contained and thus easier to use.