<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[cmake and Qt private headers]]></title><description><![CDATA[<p dir="auto">Hi</p>
<p dir="auto">I need to subclass  <code>QQuickFlickable</code> which is placed in private headers,<br />
so I'm trying to add proper statements to CMakeLists.txt<br />
I found that qgammaray does it:<br />
<a href="https://github.com/KDAB/GammaRay/blob/master/CMakeLists.txt" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/KDAB/GammaRay/blob/master/CMakeLists.txt</a></p>
<p dir="auto"><code>QQuickFlickable</code> class is placed in:</p>
<pre><code>/usr/include/qt/QtQuick/5.7.1/QtQuick/private/qquickflickable_p.h
</code></pre>
<p dir="auto">So I'm adding:</p>
<pre><code>if(NOT "${Qt5Qml_PRIVATE_INCLUDE_DIRS}" MATCHES "/QtQml/")
    string(REPLACE "/QtCore" "/QtQml" replaceme "${Qt5Core_PRIVATE_INCLUDE_DIRS}")
    list(APPEND Qt5Qml_PRIVATE_INCLUDE_DIRS ${replaceme})
    list(REMOVE_DUPLICATES Qt5Qml_PRIVATE_INCLUDE_DIRS)
endif()
if(NOT "${Qt5Quick_PRIVATE_INCLUDE_DIRS}" MATCHES "/QtQuick/")
    string(REPLACE "/QtCore" "/QtQuick" replaceme "${Qt5Core_PRIVATE_INCLUDE_DIRS}")
    list(APPEND Qt5Quick_PRIVATE_INCLUDE_DIRS ${Qt5Qml_PRIVATE_INCLUDE_DIRS})
    list(APPEND Qt5Quick_PRIVATE_INCLUDE_DIRS ${replaceme})
    list(REMOVE_DUPLICATES Qt5Quick_PRIVATE_INCLUDE_DIRS)
endif()

include_directories( ${Qt5Quick_INCLUDE_DIRS} )
include_directories( ${Qt5Quick_PRIVATE_INCLUDE_DIRS} )
</code></pre>
<p dir="auto">and list of include directories of my CMakeLists.txt looks like:</p>
<pre><code>get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
foreach(dir ${dirs})
  message(STATUS "dir='${dir}'")
endforeach()

-- dir='/usr/include/qt'
-- dir='/usr/include/qt/QtQuick'
-- dir='/usr/include/qt/QtQml'
-- dir='/usr/include/qt/QtNetwork'
-- dir='/usr/include/qt/QtCore'
-- dir='/usr/lib/qt/mkspecs/linux-g++'
-- dir='/usr/include/qt/QtGui'
-- dir='/usr/include'
-- dir='/usr/include/qt/QtNetwork/5.7.1'
-- dir='/usr/include/qt/QtNetwork/5.7.1/QtNetwork'
-- dir='/usr/include/qt/QtCore/5.7.1'
-- dir='/usr/include/qt/QtCore/5.7.1/QtCore'
-- dir='/usr/include/qt/QtGui/5.7.1'
-- dir='/usr/include/qt/QtGui/5.7.1/QtGui'
-- dir='/usr/include/qt/QtQml/5.7.1'
-- dir='/usr/include/qt/QtQml/5.7.1/QtQml'
-- dir='/usr/include/qt/QtQuick/5.7.1'
-- dir='/usr/include/qt/QtQuick/5.7.1/QtQuick'
</code></pre>
<p dir="auto">But if I include:</p>
<pre><code>#include &lt;private/qquickflickable_p.h&gt;
</code></pre>
<p dir="auto">It can not find private/qquickflickable_p.h<br />
but when I include this way:</p>
<pre><code>#define P_QQUICKFLICKABLE(major,minor,patch)  &lt;QtQuick/major.minor.patch/QtQuick/private/qquickflickable_p.h&gt;
#include P_QQUICKFLICKABLE(QT_VERSION_MAJOR, QT_VERSION_MINOR, QT_VERSION_PATCH)
</code></pre>
<p dir="auto">It complains about missing <code>private/qtquickglobal_p.h</code> from <code>qquickflickable_p.h</code><br />
which is also in the same directory.</p>
<p dir="auto">Please help how to manage it.</p>
]]></description><link>https://forum.qt.io/topic/75198/cmake-and-qt-private-headers</link><generator>RSS for Node</generator><lastBuildDate>Sun, 08 Nov 2026 20:09:51 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/75198.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 16 Jan 2017 20:54:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to cmake and Qt private headers on Tue, 17 Jan 2017 09:22:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/seelook">@<bdi>SeeLook</bdi></a> said in <a href="/post/369873">cmake and Qt private headers</a>:</p>
<blockquote>
<p dir="auto">Anyway, it would find many practical purposes if QtQuick c++ classes will be not private.</p>
</blockquote>
<p dir="auto">Indeed but there is a good reason for it.<br />
binary compatible.<br />
<a href="https://community.kde.org/Policies/Binary_Compatibility_Examples" target="_blank" rel="noopener noreferrer nofollow ugc">https://community.kde.org/Policies/Binary_Compatibility_Examples</a></p>
<p dir="auto">:)</p>
]]></description><link>https://forum.qt.io/post/369876</link><guid isPermaLink="true">https://forum.qt.io/post/369876</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Tue, 17 Jan 2017 09:22:49 GMT</pubDate></item><item><title><![CDATA[Reply to cmake and Qt private headers on Tue, 17 Jan 2017 09:13:35 GMT]]></title><description><![CDATA[<p dir="auto">I give up... with using private headers.<br />
I did above by wrapping my component with <code>Flickable</code> on QML side.</p>
<p dir="auto">Anyway, it would find many practical purposes if QtQuick c++ classes will be not private.</p>
]]></description><link>https://forum.qt.io/post/369873</link><guid isPermaLink="true">https://forum.qt.io/post/369873</guid><dc:creator><![CDATA[SeeLook]]></dc:creator><pubDate>Tue, 17 Jan 2017 09:13:35 GMT</pubDate></item></channel></rss>