Help: Workaround Qt 4.8 assistant bug in CSS handling.

Assistant in Qt 4.8 does not handle css import paths relative to
the includer.  This is fixed in Qt 4.8 commit b95750a275 (Assistant: Set
the url on created QNetworkReply objects., 2014-03-31).  It is unknown
whether there will be a further Qt 4.8 release containing that commit.

Use a CMake script to pre-replace the content prior to generating the
qch file.  An alternative workaround of moving the files or adding
"_static" to the import path did not seem to work for existing Qt 4.8
versions.

The bug was fixed in the Qt 5 branch before Qt 5.0. The Qt 5 assistant
renders this workaround'ed version correctly too.
This commit is contained in:
Stephen Kelly 2014-04-01 19:04:28 +02:00
parent 358be9b320
commit 3a572290cc
2 changed files with 19 additions and 0 deletions

View File

@ -75,6 +75,10 @@ if(SPHINX_QTHELP)
list(APPEND doc_formats qthelp) list(APPEND doc_formats qthelp)
set(qthelp_extra_commands set(qthelp_extra_commands
# Workaround for assistant prior to
# https://codereview.qt-project.org/#change,82250 in Qt 4.
COMMAND ${CMAKE_COMMAND} "-DCSS_DIR=${CMAKE_CURRENT_BINARY_DIR}/qthelp/_static"
-P "${CMAKE_CURRENT_SOURCE_DIR}/apply_qthelp_css_workaround.cmake"
COMMAND qcollectiongenerator ${CMAKE_CURRENT_BINARY_DIR}/qthelp/CMake.qhcp COMMAND qcollectiongenerator ${CMAKE_CURRENT_BINARY_DIR}/qthelp/CMake.qhcp
) )
endif() endif()

View File

@ -0,0 +1,15 @@
file(READ "${CSS_DIR}/basic.css" BasicCssContent)
file(READ "${CSS_DIR}/default.css" DefaultCssContent)
string(REPLACE
"@import url(\"basic.css\")" "${BasicCssContent}"
DefaultCssContent "${DefaultCssContent}"
)
file(READ "${CSS_DIR}/cmake.css" CMakeCssContent)
string(REPLACE
"@import url(\"default.css\")" "${DefaultCssContent}"
CMakeCssContent "${CMakeCssContent}"
)
file(WRITE "${CSS_DIR}/cmake.css" "${CMakeCssContent}")