In Qt Creator, examples are missed - qt

Installed Qt Creator 2.8 in ArchLinux
Installed qt5-* (* as every related package) using pacman
examples were not available in the repositories so I used the one in the AUR, qt5-examples
examples are installed under /usr/share/doc/qt/examples
qmake-qt5 -query says:
QT_SYSROOT:
QT_INSTALL_PREFIX:/usr
QT_INSTALL_ARCHDATA:/usr/lib/qt
QT_INSTALL_DATA:/usr/share/qt
QT_INSTALL_DOCS:/usr/share/doc/qt
QT_INSTALL_HEADERS:/usr/include/qt
QT_INSTALL_LIBS:/usr/lib
QT_INSTALL_LIBEXECS:/usr/lib/qt/libexec
QT_INSTALL_BINS:/usr/lib/qt/bin
QT_INSTALL_TESTS:/usr/tests
QT_INSTALL_PLUGINS:/usr/lib/qt/plugins
QT_INSTALL_IMPORTS:/usr/lib/qt/imports
QT_INSTALL_QML:/usr/lib/qt/qml
QT_INSTALL_TRANSLATIONS:/usr/share/qt/translations
QT_INSTALL_CONFIGURATION:/etc/xdg
QT_INSTALL_EXAMPLES:/usr/share/doc/qt/examples
QT_INSTALL_DEMOS:/usr/share/doc/qt/examples
QT_HOST_PREFIX:/usr
QT_HOST_DATA:/usr/lib/qt
QT_HOST_BINS:/usr/lib/qt/bin
QT_HOST_LIBS:/usr/lib
QMAKE_SPEC:linux-g++
QMAKE_XSPEC:linux-g++
QMAKE_VERSION:3.0
QT_VERSION:5.1.0
which means examples are in the right place
But they are not shown in Qt Creator!
How can I bring them in qtcreator?
PS: I don't wanna forget about the solution and install SDK.

I know OP asked for archlinux but I faced the same issue with Ubuntu 20.04. To solve it I had to install the following two packages:
sudo apt-get install qtbase5-examples qtbase5-doc-html
This will show the basic widget examples.
Additional examples (e.g. qt quick) can be added by installing them explicitly:
sudo apt install qtquickcontrols2-5-examples
To actually get them displayed in qtcreator I had to install:
sudo apt install qt5-doc qt5-doc-html
Here is the output of echo $(apt-mark showmanual | grep -P '(libqt|qt)')
cmake-qt-gui qt5-default qt5-doc qt5-doc-html qtbase5-dev qtbase5-doc-html qtbase5-examples qtcreator qtquickcontrols2-5-examples
Edit:
Also make sure to install the qml modules you need, for example:
sudo apt install qml-module-qtquick-controls2

QtCreator Examples are added in Official Repository 'Extra'
https://www.archlinux.org/packages/extra/any/qt5-examples/
install it using :-
sudo pacman -S qt5-examples

Navigate to the installation location of the examples and open the .pro project file with qt-creator.
Alternatively if you just want to build and run the example. Navigate to the directory qmake and then make and then simple run the output
Additionally if you strictly require the examples to show in the IDE, try launching with admin privileges as the installation directory of the examples may require admin privileges.

My situation is that qt example folder has no permission to read and execute for non-root users, fixed it and everything OK. In your case:
sudo chmod +rx /usr/share/doc/qt/examples

I am also using archlinux and have had the same problem. Despite not having the examples & demo installed the qmake-qt5 -query is printing a non-existence path.
It seems Qt5 examples are now on AUR(Arch User Repository).
To get the them
Download https://aur.archlinux.org/packages/qt/qt5-examples/qt5-examples.tar.gz
Extract the package maybe with $ tar xzf qt5-examples.tar.gz
cd qt5-examples which contains the PKGBUILD . Then run makepkg .This will download 165MB qt-everywhere-opensource-src-5.2.0.tar.xz
Run pacman -U qt-everywhere-opensource-src-5.2.0.tar.xz

Qtcreator cannot detect the example without its html file.
So, in my case I've already installed qtbase5-examples, but could not able to see examples in qtcreator.
After,
sudo apt-get install qtbase5-doc-html
examples are visible in qtcreator. It was the same with qt5serialport-examples.
sudo apt-get install qt5serialport-examples qtserialport5-doc-html
Have a nice one.

make sure you run the qt-opensource-linux-x86-android-5.4.0.run like this:
$sudo ./qt-opensource-linux-x86-android-5.4.0.run
please do not forget the "sudo"
or you will find that the examples in the qtcreator is missing.

Related

Using qmake without Qt Overhead?

