Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Go to source files by F4 shortcut



  • I searched for solution how to simply open source files of qt library. I found only unsolved post on [qt creator] go to source files by F4 shortcut.

    I found a solution. For example, if you wont access to header file of QPushButton, you can open header file via F2. But you have no access to source of QPushButton class, as obvious.

    #include <QPushButton> points to file C:\Qt\5.14.1\mingw73_32\include\QtWidgets\qpushbutton.h. You cannot swap to source, because folder doesn't have them. But if you add source files in *.pro

    DISTFILES +=
    C:\Qt\5.14.1\Src\qtbase\src\widgets\widgets*.cpp \

    you will got access to all source files in required folder - all widgets in this case. It is not needed add each file separately. Via F4 you can swap between header and source file. Additionally, if you open source file ones, you got direct access to source definition of the function via F2 key (cursor must be on the function). You have to add some text in pro file, but I think the effort is minimal.

    Keep in mind, that you open header from different folder than source!
    Header from C:\Qt\5.14.1\mingw73_32\include\QtWidgets
    Source from C:\Qt\5.14.1\Src\qtbase\src\widgets\widgets


Log in to reply