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

Private headers access



  • I am trying to integrate TCL and Qt5 event loops and hitting a problem related to access to private headers.
    To do such integration I need to inherit from system specific subclasses of QAbstractEventDispatcher.

    For example for Windows I need to subclass QEventDispatcherWin32, cause I do not need
    To get access to header file I had to add the full path to include to my cmake file.
    SET(QT_PRIVATE_INCLUDES_CORE "c:/Qt/5.15.1/msvc2019_64/include/QtCore/5.15.1/QtCore")
    This seems kills the purpose of find_package(Qt5 5.15.1...

    On top the whole directory structure for private headers is weird:
    c:/Qt/5.15.1/msvc2019_64/include/QtCore/5.15.1/QtCore/private/

    What is the purpose of path in bold?
    why it can't be c:\Qt\5.15.1\msvc2019_64\include\QtCore\private\ ?

    I understand that you do not want typically expose private headers,
    But this would be perfectly ok if you designed the class, so nobody needs to subclass it.
    In case of QEventDispatcherWin32 I have no choice unless I want to write my subclass from scratch, which does not make any sense.

    Is there another ways to access private headers I am not aware off?



  • @AlexMaly said in Private headers access:

    This seems kills the purpose of find_package(Qt5 5.15.1...

    There is a find_package for private headers too. find_package(Qt COMPONENTS Core REQUIRED)/target_link_libraries(MyApp Qt::Core Qt::CorePrivate)



  • @VRonin said in Private headers access:

    CorePrivate

    Thanks,

    But
    find_package(Qt5 5.15.1 HINTS ${EFFLX_QTDIR} COMPONENTS Core CorePrivate Widgets REQUIRED)
    fails with:

    CMake Error at C:/Qt/5.15.1/msvc2019_64/lib/cmake/Qt5/Qt5Config.cmake:28 (find_package):
    1> [CMake] Could not find a package configuration file provided by "Qt5CorePrivate"
    1> [CMake] with any of the following names:
    1> [CMake]
    1> [CMake] Qt5CorePrivateConfig.cmake
    1> [CMake] qt5coreprivate-config.cmake
    1> [CMake]

    And I installed everything related to this version package



  • My bad, you don't need the find_package corrected the post above



  • @VRonin said in Private headers access:

    Qt::CorePrivate

    I am not sure I understand how linking directive can help to find header during compilation, but it did.
    Thanks, I would never look at target_link_libraries for such option



  • @AlexMaly said in Private headers access:

    I am not sure I understand how linking directive can help to find header during compilation

    In CMake, target_link_libraries with a package doesn't mean only linker targets, it takes everything in the INTERFACE_ of that package (notably links, includes and compile definitions)


Log in to reply