We have some smaller libraries we use in our bigger project quite often.
Still we compile and run the unit tests of these smaller libraries as independent CI Jobs.
Most of these libs use QMake as buildtool, not using Qt in any way. And we started to move our CI-Jobs into docker containers. Now I realized that I always have to get qt5-default (on Ubuntu 16) for qmake to work. Is this intended? This gives quite a signifacant overhead. Does anybody know a way, to use qmake on Ubuntu 16 wihtout getting the whole Qt instalation on board?
You don't actually need Qt installed for qmake to work. The reason why you need qt5-default is that most linux distributions provide both Qt5 and Qt4, which have the same binaries, for example they both have a version of qmake, which would both get installed to /usr/bin. In order to fix that problem Qt5 installs to /usr/lib/.../qt5 and Qt4 to /usr/lib/.../qt4, and the qt5-default package creates symlinks from there to /usr/bin
For Ubuntu , ... is x86_64-linux-gnu!
You can choose between:
Install only the qt5-qmake package in your docker container and create a symlink /usr/bin/qmake -> /usr/lib/.../qt5.*
Specify the full path to the qmake binary when building your software, inside your {travis, gitlab, jenkins} CI config
Add /usr/lib/.../qt5/bin to your $PATH
* The proper place for a manually created symlink would actually be /usr/local/bin because if you have the symlink in /usr/bin, installing qt5-default package would fail because the symlink qt5-default wants to create would already exist. However, you are in a docker container and can actually control whether qt5-default gets installed, and if you create the symlink in /usr/local/bin you have to make sure to add /usr/local/bin to your $PATH, which is overkill for that scenario.

How to install wkhtmltopdf patched qt without compiling?

I'm using google cloud instance for host Odoo, somo reports print to pdf ok, but other with custom paperformat get the following error:
"The switch --header-spacing, is not support using unpatched qt, and will be ignored.The switch --header-html, is not support using unpatched qt, and will be ignored.The switch --footer-html, is not support using unpatched qt, and will be ignored.QXcbConnection: Could not connect to display"
I google it, and to solve I need to compile wkhtmltopdf like this:
http://www.grobak.net/id/blog/how-fix-wkhtmltopdf-failed-error-code-6 but this proccess need 3 hs and I'm building a script to install google instances on the run with odoo dependencies.
the .deb package have a dependency broken
Anyone know other solution?
My system configuration is Ubuntu 14.04 and 64 bit. So, i am downloading according to that.
First you have to check your system OS name by
lsb_release -a
Check to see if your Ubuntu Linux operating system architecture is 32-bit or 64-bit, open up a terminal and run the following command below.
file /sbin/init
Download wkhtmltopdf patched with qt using below command
sudo wget -P Downloads https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb
Here, replace "trusty" with your OS name and if 64 bit only then keep "amd64" like that , otherwise change it to "i386" and down load the deb file.
After that execute the following commands,
cd ~/Downloads
sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb
Now, check wkhtmltopdf version with below command,
wkhtmltopdf -V
Enjoy!!
After trying many ways I finally made it work.
First I removed all my previous installation by
sudo apt-get remove --purge wkhtmltopdf
sudo apt-get autoremove
Then I opened wkhtmltopdf.org and navigated into their Downloads > Archive. In Archive section I downloaded 0.12.1 .deb version by
wget <copy the link from website for the.deb file and paste it in terminal here>.
sudo dpkg -i <package name>
sudo cp /usr/local/bin/wkhtmltopdf /usr/bin
This is because odoo looks for wkhtmltopdf in /usr/bin directory otherwise gives IOError. I also set my webkit_path parameter in Odoo System Parameters to /usr/bin.
Thats it. Hope this helps
I was facing same issue with wkhtmltopdf 0.12.4
installed new version of wkhtmltopdf 0.12.6-1
follow below commands to install wkhtmltopdf 0.12.6-1
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.centos7.x86_64.rpm
yum localinstall wkhtmltox-0.12.6-1.centos7.x86_64.rpm #centos specific command

Get Qt5 up and running on a new Mac

