Starting with KDE Frameworks 5 and Qt Creator - linux

I've installed fresh QtCreator and Qt 5.8 to my system.
As I understand there are 2 Qt toolchains right now on my PC: One in ~/Qt/5.8 (default path) and one is in usr/lib/x86_64-linux-gnu/qt5/bin where KDE stores it for own purposes. The one in /usr/lib/x86_64-linux-gnu/qt5/bin is version 5.7.
Ok, If I create a dummy project in Qt Creator then it'll allow me to choose only Qt 5.8 Kit. And if I do so I'll get Project ERROR: Unknown module(s) in QT: KF5DBusAddons on any KDE Frameworks module I want to link.
(I'm linking them by QT += KF5DBusAddons in .pro file)
It seems that's because Qt 5.8 don't know about KDE modules in /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/ because it looks into ~/Qt/5.8/gcc_64/mkspecs/modules/ instead. And there are no KDE modules. They are not suggested as an option in Qt Online Installer tool.
Fine, so I need either add a Qt5.7 from /usr/lib/x86_64-linux-gnu/ or install KDE Frameworks 5 on top of Qt 5.8. I've tried the first one and run into configuration problems. It still cann't see modules in /usr/lib/x86_64-linux-gnu/.
My question is: Is there a working tutorial on how to start with KDE Framework and Qt Creator. Can I stick with qmake toolchain and not cmake files? Or working explanation on how to add System Qt libraries as a Kit into QtCreator?
P.S. I'm trying to use /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64/qmake.conf And my qmake result command line is qmake /home/user1/dev/kdbustest/kdbustest.pro -spec /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64/ CONFIG+=debug && /usr/bin/make qmake_all

Qt creator has its own configuration for qt versions used in builds.
the config is in tools > options > build and run > Kits
Make sure the kit you have selected (e.g. Desktop) has the correct Qt version set.
If the qt version you want isn't in the dropdown, you can add it in the Qt Versions tab.
Also check you have the right kit selected to build your project (see the build configuration button - above the run/green play button)
The mkspec should be automatically set to use the system qt version and modules, but you can make sure by setting Qt mkspec (in tools > options > build and run > Kits) to /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64/
After all this, you can verify the correct command is being run by looking at the compile compile output pane when running build > Run qmake.

Related

Qmake in cygwin not found for QT5

I tried to install QT5 within cygwin and succeeded. I am also getting the Xorg menu with Cygwin/X for the designer.
But I could not find the qmake.exe for QT5. I only get the following files in the cygwin select package window
And also it shows mingw64-xxxx-qt4-qmake.exe not qmake.exe
unfortunately I could not sacrifice cygwin and go for a windows distribution. Should I build Qt5 from source code ?
qmake-qt5 belongs to libQt5Core-devel
As usual the search engine is available at
https://cygwin.com/packages/

Completely remove Qt environment?

How to completely remove Qt environment?
I installed Qt Creator Integrated Development from the Ubuntu Software Center,then I compiled and installed Qt 4.8.6 .There were few errors when I try to compile an Application.
I Uninstalled / Removed via the Ubuntu Software Center.
But when I tried to install QT 5.3 I can see the Qt 4.8 kit and recently accessed files.
What should I do if I want to completely remove the Qt in my system? I want to uninstall all the 4.8.6 and , then try to reinstall the 5.3.
The kit information is stored in Qt Creator's preferences in your user profile. It has nothing to do with whether a given version of Qt is actually installed. You have to manually remove the kit and the qt version from your Qt Creator settings, it doesn't randomly mess with your own preferences :)

Qt 4.8.3 GUI application on Linux looks old and doesn't match the designer preview

