Setup of Qt Creator to debug into Qt classes - qt

I want to setup Qt Creator (3.0) in a way, that I can debug into the Qt classes. So I download the corresponding src code (http://gitorious.org/qt/qt5) and install it in a directory (e.g. c:\Qt5\src).
Then I have my own project. Where do I need to set the source code path of Qt (c:\Qt5\src), so I can debug my code, but also into a Qt class where necessary.
-- Edit:Pavel's comment --
Pavel has given a good hint: But I am using a precompiled version of Qt/Qt Creator. So I am basically looking for a solution which does not require me to compile from source. Nevertheless a useful hint. Thanks.

If you are using a prebuilded version just remap the source code location as described in http://doc.qt.io/qtcreator/creator-debugger-engines.html
Mapping Source Paths
To enable the debugger to step into the code and display the source
code when using a copy of the source tree at a location different from
the one at which the libraries where built, map the source paths to
target paths:
Select Tools > Options > Debugger > General > Add.
In the Source path field, specify the source path in the debug information of the executable as reported by the debugger.
In the Target path field, specify the actual location of the source tree on the local machine.
To get "the source path in the debug information of the executable as reported by the debugger", you can activate the "Use Tooltips in Stack-View when Debugging" option by right-clicking in the Stack View and move the mouse over a specific function call.

If you look into the tooltips, you will see references to /Users/qt/work, the Mac deployed debug symbols are pointing there. Of course, this is not documented, as these folks want you to buy enterprise.
If you create the /Users/qt/work directory (as root), then make a soft link to your source directory named qt, everything will work. No need to build anything from source (under Mac that would result in tens of gigs wasted). Same considerations about plugins
Example:
sudo -s
mkdir /Users/qt
cd /Users/qt
mkdir work
cd work
ln -s /Users/your_user_name/Qt/your_qt_release/Src qt
Everything will work. Any source mapping failed here, so leave those alone.
Hope this helps

With Xcode, before you step into the Qt library the first time, enter the following command in the LLDB window:
settings set target.source-map /Users/qt/work/qt /path/to/Qt/5.10.1/Src
(Obviously you'll want to change the version number, as relevant).
But suppose Trolltech changes its build directory, what to do then? (Or, how did the community wiki that gave the /Users/qt/work/qt path find it?) You can guess what the path needs to be by editing /path/to/Qt/5.10.1/clang_64/lib/QtCore.framework.dSYM/Contents/Resources/DWARF/QtCore_debug (or any other Qt library) and searching for some paths. "/Users" seems like a good guess. About 2% into the library you'll start seeing sections with a lot of paths like:
../../include/QtCore/../../src/corelib/kernel^#../../include/QtCore
/../../src/corelib/tools^#global^#/Users/qt/work/qt/qtbase/src/corelib
/../../include/QtCore/../../src/corelib/arch^#/Applications/Xcode.app
/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/<etc>
Look for an absolute path that looks like it could be writable. (/Applications/... would not be a likely build path, for example)

In recent Qt creator (v 4.11) press button "Add Qt Sources"
in Tools > Options > Debugger > General
and select Qt sources file.
Qt5 should be installed by online installer with checked "Qt Debug Information files".

Follow the instructions from Qt here:
"In the run configuration, select Use debug version of frameworks."

Related

unknown project file: "gtkada"

I got GPS community edition, but it can't create GtkADA projects. So I cloned and built GtkADA using the GPR projects, but when I try to open a GtkADA example or start a new GtkADA project from GPS, I get the error:
unknown project file: "gtkada"
Edit:
Windows 10 x64, trying to "get into" Ada.
Edit2: Got farther.
I tried setting GPR_PROJECT_PATH to include the following paths:
drive:\gitrepos\gtkada\src
drive:\gitrepos\gtkada\src\lib
drive:\gitrepos\gtkada\src\lib\gtkada\relocatable
drive:\gitrepos\gtkada\src\obj
I am trying to run the base widget example, downloaded from https://www.adacore.com/code-samples for GtkAda.
Now I get:
file "gdk-gc.ads" not found
Indeed I cannot find this file in either the GNAT or GtkAda repo.
Edit2: I am still having difficulty.
Edit3: Other people on freenode#ada were saying the OpenGL part of GtkAda is broken, and many people simply disable it.
I had the same problem and couldn't find Gtkada (about gdk-gc.ads I can't help you).
Therefore I wrote the relative path from my project file to GtkAda.gpr
with "../../lib/gnat/gtkada"; -- on linux (I installed my gtkada into my gnat folder)
In your case, if you installed it on C:\GtkAda you should search for GtkAda.gpr, then copy paste its path.
(Not sure if absolute path works. You will maybe need to tell your project to search outside of its folders by using ".." until you are in C:, then paste your path.)
PS: Adacore provides a GtkAda installer for windows: https://www.adacore.com/download/more
Edit: On my windows, I simply used the installer then
with "gtkada" worked.

Development on KDE platform

I'm interested in learning about kde environment. So I read the contribution page on wiki, git cloned the kompare repo and built it. But an attempt to execute the binary gave me an error saying Could not load our KompareNavigationPart. The console showed the following error about kservice:
> ./kompare
kf5.kxmlgui: cannot find .rc file "kompareui.rc" for component "kompare"
kf5.kservice.services: KMimeTypeTrader: couldn't find service type "Kompare/ViewPart"
Please ensure that the .desktop file for it is installed; then run kbuildsycoca5.
kf5.kxmlgui: cannot find .rc file "kompareui.rc" for component "kompare"
Aborting aboutToFinish handling.
I couldn't find anything about it in the readme or the project wiki. I've installed the kde-development-meta package on arch linux. Can anyone help me get started with development on kde platform?
Short answer: Use "cmake -DCMAKE_INSTALL_PREFIX=/usr" and "make install".
Long answer: It looks like you tried to run from the build directory, but the KDE plugin loader does not look there by default. You could adjust the various path variables to additionally point to your build directory. The variables are mentioned at https://community.kde.org/Guidelines_and_HOWTOs/Build_from_source#Set_up_the_runtime_environment
You can also use "make install" to install to a run-time directory. If you did not change the defaults of cmake via -D option, this will be "/usr/local/", and in this case you also have to adjust the various path variables to include that directory, unless your distribution already configured this for you.

How to use add-on "QtFtp"?

I want to use FTP in my current project, but since Qt5 ftp isn't available (only as add-on).
I downloaded the sources from here: https://github.com/qt/qtftp
In Qt's forum, I found a instruction how to use it:
Open Console in the qtftp-folder
Generate the headers: cd qtftp, <QTDIR>/bin/syncqt.pl -version 5.2.0
Run qmake
Run make (mingw32-make)
Run make install (mingw32-make install)
Add QT += ftp in my .pro-file
Run qmake on my project
compile my project.
(https://forum.qt.io/topic/23904/qtftp-and-qthttp-compatibility-add-ons-for-qhttp-and-qftp-classes-in-qt-5)
So, I wanted to try these steps, but it fails on the first step, because the syncqt.pl cant be found, but I looked in the Qt-directory, and the file is there.
Anybody has an idea, how to fix/solve this? I am using Qt5.9.1
If you have downloaded the portable version of strawberry-perl like me, just extract .zip somewhere on your disk. After that, open the portableshell.bat (it should open a command prompt window)
After that, you can type in the code of step 2, and don't forget to add the -version argument.
Then you can continue with step 3, and everything should work without any problems.

setting up Marble to work with Qt

I am trying to set up Marble to work with Qt 5.5 on OSX. I'm not very experienced with the details of linking and such and I think that is causing the problem I am having.
Question: Did I screw up the 'marble` install or is this an easily solved linking issue?
Qt 5.5 is installed in my user directory (using Qt's network installer) on a system running OSX 10.9.5. It works fine. I followed the instructions on the Marble site to clone, build and install from source with (I believe) the appropriate Qt flags. That seemed to go without issue. When I try to build the simple test app listed here, the #include <marble/MarbleWidget.h> line gives a "file not found" error.
After the install I've ended up with the following:
A "marble" directory in my root user folder
A "Marble.app" file along with various other marble related files in the bin and include directories. However the Marble.app gives the following error on launch:
Dyld Error Message: Library not loaded:
#rpath/QtCore.framework/Versions/5/QtCore Referenced from:
/usr/local/Marble.app/Contents/MacOS/marble-qt Reason: image not
found
Binary Images:
0x7fff6a1f9000 - 0x7fff6a22c817 dyld (239.4) <7AD43B9B-5CEA-3C7E-9836-A06909F9CA56> /usr/lib/dyld
So a semi-solution: I used the Qt Creator "add Library" function and ended up with the following additions to the .pro file. I had to paste in the link to the lib since the dialog doesn't allow browsing of "usr/local/". Also, although I tried to link to the lib alias ("libmarblewidget-qt5.dylib"), the actual lib name is used.
macx: LIBS += -L$$PWD/../../../../../usr/local/lib/ -lmarblewidget-qt5.0.21.80
INCLUDEPATH += $$PWD/../../../../../usr/local/include
DEPENDPATH += $$PWD/../../../../../usr/local/include
I don't understand what this $$PWD/../../../../../ business is.
But it worked and I am able to run the example code at the link in my question.
I wish this install/build stuff wasn't so damned arcane. I've spent endless hours just trying to get things set up – really sucks the joy out of exploring this stuff and I can't say I really learned much of anything from it.
Update
So I cleaned out the "$$PWD" crap and the literal lib name and it works. Not sure what difference it makes – but there you go.
macx: LIBS += -L/usr/local/lib/ -lmarblewidget-qt5
INCLUDEPATH +=/usr/local/include
DEPENDPATH +=/usr/local/include
Either the build is faulty or you need a different version of Qt installed to run it. Usually the app has the Qt libraries that it needs wrapped up in the app itself. If it's not in there it will search your mac for it. The message says that QtCore can't be found in either place. If you look inside Google's Google Earth, you can see where the libraries are stored. You can also copy a version of QtCore into your Marble to see if it will work.

WinPython with PyQt5

I'm trying to get PyQt5 working with WinPython. PyQt5 comes with a readme file for installation, and I have unsuccessfully tried a few combinations of what I thought the first part of the readme tells me to do.
I have:
Windows 7 Home Premium 64-bit
WinPython-64bit-2.7.9.1
Qt 5.4
PyQt-gpl-5.4
PyQt-gpl-5.4 is in the folder (only partially sure that this is where I should have put it)
C:\WinPython-64bit-2.7.9.1\python-2.7.9.amd64\Lib\site-packages\PyQt-gpl-5.4
My current attempt at getting everything working is: I'm trying to run the configure.py file in PyQt-gpl-5.4, but when I do so I consistently get the following error:
Error: PyQt5 requires Qt v5.0 or later. You seem to be using v4.8.6.
Make sure the correct version of qmake is on your PATH.
What I think is the required version of qmake being referred to is in the folder
C:\Qt\5.4\mingw491_32\bin
However, I have no idea how to fix the error by adding the qmake in this folder to PATH. My most recent attempt was to add the folder using Spyder's Tools->PYTHONPATH manager, but this made no difference. I also tried adding it using sys.path.append('C:\Qt\5.4\mingw491_32\bin'), but this didn't work either. I have since removed the folder name from both of these locations.
How do I get PyQt5 working with WinPython-64bit-2.7.9.1, or I think equivalently, how to I get the configure.py file in the PyQt-gpl-5.4 folder to run?
Thanks.
You definitely don't want the source code (i.e. PyQt-gpl-5.4) in the site-packages folder, because that's where the compiled modules will end up. Instead, it should just go in a temporary folder whilst you compile it.
When you run configure.py, you must take care to use the executable for the specific python that you are targeting. I do not know anything about WinPython, but for a normal python installation this means doing something like this:
C:\Python34\python configure.py
As a first step, before attempting to actually compile anything, it would be advisable to take at look at all the configuration options that are available, like this:
C:\Python34\python configure.py --help
(There's also the Installing PyQt5 section in the PyQt Docs).
This will tell you, for instance, that the simplest way to specify the Qt installation you are targeting would be something like this:
C:\Python34\python configure.py --qmake C:\Qt\5.4\mingw491_32\bin\qmake
EDIT:
Sorry, that last part is wrong: the --qmake option isn't available on Windows, so you have to add the directory containing the qmake executable to your PATH. This can be done with the following command:
set PATH=%PATH%;C:\Qt\5.4\mingw491_32\bin

Resources