Coming from Ubuntu I bought a new iMac and tried to setup my Qt development. Everything else is already up and running. Xcode command line tools are also installed.
Because it surprised me how good brewand brew caskworked I wanted to install Qt5with them. On the one side it is very fast and I do not have to got to any homepage in order to download it. On the other side I do not have to care about the installation directory. Having multiple version installed should also be a lot simpler though.
I used the following commands:
brew install qt5
brew cask install qt-creator
Qt5 is now installed under /usr/local/Cellar/qt5/5.4.1. I also added the bin folder to my path (done in .bash_profile). QtCreator, Linguist and all the other applications are shown in my launchpad. But unfortunately, it is still not done.
QtCreator says that no version of Qt is known. I tried to add qmake but I was not able to navigate to the folder mentioned above.
Could anybody give me a hint on how to fix this issue? Installing qt via installer should be the last option.
I had similar issue with Qt Creator, now on Mac GUI applications do not have access to environmental variables (in previous versions it was different).
You need to setup path to qmake in Qt Creator manually using Command-Shift-G in Finder to navigate to Folder you need.
Another option is to use brew link qt5 --force, which will symlink the various Qt5 binaries and libraries into your /usr/local/bin and /usr/local/lib directories. This will give you qmake at the command line, without requiring you to add anything special to your path in .bash_profile. The main reason this isn't done by default is that Qt4 is also somewhat popular.
It could get a little messy, but if you need to install Qt4 as well, you can unlink Qt5 at any time, by doing brew unlink qt5, and it will keep the installation intact. Then do brew install qt to get Qt4, which unlike the brew installation for Qt5 will indeed create the links directly into /usr/local without you having to manually do brew link qt. You can unlink Qt4 and relink Qt5 (or vice-versa) whenever you need to switch.
In my cases I needed to set it in Preferences => QT Versions => Add. Environment variables also did not help. Small popup when starting app also did not work.
I use command like this:
brew install qt#5
and. success install qt5 by brew.

No documentation available in Qt Creator

When I hit F1 while the cursor marks a classname in the source code, I get the message on the right side of my IDE: "No documentation available."
How can I fix this?
I run Qt on Linux Mint 17.1 and I'm just getting familiar with Linux :-)
Thank you.
As #WCoder suggested, run:
rm -fr ~/.local/share/QtProject* ~/.config/QtProject*
In addition, install Qt, the latest version of which is 5.5.1 at the time of writing this post: https://download.qt.io/official_releases/qt/5.5/5.5.1/
In Qt Creator, go to Tools → Options → Help → Documentation and add all the *.qch files in ~/Qt5.5.1/Docs/Qt-5.5 and the one in ~/Qt5.5.1/QtWebView/1.1/ (assuming you installed Qt into your home directory, ~/ ).
I had a strange problem (freeze after start QtCreator) and I got it fixed after remove the diretory ~/.config/QtProject
May be this is a problem too: ~/.local/share/QtProject
You can reload the help files with the qtcreator options.
In case QtCreator was installed from a system repository via sudo apt install qtcreator then one will need sudo apt install qt5-doc to get IDE's integrated help files.

qtcreator examples not enabled

I installed qtcreator on a Ubuntu 11.10
sudo apt-get install qtcreator
the versions installed are: QT Creator 2.2.1, QT 4.7.3
When i start qtcreator, to explore QT C++ examples the button is greyed out/disabled and it says Examples not installed.
Neither does qtdemo show any demo/documentation?
Do i have to install examples, doc separately? If yes, how?
How can i enable examples in qtcreator and documentation in qtdemo?
EDIT:
In response to one answer below from #Murtuza Kabul, I tried many things to point qtcreator to correct qt but could not. So I did uninstall qtcreator and qt-sdk and reinstalled qt-sdk. So now qtcreator is what comes with qt-sdk . It still says examples not installed.
I downloaded Qt 5.1 directly from qt-project.org and installed as admin (with sudo) on Linux Mint 12 (based on Ubuntu).
If I started qtcreator as normal user I didn't have examples but if started qtcreator as admin (with sudo) I had all examples.
My problem was with examples folder privilages. It was the only folder without read/execute privilage for all users (/opt/Qt5.1.0/5.1.0/gcc/examples). All other folders inside (and outside) examples had privilages for all users.
EDIT:
I forgot to say - as HostileFork mentioned in comment - sudo chown -R +rx /opt/Qt/5.1.0/gcc/examples was solution to this problem.
EDIT:
As noted by Climax - it should be chmod instead of chown
sudo chmod -R +rx /opt/Qt/5.1.0/gcc/examples
You also need to install qtsdk. It comes with the examples and binaries required to run the qt project. If you install the sdk, it will provide you an interface to update the sdk and install/uninstall different parts of the sdk whereby you will be able to choose if you want to install the examples or not
Install the qt4-demos package.
sudo apt-get install qt4-demos
I found the sample code installed in /usr/lib/qt4/demos/. Also the qtdemo program was installed at /usr/lib/x86_64-linux-gnu/qt4/bin/qtdemo.
It seems only a limited set of examples are installed by this package.
I had the same problem on Windows 7.
How I solved this:
I open QT Creator.
I select menu-option [Tools]
From there I select [Options...]
From there I select the [Kits] option on the left-hand side
I select the tab [QT Versions]
I click The [Add...] button: to add the QT version that I am using...
... I am presented with a windows-explorer screen to select something...
... I go to the main directory on which QT is installed (in my case: C:\Qt)...
... In the explorer "Search" I enter qmake (without the quotes)...
... There is a single qmake EXECUTABLE file displayed - I double-click it!...
... I press [Apply], then [OK].
Walla - it works! I now have examples!

Resources