qtcreator examples not enabled - qt

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!

Related

Make Qt Creator to see examples and docs

I build Qt 5.9.1 from sources, downloaded from www.qt.io, on Ubuntu 16.04.3. I use -make examples for configure script when I build Qt.
After installation in default prefix /usr/local there is a /usr/local/Qt-5.9.1/examples/ and /usr/local/Qt-5.9.1/doc/.
Also I have installed Qt Creator 4.3.1 from the official site.
On the "Welcome" page of Qt Creator in "Examples" I see auto-detected "Qt 5.9.1 in PATH (Qt-5.9.1)" entry in combobox (on another installation I even don't see this entry - combobox is empty). And no one icon of the examples itself. Typing any sensible keywords into search box does nothing.
When I open my (perfetcly buildable) project and hit F1 on any Qt class name, I expect to see a help on it in the right split window. Then nothing happens, but only "No documentation avaliable." text is shown.
qmake of installed Qt is in the PATH and there is QTDIR=/usr/local/Qt-5.9.1 in /etc/environment.
How to make Qt Creator to see docs, examples and demos from auto-detected Qt installation?
In case someone installed qtcreator from the Ubuntu packages the examples can be installed in the following way:
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
Edit:
Also make sure to install the qml modules you need, for example:
sudo apt install qml-module-qtquick-controls2
Select Tools → Options → Help → Documentation in Qt Creator and add *.qch files from /usr/local/Qt-5.9.1/doc/ (and possibly from /usr/local/Qt-5.9.1/examples/ ?).

How to install QtDesigner?

I just installed Qt 5.4.1 on Windows 7. And there is no QtDesigner. Also there is no QtDesigner in MaintenanceTool.
How can I install it?
You can install and find QT Designer as follows (Windows environment):
Install latest QT (I'm using 5.8) from QT main site
Make sure you include "Qt 5.8 MinGW" component
QT Designer will be installed in C:\Qt\5.8\mingw53_32\bin\designer.exe
Note that the executable is named "designer.exe"
UPDATE - there is an easier way to install QT Designer without downloading GB's of data from QT:
Install the latest version of "pyqt5-tools" using pip install pyqt5-tools --pre
The "designer.exe" will be installed in ...Lib\site-packages\pyqt5_tools
If you are on macOS and use brew you may have installed qt already using brews installer.
In that case you already have QT Designer installed even though it is not mentioned anywhere.
You can find it here: /usr/local/Cellar/qt/<qtversion>/libexec/Designer.app
So to place it in your local apps folder you can create a symlink to it like this:
ln -sf /usr/local/Cellar/qt/5.11.1/libexec/Designer.app ~/Applications/.
Install QtDesigner on windows:
https://build-system.fman.io/qt-designer-download
install designer on Linux:
It can be installed using the apt package manager
sudo apt-get install python-qt4 qt4-designer
run the command designer and it will work for you
if it doesn't try /usr/bin/designer
it worked for me
i am using python 3.6 with pyqt-5.16
It is there. Create a form, click on the .ui file and it opens automatically.
Install the latest version of "pyqt5-tools" using pip install pyqt5-tools --pre
Then run the command (designer.exe) then you are good
pip install pyqt5-tools
refer: https://pypi.org/project/PyQt5Designer/
run the following commands in the given sequence
pip install PyQt5Designer
designer.exe
then press Enter. This opens Qt Designer window.
Expanding StonyBoy answer.
If you are on macOS, you have installed Qt5 with brew, and you want to access the Qt5 Designer app via command line (like on Linux), you can set a symlink to the actual executable as well, like this:
ln -sf /usr/local/Cellar/qt/5.13.1/libexec/Designer.app/Contents/MacOS/Designer /usr/local/opt/qt/bin/designer
This way, the designer command will be placed in the bin folder, together with the other Qt5 executables (as qmake). Thus, you will be able to launch it simply by typing designer in your shell.
Note: of course you must have the path of the Qt5 bin/ folder added to your PATH environmental variable, for being able to directly call designer in the shell. But brew added it for you when you installed Qt5.
I got pyqt5 installed along with the tools when I pip install pyqt5-tools. If you prefer PySide2, qt-tools will work better. You can emulate a "dry-run" by creating a fresh, disposable virtual environment to test on. Obvious, I know, but I use them infrequently enough that it takes me a while to remember sometimes :)
As of January 2023, the official Qt website does not provide Qt Designer as a standalone Application. Qt Designer can be obtained from:
Official source
Qt Creator + Qt base package
Offline installer for Qt Creator (Qt account required, has integrated Designer)
Qt base package
Online installer (Qt account required)
Custom Installation, select component
Qt-->{Qt Version of choice}-->{Architecture (usually MSVC 64-bit / Mingw64)}
aqtinstall (NO account needed)
In all official installations, the standalone designer.exe is located in the Qt bin folder (for Windows usually C:\Qt\{Version}\{Architecture}\bin).
Third party standalone applications
(potentially outdated)
https://github.com/mherrmann/fbs
(small file size)
From PyPi via pip
pyqt6-tools, pyqt5-tools, pyqt-tools, PyQt5Designer
For Qt newcomers, using Designer in Creator may be the better choice as it is very straightforward. Advanced users looking to set up a custom build infrastructure may be interested in aqtinstall instead.
I found it here:
..\Lib\site-packages\qt5_applications\Qt\bin

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.

Qt Creator needs a compiler set up to build. Configure a compiler in the kit options

I Have Installed Qt Creator5 with latest binaries.
but when i am running any program it is giving me this error.
:-1: error: Qt Creator needs a compiler set up to build. Configure a compiler in the kit options.
i have searched the whole internet for answer but its inadequate and not helping.
kindly reply the way to get rid of this error.
i was also having the same problem so what i did is
For linux
sudo apt-get install g++
sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev
and then closed the qt creator and restarted it and it worked
i do not know which of the above two made it work but it worked !!
For Windows
Below given solution have worked for few people. so it is worth a try.
Delete this file
C:\Users\AppData\Roaming\QtProject\qtcreator\toolchains.xml
to solve the problem.
For me on Windows 7 this was solved by clicking on the arrow icon next to the computer icon on the bottom left of the Qt Creator screen above green arrows and then double clicked a compiler on the list and rebuild the project.
* for windows users only *
Before continuing to next steps make sure u have downloaded latest version of Qt.
Download and install minGW-64-bit from link:
https://sourceforge.net/projects/mingw-w64/files/latest/download
Remember The directory to which you install minGW.
Open Qt creator and go to tools -> options -> Build and Run
In Compilers tab Select add -> MinGW -> Name: MinGW path: Browse for mingw-w64.bat (you will find this file in the directory in which you have installed MinGW).ABI: x86 Windows msvc2015 pe 64bit Don't forget to apply your edits.
Go to Kit -> add Name: GCC Device Type: Desktop Device: Local PC (Default for desktop) Compiler: minGW Qt Version: select newest version Apply changes and restart qt
While creating new project make sure you use GCC as kit
If it still doesn't works Click computer icon on bottom left above play button -> GCC -> Build
OR
Go to projects (It is in the menu on left hand side) -> Build Steps -> make -> Override minGw31-make.exe -> browse to path in which you have installed minGW/bin\mingw32-make.exeDo the same for clean steps too
If u Still get any error after these steps try setting Environment Variables
Press Win+Q
Type " Environment variables "
click on " Edit the system environment variables "
System Properties -> Advance -> Environment Variables
Click on path (NOTE : Use These steps very carefully and do not mess with other options)
Click edit
press right arrow to go to end of text
type a semi-colon (if it isn't at the end of it because all the system paths are distinguished by a semi-colon)
paste path "MinGW_installation_directory\bin" (In my case it was "G:\Qt\Tools\mingw32\bin"). Make sure you copy and paste CORRECT path
Click OK and apply the changes.
That should do it !!!
user2304430 has it right, I struggled also figure it out. Above the green Run/Debug buttons in the bottom left, there's a computer icon with a pop-out menu. In there, you have to select your kit.
I went in circles for half an hour checking that my kits were set up right in options. But you actually have to select the kit in the Computer Icon -> pop-out menu in the bottom left before it does anything.
Amazingly, the first many Google pages for the error don't show this, you'd think almost all new users run into this.
I had a similar issue when developing on my Mac -
I was trying to do desktop development with QT creator 3.3.0 based on QT 5.4.0 (Clang 6.0 (Apple)) on OSX 10.9. After trying to manually modify my kits to use GCC, G++, and CLANG. I finally found this really simple solution:
Delete the xxx.pro.user file and then restart QT Creator. It should then automatically pick up your compilers/environments.
Had the same issue on Fedora 22 after installing Qt5.5.
Installing the following packages did the trick:
sudo dnf install gcc-c++
sudo dnf install mesa-libGL-devel
When I installed Qt into folder ~/Qt/ and then manually renamed the folder into something other, I had similar problem. When I restored the folder name into the original ~/Qt/ (specified at the Qt installer), the problem has disappeared; all was solved.

Resources