How to run Qt Creator from console in Ubuntu? - qt

I don't know how it's called in console.
Tried "qt", "qt-creator", "qtcreator". It not works.
Tried to find where Qt Creator is installed. I didn't find it.
Tried open qt from desktop. "./Qt\ Creator\ (Community)"
Command -ls showing the name as DigiaQt-qtcreator-community.desktop. "./DigiaQt-qtcreator-community.desktop". It doesn't work too.
I need it to run Qt Creator as root.

/opt is owned by root , you need to give permission to user chmod +x qtcreator.

Related

Qt Creator running CMake with different configuration

I'm trying to build a CMakeLists project using Qt Creator 4.8.1. The problem is, I need to run CMake inside a different nativesysroot.
I tried to create a bash script that runs CMake inside the other environment and added it to my kit. As follows:
#!/bin/bash
cd ~/Desktop/Workspace/my_proj/build &&\
~/Desktop/Workspace/my_proj/sdk-x86_64/opt/nativesysroot/usr/bin/sysroot\
~/Desktop/Workspace/my_proj/sdk-vmwx86-x86_64/opt/nativesysroot/usr/bin/cmake "$#"
Such that, sysroot is an executable that changes the current nativesysroot.
The problem is this does not work because Qt Creator is trying to run CMake using the following configuration:
Running "/home/***/Desktop/Workspace/my_proj/script.sh -E server --pipe=/tmp/cmake-.ewYqvn/socket --experimental" in /tmp/QtCreator-kruzfX/qtc-cmake-YOZsCIQx.
This of course causes CMake server connection lost. I tried the look around how to disable the CMake running in server mode but I did not find anything in Qt Creator.
My question is, how to disable CMake in server mode? Or, how to instruct Qt Creator to run my script without adding any flags or options?
Thanks.

Qt and Qt Creator. Pure installation

I used Qt Creator 3.5.0 without any problems. But after these actions I got some issues:
I always used Qt Creator without super permissions, but at that time I launched it as root
After that I tried to run Qt Creator as usually but got a lot of errors like:
Cannot overwrite file
/home/user/.config/QtProject/qtcreator/qtversion.xml: Permission
denied
Could not save session to file
/home/user/.config/QtProject/qtcreator/default.qws
Cannot overwrite file
/home/user/.config/QtProject/qtcreator/qnx/qnxconfigurations.xml:
Permission denied
My Android emulator settings has been reset.
I also got some messages like:
No .user settings file created by this instance of Qt Creator was
found...
I could not save some files due to:
Cannot set permissions for /home/user/QtProjects/test_project/mainwindow.cpp to writable.
Could not save the files.
/home/user/QtProjects/build-test_project-Desktop-Debug/ui_mainwindow.h:13:
error: QtWidgets/QAction: No such file or directory
But the main problem is that I can't use some my packages which are already installed:
No package 'gstreamer-video-1.0' found
No package 'gstreamer-1.0' found
Project ERROR: Unknown module(s) in QT: webkitwidgets
Some of these errors occurs with sudo, some - without.
I already tried to completely reinstall Qt, Qt Creator(using apt-get and online installer) and missing packages and I also removed dir QtProject and file QtProject.conf from /home/user/.config, but without success.
So how can I absolutely clean and purge Qt, its configs and settings and make pure reinstallation to solve these problems?
To answer #2, #4, and #5 - these all stem from file ownership being by the 'root' user, caused by when you launched Qt Creator as root.
To fix these issues:
$ chown user:user -R /home/user/.config/QtProject/qtcreator
$ chown user:user -R /home/user/QtProjects
$ rm -Rf /home/user/QtProjects/build-test_project-Desktop-Debug
The first two directives makes sure that all the Qt projects you have in QtProjects and all Qt Creator user settings files are owned by the user, so it can be accessed by the Qt Creator project when launched by the user.
The last directive removes your build files, which will be regenerated when you next build - in case they are in an inconsistent state due to the permissions being wrong.
As to #7 - as what Frank Osterfeld mentioned, you have enabled Qt Webkit support in your project, and it's been removed from Qt as of Qt 5.6*. I would recommend replacing your usage of Qt Webkit with Qt WebEngine.
* https://wiki.qt.io/New_Features_in_Qt_5.6#Removed_Modules

Qt creator: qmake is not recognized

I am trying to understand 'qmake' by following this tutorial . but when I come the the following command:
qmake -o Makefile hello.pro
my command line console shows me this message:
'qmake' is not recognized as an internal or external command, operable program or batch file
I understood that qmake is part of Qt creator and thus it should be executed whenever I run it within my project's folder. so, why it is not recognized ?
In the start menu entry that was created by the installer for Qt, you should find an item that opens a command prompt with all the needed environment variables (including the PATH) already set. For my Qt 5.0.2 install using MingW, it is called "Qt 5.0.2 for Desktop (MinGW 4.7)".
On Windows, you can add path to qmake to PATH or run qmake from directory where it placed, or use absolute path.
Sorry my friend, i donĀ“t speak English very well.
In Qt 5.10.1 I resolved this problem running the command prompt in the next path, C:\Qt\5.10.1\mingw53_32>, after you need change the directory where is the file hello.pro and run the commnand qmake -o Makefile hello.pro after you can see the makefile in the respective folder.

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!

Setup qmake for Qt Creator on Mac

I installed the qt debug and release libraries and qt creator.
I can't make it build because of qmake. How can i make qt creator know of qmake?
I went to Preferences->Build&Run and click Add but I can't select anything, not even qmake after I find it.
I have qmake, I can run it from the command line but I can't make the QtCreator know about it.
Please help me, I feel like I'm gonna blow up.
Thanks
What I did was browse a file in /usr/bin (which is hidden in Mac OS X) which set the default folder that comes out in the file explorer to /usr/bin. Then I browsed for qmake which drove me in /usr/bin so i can select qmake. That's a workaround however.
On qt creator 4.1.0, open the Build&Run Preferences.
Under Qt Version click "Add" and hit:
Command + shift + G
and then type: /usr/local/bin (or whereever your qmake is: find qmake)
In order to see the new qt version in Kits you need to hit OK and re-open the Preferences window
I use Mac version 10.11.6 and it worked for me.
I believe it's an ownership issue. Try chown on /usr/bin/qmake and re-try Adding to Qt Versions.

Resources