I installed Qt 4.8.3 and Qt Creator 2.5.2 on Fedora 17 and Ubuntu 12.04.
When I create a GUI application, the visual elements look good in the Qt Designer preview window. However when I run the application, the resulting application has an older style which is inconsistent with the OS and does not match the preview in Qt Designer.
In both of the images below, the top part is the preview from Qt Designer and the bottom part is the compiled application.
Qt was installed by compiling the source located at http://qt-project.org/downloads
During ./configure phase of the installation, the "open source" version was chosen.
This issue occurs whether the application is run from the OS or launched from the IDE
Is there a way to make the compiled GUI application appear properly?
Fedora:
Top Half = Qt Designer preview (desired)
Bottom Half = resulting application
Ubuntu:
Top Half = Qt Designer preview (desired)
Bottom Half = resulting application
Addendum:
Here is an image showing a 4.8.1 compiled application (how it's supposed to look like)
Additionally, If I install both 4.8.1 and 4.8.3 on the same computer, even 4.8.1 compiled applications will not appear properly:
Problem is solved.
When installing the Qt source, the instructions forgot to mention that a list of developer libraries must be installed prior to the ./configure step. This list can be found here: http://qt-project.org/wiki/Build_Qt_For_Linux
Additionally, I had trouble compiling QtWebkit because of the error:
g++: error: unrecognized command line option ‘-fuse-ld=gold’
To solve this new problem, one of the two following solutions are possible:
At the configure step, run configure with the -no-webkit option: ./configure -no-webkit
OR
Remove the line QMAKE_LFLAGS+=-fuse-ls-gold from the file qt-everywhere.../src/3rdparty/webkit/Source/common.pri

Installing Qt on Linux (Debian distribution)

I have Qt 4.6.3 on Debian. I need version 4.8.1.
To install it I downloaded the Qt SDK 1.2.1 from the Qt site, where is said that it contains version 4.8.1
After installation I checked Qt version and it is 4.6.3 instead of expected 4.8.1.
What I am doing wrong? And how can I install 4.8.1?
First of all I recommend getting 'official' Debian Qt upgrades by adding the testing (wheezy) repo to your package manager, this way everything on your system will be updated seamlessly in a few clicks.
If you can't do this, then:
Use your package manager to uninstall the existing Qt installation (so that's the runtime libs, plugins, and Qt Creator).
Install the SDK anywhere you like, it installs under one folder anyway.
Update your $PATH to point to the directory with qtcreator, qmake, etc., there are numerous ways of doing this, the simplest is exporting the updated $PATH in your .bashrc. (And optionally make some nice shortcuts for your DE).
Create symlinks in /usr/lib (or /usr/lib64) to point to the Qt libraries the SDK provides, or add a qt.conf file containing the path in your /etc/ld.conf.so.d/ directory and run ldconfig as root.
I'm an openSUSE user myself, so some of the above may slightly different on Debian, hopefully someone with Debian experience can chime in if I'm incorrect.

Qt version is invalid

I am working on Linux and I have installed Qt Creator 2.5.2, Qt libraries 4.7.4 and 4.4.3 all from sources. I cannot install the binaries directly for incompatibility between versions. The installation processes for both Qt 4.7.4 and Qt 4.4.3 were the same. The issue I am facing is that Qt Creator recognizes Qt 4.7.4 but not Qt 4.4.3, with the error
The Qt version is invalid : Could not determine the path to the
binaries of the Qt installation, maybe the path is wrong.
Well each library is installed in /home/$username/qt/Qt-$version. When I manually compile a project with
cd directory
/home/$username/qt/Qt-4.4.3/qmake $PATHPRO
make
Everything work as a charm and I can run the app.
What did I tried?
Recompile Qt-4.4.3
Check the folder permissions
Restart Qt Creator
Smash my head on my desktop
Any thoughts? The OS is SUSE Enterprise 11-32bits.
Problem solved :D.
QtCreator find libraries by using some qmake properties. It query for these properties by executing the command qmake -query. The issue was that none of these variables were set in the Qt 4.4.3 library while they were present in the Qt 4.7.4 library.
So the solution is to set the properties using
home/$username/qt/Qt-4.4.3/bin/qmake -set VARIABLE VALUE
where value is usually a path to a directory
Variables in 4.7.4:
QT_INSTALL_PREFIX: home/$username/qt/Qt-4.7.4/
QT_INSTALL_DATA:
QT_INSTALL_DOCS:
QT_INSTALL_HEADERS:
QT_INSTALL_LIBS:
QT_INSTALL_BINS:
QT_INSTALL_PLUGINS:
QT_INSTALL_IMPORTS:
QT_INSTALL_TRANSLATIONS:
QT_INSTALL_CONFIGURATION:
QT_INSTALL_EXAMPLES:
QT_INSTALL_DEMOS:
QMAKE_MKSPECS:
QMAKE_VERSION:2.01a
QT_VERSION:4.7.4
I think the most important are QT_INSTALL_LIBS, QT_INSTALL_LIBS and QT_VERSION.
see configuring qmake environment.

Resources