Debug into Qt sources

前端 未结 3 531
野性不改
野性不改 2021-01-19 11:01

Is it possible to step into Qt sources, e.g. qmainwindow.cpp, in Qt Creator? At the moment I\'m seeing the disassembly, but it would be nice to see the sources instead.

相关标签:
3条回答
  • 2021-01-19 11:28

    You don't say what paltform, but on windows you also have to tell Visual Studio where the sources are. See options->vs projects and directoriers->source code

    0 讨论(0)
  • 2021-01-19 11:43

    Of course! But you might have to first:

    • go to $QT_HOME/qt

    • run ./configure with the -debug or -debug-and-release flag (many other flags here)

    • run "make"

    • wait a couple of hours while things build
    0 讨论(0)
  • 2021-01-19 11:49

    Download the Source code itself.

    Create your application with including all the required files (for e.g qmainwindow.h,qmainwindow.cpp,...) directly. Run your application. Step into the desired files while debugging.. I haven't tried this way but this should work.

    Also you have to include all the desired files. For e.g QMainWindow is derived from QWidget. QWidget is derived from QObject. So you need to include the qwidget.cpp, qwidget.h for QWidget and qobject.cpp, qobject.h for QObject. Similarly you have to include all the necessary files that might be required.

    What you are actually doing is, instead of linking the Qt libraries (*.dll and *.lib), you are including the required files directly. That's all.

    Remember with the Qt libraries linked, you will not able to step into the files that are all built into the libraries.. So, inclusion of the desired files will help you.

    Hope it helps.

    0 讨论(0)
提交回复
热议问题