robertknight / Qt-Inspector

Utility to browse the Qt object tree of a running Qt application and edit object properties on the fly.
GNU Lesser General Public License v3.0
401 stars 70 forks source link

Widget picking does not seems to work (Ubuntu 20.04) #23

Open kannes opened 2 years ago

kannes commented 2 years ago

I compiled this great tool on Ubuntu 20.04. Tried both with and without -DUSE_QT5=True. I launch it as root as otherwise I got errors that it could not connect the process to inspect.

When I click the Pick Widget button:

I expected the inspector finding the clicked widget in its tree and selecting it.

robertknight commented 2 years ago

I launch it as root as otherwise I got errors that it could not connect the process to inspect.

Did you try both the ./qtinspector <pid> and ./qtinspector <program name> <arguments> methods of invoking the tool? If not, can you try both variations as a non-root user and post details of the errors you get.

My current development laptop is a Mac and I haven't tested this tool on Ubuntu recently. It is possible some platform security changes or changes in Qt itself might require changes in how this tool connects to the target process. The tool should be compiled using the same version of Qt as the application that you want to connect to.

kannes commented 2 years ago

Thanks for your interest, I highly appreciate it! :)

Testing on Arch gives me the same issues so maybe it is just modern Linux.

I installed qtinspector via the PKGBUILD https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=qt-inspector-qt5-git so it is QT5.

For testing again I used the PDF reader Okular (says "Qt Version 5.15.4 (built against 5.15.3)").

Immediately after launching with qtinspector okular: image

I click "Pick Widget", the mouse cursor becomes a hand if I hover anything in the Okular window. If I click something the qtinspector window does either a) nothing if there was nothing selected in it before or b) clears its selection (right table becomes empty, no selection in the tree, no change in scroll position). Nothing is shown in the terminal.

Same behaviour if I run qtinspector okular as superuser.

On this system I cannot attach to a running process, regardless of user->user or superuser-qtinspector->user-okular:

Local socket state changed QLocalSocket::ConnectingState
Local socket reported error QLocalSocket::ServerNotFoundError
Local socket state changed QLocalSocket::UnconnectedState
Failed to connect to local socket server in target process 12345
Failed to inject helper library into process <pid>
Failed to send top-level widget request fetch to child process