diff --git a/.cmake.conf b/.cmake.conf
new file mode 100644
index 0000000000..d3da691f06
--- /dev/null
+++ b/.cmake.conf
@@ -0,0 +1 @@
+set(QT_REPO_MODULE_VERSION "6.1.3")
diff --git a/.gitignore b/.gitignore
index 2fd837c975..d0d79c51df 100644
--- a/.gitignore
+++ b/.gitignore
@@ -64,7 +64,6 @@ bin/lrelease*
bin/lupdate*
bin/lconvert*
bin/moc*
-bin/makeqpf*
bin/pixeltool*
bin/qmake*
bin/qdoc3*
@@ -113,10 +112,6 @@ translations/*.qm
translations/*_untranslated.ts
qrc_*.cpp
-src/assistant/lib/fulltextsearch/qtcluceneversion.h
-src/assistant/lib/qthelpversion.h
-src/designer/src/lib/qtdesignerversion.h
-
# Test generated files
QObject.log
tst_*
diff --git a/.prev_configure.cmake b/.prev_configure.cmake
new file mode 100644
index 0000000000..9827b4badf
--- /dev/null
+++ b/.prev_configure.cmake
@@ -0,0 +1,118 @@
+
+
+#### Inputs
+
+
+
+#### Libraries
+
+
+
+#### Tests
+
+# libclang
+qt_find_package(WrapLibClang PROVIDED_TARGETS WrapLibClang::WrapLibClang)
+
+if(TARGET WrapLibClang::WrapLibClang)
+ set(TEST_libclang "ON" CACHE BOOL "Required libclang version found." FORCE)
+endif()
+
+
+
+#### Features
+
+qt_feature("assistant" PRIVATE
+ LABEL "Qt Assistant"
+ PURPOSE "Qt Assistant is a tool for viewing on-line documentation in Qt help file format."
+)
+qt_feature("clang" PRIVATE
+ LABEL "QDoc"
+ CONDITION TEST_libclang
+)
+qt_feature("clangcpp" PRIVATE
+ LABEL "Clang-based lupdate parser"
+ CONDITION QT_FEATURE_clang AND TEST_libclang
+)
+qt_feature("designer" PRIVATE
+ LABEL "Qt Designer"
+ PURPOSE "Qt Designer is the Qt tool for designing and building graphical user interfaces (GUIs) with Qt Widgets. You can compose and customize your windows or dialogs in a what-you-see-is-what-you-get (WYSIWYG) manner, and test them using different styles and resolutions."
+)
+qt_feature("distancefieldgenerator" PRIVATE
+ LABEL "Qt Distance Field Generator"
+ PURPOSE "The Qt Distance Field Generator tool can be used to pregenerate the font cache in order to optimize startup performance."
+)
+qt_feature("kmap2qmap" PRIVATE
+ LABEL "kmap2qmap"
+ PURPOSE "kmap2qmap is a tool to generate keymaps for use on Embedded Linux. The source files have to be in standard Linux kmap format that is e.g. understood by the kernel's loadkeys command."
+)
+qt_feature("linguist" PRIVATE
+ LABEL "Qt Linguist"
+ PURPOSE "Qt Linguist can be used by translator to translate text in Qt applications."
+)
+qt_feature("macdeployqt" PRIVATE
+ LABEL "Mac Deployment Tool"
+ PURPOSE "The Mac deployment tool automates the process of creating a deployable application bundle that contains the Qt libraries as private frameworks."
+ CONDITION APPLE
+)
+qt_feature("pixeltool" PRIVATE
+ LABEL "pixeltool"
+ PURPOSE "The Qt Pixel Zooming Tool is a graphical application that magnifies the screen around the mouse pointer so you can look more closely at individual pixels."
+)
+qt_feature("qdbus" PRIVATE
+ LABEL "qdbus"
+ PURPOSE "qdbus is a communication interface for Qt-based applications."
+)
+qt_feature("qev" PRIVATE
+ LABEL "qev"
+ PURPOSE "qev allows introspection of incoming events for a QWidget, similar to the X11 xev tool."
+)
+qt_feature("qtattributionsscanner" PRIVATE
+ LABEL "Qt Attributions Scanner"
+ PURPOSE "Qt Attributions Scanner generates attribution documents for third-party code in Qt."
+)
+qt_feature("qtdiag" PRIVATE
+ LABEL "qtdiag"
+ PURPOSE "qtdiag outputs information about the Qt installation it was built with."
+)
+qt_feature("qtpaths" PRIVATE
+ LABEL "qtpaths"
+ PURPOSE "qtpaths is a command line client to QStandardPaths."
+)
+qt_feature("qtplugininfo" PRIVATE
+ LABEL "qtplugininfo"
+ PURPOSE "qtplugininfo dumps metadata about Qt plugins in JSON format."
+)
+qt_feature("windeployqt" PRIVATE
+ LABEL "Windows deployment tool"
+ PURPOSE "The Windows deployment tool is designed to automate the process of creating a deployable folder containing the Qt-related dependencies (libraries, QML imports, plugins, and translations) required to run the application from that folder. It creates a sandbox for Universal Windows Platform (UWP) or an installation tree for Windows desktop applications, which can be easily bundled into an installation package."
+ CONDITION WIN32
+)
+qt_configure_add_summary_section(NAME "Qt Tools")
+qt_configure_add_summary_entry(ARGS "assistant")
+qt_configure_add_summary_entry(ARGS "clang")
+qt_configure_add_summary_entry(ARGS "clangcpp")
+qt_configure_add_summary_entry(ARGS "designer")
+qt_configure_add_summary_entry(ARGS "distancefieldgenerator")
+qt_configure_add_summary_entry(ARGS "kmap2qmap")
+qt_configure_add_summary_entry(ARGS "linguist")
+qt_configure_add_summary_entry(ARGS "macdeployqt")
+qt_configure_add_summary_entry(ARGS "pixeltool")
+qt_configure_add_summary_entry(ARGS "qdbus")
+qt_configure_add_summary_entry(ARGS "qev")
+qt_configure_add_summary_entry(ARGS "qtattributionsscanner")
+qt_configure_add_summary_entry(ARGS "qtdiag")
+qt_configure_add_summary_entry(ARGS "qtpaths")
+qt_configure_add_summary_entry(ARGS "qtplugininfo")
+qt_configure_add_summary_entry(ARGS "windeployqt")
+qt_configure_end_summary_section() # end of "Qt Tools" section
+qt_configure_add_report_entry(
+ TYPE WARNING
+ MESSAGE "QDoc will not be compiled, probably because libclang could not be located. This means that you cannot build the Qt documentation.
+ Either set CMAKE_PREFIX_PATH or LLVM_INSTALL_DIR to the location of your llvm installation. On Linux systems, you may be able to install libclang by installing the libclang-dev or libclang-devel package, depending on your distribution. On macOS, you can use Homebrew's llvm package."
+ CONDITION NOT QT_FEATURE_clang
+)
+qt_configure_add_report_entry(
+ TYPE WARNING
+ MESSAGE "Clang-based lupdate parser will not be available. LLVM and Clang C++ libraries have not been found."
+ CONDITION NOT QT_FEATURE_clangcpp
+)
diff --git a/.qmake.conf b/.qmake.conf
index db2e0b653c..6bdb1fcb92 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -1,3 +1,5 @@
load(qt_build_config)
-MODULE_VERSION = 5.14.0
+DEFINES += QT_NO_JAVA_STYLE_ITERATORS
+
+MODULE_VERSION = 6.1.3
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000000..f5057100a8
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,41 @@
+# Generated from qttools.pro.
+
+cmake_minimum_required(VERSION 3.15.0)
+
+include(.cmake.conf)
+project(QtTools # special case
+ VERSION "${QT_REPO_MODULE_VERSION}"
+ DESCRIPTION "Qt Tools" # special case
+ HOMEPAGE_URL "https://qt.io/"
+ LANGUAGES CXX C
+)
+
+# special case begin
+set(QT_REPO_NOT_WARNINGS_CLEAN TRUE)
+
+# Make sure we only use latest private CMake API, aka no compatibility wrappers.
+set(QT_NO_INTERNAL_COMPATIBILITY_FUNCTIONS TRUE)
+
+# Make sure we use the fixed BASE argument of qt_add_resource.
+set(QT_USE_FIXED_QT_ADD_RESOURCE_BASE TRUE)
+
+# add platform specific compontents
+set(optional_components "")
+if(WIN32)
+ list(APPEND optional_components AxContainer)
+endif()
+
+find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core Network)
+find_package(Qt6 ${PROJECT_VERSION} QUIET CONFIG OPTIONAL_COMPONENTS
+ DBus Xml Widgets Quick QuickWidgets QmlDevToolsPrivate
+ Sql PrintSupport OpenGL OpenGLWidgets ${optional_components})
+# special case end
+
+qt_build_repo()
+
+# special case begin
+
+# Add tool dependencies that were deferred by qt_internal_add_docs.
+qt_internal_add_deferred_dependencies()
+
+# special case end
diff --git a/README.md b/README.md
new file mode 100644
index 0000000000..ffe762e4d5
--- /dev/null
+++ b/README.md
@@ -0,0 +1,40 @@
+# qttools: Assistant/WebEngine
+
+This is a fork of the official qttools repository for the sole purpose of compiling Qt Assistant against a stock binary distribution of Qt, without needing to build Qt itself. Assistant is patched to work with Qt WebEngine to give it full HTML browsing capability. The changes in this repository are additive in nature, but due to changes upstream it may be difficult to maintain in the future.
+
+## Compilation using Qt Creator
+
+
+- Switch to the
6.1.3_compile_against_6.2.4_assistant_webengine branch.
+ - Using a stock distribution of the Qt SDK with WebEngine support (6.2.4 is known to work) open the file
CMakeLists.txt in Qt Creator.
+ - In Projects, select the appropriate Qt Kit if you have multiple installed.
+
- In Build Settings, for Debug and Release individually, Build Steps, add this Custom Process Step (shown for Windows):
+
+Field | Content
+------------------ | -------------
+Command: | windeployqt
+Arguments: | assistant.exe
+Working directory: | %{buildDir}\bin
+
+This will copy the necessary shared libraries so that Assistant will run from the bin subdirectory inside the build directory.
+
+
+## Compilation using cmake
+
+- Switch to the
6.1.3_compile_against_6.2.4_assistant_webengine branch.
+ - Ensure you have appropriate cmake version (3.15+).
+
- Ensure you have the correct version of Qt configured, or pass in on cmake command line.
+
- Set up to use appropriate compiler (e.g. scl enable, or vcvars64.bat).
+
- Create build directory and change to it. (E.g. as a subdirectory of qttools)
+
- For Windows:
+
+ - Run cmake: cmake .. -DCMAKE_PREFIX_PATH=p:\qt\qt-opensource-6.2.4\win64_vc142 -DCMAKE_GENERATOR=Ninja -DCMAKE_BUILD_TYPE=Release
+
- ninja.exe assistant
+
+ - For Linux:
+
+ - Run cmake: cmake ..
+
- make assistant
+
+
+
\ No newline at end of file
diff --git a/cmake/FindWrapLibClang.cmake b/cmake/FindWrapLibClang.cmake
new file mode 100644
index 0000000000..78a22cd04e
--- /dev/null
+++ b/cmake/FindWrapLibClang.cmake
@@ -0,0 +1,81 @@
+if(TARGET WrapLibClang::WrapLibClang)
+ set(WrapLibClang_FOUND TRUE)
+ return()
+endif()
+
+if(DEFINED ENV{LLVM_INSTALL_DIR})
+ set(__qt_wrap_clang_backup_prefix "${CMAKE_PREFIX_PATH}")
+ list(PREPEND CMAKE_PREFIX_PATH "$ENV{LLVM_INSTALL_DIR}")
+elseif(DEFINED CACHE{LLVM_INSTALL_DIR})
+ set(__qt_wrap_clang_backup_prefix "${CMAKE_PREFIX_PATH}")
+ list(PREPEND CMAKE_PREFIX_PATH "${LLVM_INSTALL_DIR}")
+endif()
+
+find_package(Clang CONFIG)
+
+if(__qt_wrap_clang_backup_prefix)
+ set(CMAKE_PREFIX_PATH "${__qt_wrap_clang_backup_prefix}")
+ unset(__qt_wrap_clang_backup_prefix)
+endif()
+
+set(WrapLibClang_FOUND FALSE)
+set(__wrap_lib_clang_requested_version_found FALSE)
+
+# Need to explicitly handle the version check, because the Clang package doesn't.
+if(WrapLibClang_FIND_VERSION AND LLVM_PACKAGE_VERSION
+ AND LLVM_PACKAGE_VERSION VERSION_GREATER_EQUAL "${WrapLibClang_FIND_VERSION}")
+ set(__wrap_lib_clang_requested_version_found TRUE)
+endif()
+
+if(TARGET libclang AND ((TARGET clang-cpp AND TARGET LLVM) OR TARGET clangHandleCXX) AND __wrap_lib_clang_requested_version_found)
+ set(WrapLibClang_FOUND TRUE)
+
+ get_target_property(type libclang TYPE)
+ if (MSVC AND type STREQUAL "STATIC_LIBRARY")
+ get_property(__wrap_lib_clang_multi_config
+ GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+ if(__wrap_lib_clang_multi_config)
+ set(__wrap_lib_clang_configs ${CMAKE_CONFIGURATION_TYPES})
+ else()
+ set(__wrap_lib_clang_configs ${CMAKE_BUILD_TYPE})
+ endif()
+ set(__wrap_lib_clang_non_release_configs ${configs})
+ list(REMOVE_ITEM __wrap_lib_clang_non_release_configs
+ Release MinSizeRel RelWithDebInfo)
+ if(__wrap_lib_clang_non_release_configs STREQUAL __wrap_lib_clang_configs)
+ message(STATUS "Static linkage against libclang with MSVC was requested, but the build is not a release build, therefore libclang cannot be used.")
+ set(WrapLibClang_FOUND FALSE)
+ endif()
+ endif()
+
+ if(WrapLibClang_FOUND)
+ add_library(WrapLibClang::WrapLibClang IMPORTED INTERFACE)
+
+ target_include_directories(WrapLibClang::WrapLibClang INTERFACE ${CLANG_INCLUDE_DIRS})
+ if (NOT TARGET Threads::Threads)
+ find_package(Threads)
+ endif()
+ qt_internal_disable_find_package_global_promotion(Threads::Threads)
+ # lupdate must also link to LLVM when using clang-cpp
+ set(__qt_clang_genex_condition "$,$>")
+ set(__qt_clang_genex "$")
+ target_link_libraries(WrapLibClang::WrapLibClang
+ INTERFACE libclang
+ ${__qt_clang_genex}
+ Threads::Threads
+ )
+
+ foreach(version MAJOR MINOR PATCH)
+ set(QT_LIB_CLANG_VERSION_${version} ${LLVM_VERSION_${version}} CACHE STRING "" FORCE)
+ endforeach()
+ set(QT_LIB_CLANG_VERSION ${LLVM_PACKAGE_VERSION} CACHE STRING "" FORCE)
+ set(QT_LIB_CLANG_LIBDIR "${LLVM_LIBRARY_DIRS}" CACHE STRING "" FORCE)
+ set(QT_LIBCLANG_RESOURCE_DIR
+ "\"${QT_LIB_CLANG_LIBDIR}/clang/${QT_LIB_CLANG_VERSION}/include\"" CACHE STRING "" FORCE)
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(WrapLibClang
+ REQUIRED_VARS WrapLibClang_FOUND
+ VERSION_VAR LLVM_PACKAGE_VERSION)
diff --git a/coin/module_config.yaml b/coin/module_config.yaml
new file mode 100644
index 0000000000..5069e9d7a0
--- /dev/null
+++ b/coin/module_config.yaml
@@ -0,0 +1,38 @@
+version: 2
+accept_configuration:
+ condition: property
+ property: features
+ not_contains_value: Disable
+
+instructions:
+ Build:
+ - !include "{{qt/qtbase}}/coin_module_build_template_v2.yaml"
+
+ Test:
+ - !include "{{qt/qtbase}}/coin_module_test_template_v3.yaml"
+ - type: Group
+ instructions:
+ - !include "{{qt/qtbase}}/prepare_building_env.yaml"
+ - type: EnvironmentVariable
+ variableName: QDOC_NOLINKERRORS
+ variableValue: 1
+ - type: EnvironmentVariable
+ variableName: QDOC_ENABLE_WARNINGLIMIT
+ variableValue: 1
+ - type: SetBuildDirectory
+ directory: "{{.SourceDir}}"
+ - type: ChangeDirectory
+ directory: "{{.BuildDir}}"
+ - type: EnvironmentVariable
+ variableName: COIN_CMAKE_ARGS
+ variableValue: "-DBUILD_TESTING=OFF {{.SourceDir}}"
+ - !include "{{qt/qtbase}}/call_cmake.yaml"
+ - type: ExecuteCommand
+ command: "cmake --build . --target generate_docs"
+ maxTimeInSeconds: 1800
+ maxTimeBetweenOutput: 900
+ userMessageOnFailure: "Documentation check failed, see the log for details."
+ enable_if:
+ condition: property
+ property: features
+ contains_value: "TestDocs"
diff --git a/configure.cmake b/configure.cmake
new file mode 100644
index 0000000000..b4a02e893d
--- /dev/null
+++ b/configure.cmake
@@ -0,0 +1,128 @@
+
+
+#### Inputs
+
+
+
+#### Libraries
+
+
+
+#### Tests
+
+# libclang
+# special case begin
+# Even though Qt builds with qmake and libclang 6.0, it fails with CMake.
+# Presumably because 6.0 ClangConfig.cmake files are not good enough?
+# In any case explicitly request a minimum version of 8.x for now, otherwise
+# building with CMake will fail at compilation time.
+qt_find_package(WrapLibClang 8 PROVIDED_TARGETS WrapLibClang::WrapLibClang)
+# special case end
+
+if(TARGET WrapLibClang::WrapLibClang)
+ set(TEST_libclang "ON" CACHE BOOL "Required libclang version found." FORCE)
+endif()
+
+
+
+#### Features
+
+qt_feature("assistant" PRIVATE
+ LABEL "Qt Assistant"
+ PURPOSE "Qt Assistant is a tool for viewing on-line documentation in Qt help file format."
+)
+qt_feature("clang" PRIVATE
+ LABEL "QDoc"
+ CONDITION TEST_libclang
+)
+qt_feature("clangcpp" PRIVATE
+ LABEL "Clang-based lupdate parser"
+ CONDITION QT_FEATURE_clang AND TEST_libclang
+)
+qt_feature("designer" PRIVATE
+ LABEL "Qt Designer"
+ PURPOSE "Qt Designer is the Qt tool for designing and building graphical user interfaces (GUIs) with Qt Widgets. You can compose and customize your windows or dialogs in a what-you-see-is-what-you-get (WYSIWYG) manner, and test them using different styles and resolutions."
+)
+qt_feature("distancefieldgenerator" PRIVATE
+ LABEL "Qt Distance Field Generator"
+ PURPOSE "The Qt Distance Field Generator tool can be used to pregenerate the font cache in order to optimize startup performance."
+)
+qt_feature("kmap2qmap" PRIVATE
+ LABEL "kmap2qmap"
+ PURPOSE "kmap2qmap is a tool to generate keymaps for use on Embedded Linux. The source files have to be in standard Linux kmap format that is e.g. understood by the kernel's loadkeys command."
+)
+qt_feature("linguist" PRIVATE
+ LABEL "Qt Linguist"
+ PURPOSE "Qt Linguist can be used by translator to translate text in Qt applications."
+)
+qt_feature("macdeployqt" PRIVATE
+ LABEL "Mac Deployment Tool"
+ PURPOSE "The Mac deployment tool automates the process of creating a deployable application bundle that contains the Qt libraries as private frameworks."
+ CONDITION APPLE
+)
+qt_feature("pixeltool" PRIVATE
+ LABEL "pixeltool"
+ PURPOSE "The Qt Pixel Zooming Tool is a graphical application that magnifies the screen around the mouse pointer so you can look more closely at individual pixels."
+)
+qt_feature("qdbus" PRIVATE
+ LABEL "qdbus"
+ PURPOSE "qdbus is a communication interface for Qt-based applications."
+)
+qt_feature("qev" PRIVATE
+ LABEL "qev"
+ PURPOSE "qev allows introspection of incoming events for a QWidget, similar to the X11 xev tool."
+)
+qt_feature("qtattributionsscanner" PRIVATE
+ LABEL "Qt Attributions Scanner"
+ PURPOSE "Qt Attributions Scanner generates attribution documents for third-party code in Qt."
+)
+qt_feature("qtdiag" PRIVATE
+ LABEL "qtdiag"
+ PURPOSE "qtdiag outputs information about the Qt installation it was built with."
+)
+qt_feature("qtpaths" PRIVATE
+ LABEL "qtpaths"
+ PURPOSE "qtpaths is a command line client to QStandardPaths."
+)
+qt_feature("qtplugininfo" PRIVATE
+ LABEL "qtplugininfo"
+ PURPOSE "qtplugininfo dumps metadata about Qt plugins in JSON format."
+)
+qt_feature("windeployqt" PRIVATE
+ LABEL "Windows deployment tool"
+ PURPOSE "The Windows deployment tool is designed to automate the process of creating a deployable folder containing the Qt-related dependencies (libraries, QML imports, plugins, and translations) required to run the application from that folder. It creates a sandbox for Universal Windows Platform (UWP) or an installation tree for Windows desktop applications, which can be easily bundled into an installation package."
+ CONDITION WIN32
+)
+qt_configure_add_summary_section(NAME "Qt Tools")
+qt_configure_add_summary_entry(ARGS "assistant")
+qt_configure_add_summary_entry(ARGS "clang")
+qt_configure_add_summary_entry(ARGS "clangcpp")
+qt_configure_add_summary_entry(ARGS "designer")
+qt_configure_add_summary_entry(ARGS "distancefieldgenerator")
+qt_configure_add_summary_entry(ARGS "kmap2qmap")
+qt_configure_add_summary_entry(ARGS "linguist")
+qt_configure_add_summary_entry(ARGS "macdeployqt")
+qt_configure_add_summary_entry(ARGS "pixeltool")
+qt_configure_add_summary_entry(ARGS "qdbus")
+qt_configure_add_summary_entry(ARGS "qev")
+qt_configure_add_summary_entry(ARGS "qtattributionsscanner")
+qt_configure_add_summary_entry(ARGS "qtdiag")
+qt_configure_add_summary_entry(ARGS "qtpaths")
+qt_configure_add_summary_entry(ARGS "qtplugininfo")
+qt_configure_add_summary_entry(ARGS "windeployqt")
+qt_configure_end_summary_section() # end of "Qt Tools" section
+qt_configure_add_report_entry(
+ TYPE WARNING
+ MESSAGE "QDoc will not be compiled, probably because libclang could not be located. This means that you cannot build the Qt documentation.
+Either set CMAKE_PREFIX_PATH or LLVM_INSTALL_DIR to the location of your llvm installation.
+On Linux systems, you may be able to install libclang by installing the libclang-dev or libclang-devel package, depending on your distribution.
+On macOS, you can use Homebrew's llvm package.
+You will also need to set the FEATURE_clang CMake variable to ON to re-evaluate this check."
+ CONDITION NOT QT_FEATURE_clang
+)
+qt_configure_add_report_entry(
+ TYPE WARNING
+ MESSAGE "Clang-based lupdate parser will not be available. LLVM and Clang C++ libraries have not been found.
+You will need to set the FEATURE_clangcpp CMake variable to ON to re-evaluate this check."
+ CONDITION NOT QT_FEATURE_clangcpp
+)
diff --git a/configure.json b/configure.json
index cd111df837..4b8e64e798 100644
--- a/configure.json
+++ b/configure.json
@@ -1,5 +1,151 @@
{
- "subconfigs": [
- "src/qdoc"
+ "files": {
+ "publicHeader": "src/global/qttools-config.h",
+ "privateHeader": "src/global/qttools-config_p.h",
+ "publicPro": "src/global/qttools-config.pri",
+ "privatePro": "src/global/qttools-config.pri"
+ },
+ "module": "tools",
+ "tests": {
+ "libclang": {
+ "label": "libclang",
+ "test": "libclang",
+ "type": "libclang"
+ }
+ },
+ "features": {
+ "assistant": {
+ "label": "Qt Assistant",
+ "purpose": "Qt Assistant is a tool for viewing on-line documentation in Qt help file format.",
+ "output": [ "privateFeature" ]
+ },
+ "clang": {
+ "label": "QDoc",
+ "condition": "tests.libclang",
+ "output": [
+ "privateFeature",
+ { "type": "varAssign", "name": "CLANG_LIBS", "value": "tests.libclang.libs" },
+ { "type": "varAssign", "name": "CLANG_INCLUDEPATH", "value": "tests.libclang.includepath" },
+ { "type": "varAssign", "name": "CLANG_LIBDIR", "value": "tests.libclang.libdir" },
+ { "type": "varAssign", "name": "CLANG_DEFINES", "value": "tests.libclang.defines" },
+ { "type": "varAssign", "name": "CLANG_VERSION", "value": "tests.libclang.version" },
+ { "type": "varAssign", "name": "CLANG_MAJOR_VERSION", "value": "tests.libclang.major_version" },
+ { "type": "varAssign", "name": "CLANG_MINOR_VERSION", "value": "tests.libclang.minor_version" },
+ { "type": "varAssign", "name": "CLANG_PATCH_VERSION", "value": "tests.libclang.patch_version" }
+ ]
+ },
+ "clangcpp": {
+ "label": "Clang-based lupdate parser",
+ "condition": "features.clang && tests.libclang.has_clangcpp",
+ "output": [
+ "privateFeature",
+ { "type": "varAssign", "name": "CLANGCPP_LIBS", "value": "tests.libclang.clangcpp_libs" }
+ ]
+ },
+ "designer": {
+ "label": "Qt Designer",
+ "purpose": "Qt Designer is the Qt tool for designing and building graphical user interfaces (GUIs) with Qt Widgets. You can compose and customize your windows or dialogs in a what-you-see-is-what-you-get (WYSIWYG) manner, and test them using different styles and resolutions.",
+ "output": [ "privateFeature" ]
+ },
+ "distancefieldgenerator": {
+ "label": "Qt Distance Field Generator",
+ "purpose": "The Qt Distance Field Generator tool can be used to pregenerate the font cache in order to optimize startup performance.",
+ "output": [ "privateFeature" ]
+ },
+ "kmap2qmap": {
+ "label": "kmap2qmap",
+ "purpose": "kmap2qmap is a tool to generate keymaps for use on Embedded Linux. The source files have to be in standard Linux kmap format that is e.g. understood by the kernel's loadkeys command.",
+ "output": [ "privateFeature" ]
+ },
+ "linguist": {
+ "label": "Qt Linguist",
+ "purpose": "Qt Linguist can be used by translator to translate text in Qt applications.",
+ "output": [ "privateFeature" ]
+ },
+ "macdeployqt": {
+ "label": "Mac Deployment Tool",
+ "purpose": "The Mac deployment tool automates the process of creating a deployable application bundle that contains the Qt libraries as private frameworks.",
+ "condition": "config.darwin",
+ "output": [ "privateFeature" ]
+ },
+ "pixeltool": {
+ "label": "pixeltool",
+ "purpose": "The Qt Pixel Zooming Tool is a graphical application that magnifies the screen around the mouse pointer so you can look more closely at individual pixels.",
+ "output": [ "privateFeature" ]
+ },
+ "qdbus": {
+ "label": "qdbus",
+ "purpose": "qdbus is a communication interface for Qt-based applications.",
+ "output": [ "privateFeature" ]
+ },
+ "qev": {
+ "label": "qev",
+ "purpose": "qev allows introspection of incoming events for a QWidget, similar to the X11 xev tool.",
+ "output": [ "privateFeature" ]
+ },
+ "qtattributionsscanner": {
+ "label": "Qt Attributions Scanner",
+ "purpose": "Qt Attributions Scanner generates attribution documents for third-party code in Qt.",
+ "output": [ "privateFeature" ]
+ },
+ "qtdiag": {
+ "label": "qtdiag",
+ "purpose": "qtdiag outputs information about the Qt installation it was built with.",
+ "output": [ "privateFeature" ]
+ },
+ "qtpaths": {
+ "label": "qtpaths",
+ "purpose": "qtpaths is a command line client to QStandardPaths.",
+ "output": [ "privateFeature" ]
+ },
+ "qtplugininfo": {
+ "label": "qtplugininfo",
+ "purpose": "qtplugininfo dumps metadata about Qt plugins in JSON format.",
+ "output": [ "privateFeature" ]
+ },
+ "windeployqt": {
+ "label": "Windows deployment tool",
+ "purpose": "The Windows deployment tool is designed to automate the process of creating a deployable folder containing the Qt-related dependencies (libraries, QML imports, plugins, and translations) required to run the application from that folder. It creates a sandbox for Universal Windows Platform (UWP) or an installation tree for Windows desktop applications, which can be easily bundled into an installation package.",
+ "condition": "config.win32",
+ "output": [ "privateFeature" ]
+ }
+ },
+ "report": [
+ {
+ "type": "warning",
+ "condition": "!features.clang",
+ "message": "QDoc will not be compiled, probably because libclang could not be located. This means that you cannot build the Qt documentation.\n
+Either set CMAKE_PREFIX_PATH or LLVM_INSTALL_DIR to the location of your llvm installation.
+On Linux systems, you may be able to install libclang by installing the libclang-dev or libclang-devel package, depending on your distribution.
+On macOS, you can use Homebrew's llvm package."
+ },
+ {
+ "type": "warning",
+ "condition": "!features.clangcpp",
+ "message": "Clang-based lupdate parser will not be available. LLVM and Clang C++ libraries have not been found."
+ }
+ ],
+ "summary": [
+ {
+ "section": "Qt Tools",
+ "entries": [
+ "assistant",
+ "clang",
+ "clangcpp",
+ "designer",
+ "distancefieldgenerator",
+ "kmap2qmap",
+ "linguist",
+ "macdeployqt",
+ "pixeltool",
+ "qdbus",
+ "qev",
+ "qtattributionsscanner",
+ "qtdiag",
+ "qtpaths",
+ "qtplugininfo",
+ "windeployqt"
+ ]
+ }
]
}
diff --git a/configure.pri b/configure.pri
new file mode 100644
index 0000000000..98c52d2697
--- /dev/null
+++ b/configure.pri
@@ -0,0 +1,434 @@
+defineReplace(extractVersion) { return($$replace(1, ^(\\d+\\.\\d+\\.\\d+)(svn|git)?$, \\1)) }
+defineReplace(extractMajorVersion) { return($$replace(1, ^(\\d+)\\.\\d+\\.\\d+(svn|git)?$, \\1)) }
+defineReplace(extractMinorVersion) { return($$replace(1, ^\\d+\\.(\\d+)\\.\\d+(svn|git)?$, \\1)) }
+defineReplace(extractPatchVersion) { return($$replace(1, ^\\d+\\.\\d+\\.(\\d+)(svn|git)?$, \\1)) }
+
+defineTest(versionIsAtLeast) {
+ actual_major_version = $$extractMajorVersion($$1)
+ actual_minor_version = $$extractMinorVersion($$1)
+ actual_patch_version = $$extractPatchVersion($$1)
+ required_min_major_version = $$extractMajorVersion($$2)
+ required_min_minor_version = $$extractMinorVersion($$2)
+ required_min_patch_version = $$extractPatchVersion($$2)
+
+ isEqual(actual_major_version, $$required_min_major_version) {
+ isEqual(actual_minor_version, $$required_min_minor_version) {
+ isEqual(actual_patch_version, $$required_min_patch_version): return(true)
+ greaterThan(actual_patch_version, $$required_min_patch_version): return(true)
+ }
+ greaterThan(actual_minor_version, $$required_min_minor_version): return(true)
+ }
+ greaterThan(actual_major_version, $$required_min_major_version): return(true)
+
+ return(false)
+}
+
+defineReplace(findLLVMVersionFromLibDir) {
+ libdir = $$1
+ version_dirs = $$files($$libdir/clang/*)
+ for (version_dir, version_dirs) {
+ fileName = $$basename(version_dir)
+ version = $$find(fileName, ^(\\d+\\.\\d+\\.\\d+)$)
+ !isEmpty(version) {
+ isEmpty(candidateVersion): candidateVersion = $$version
+ else: versionIsAtLeast($$version, $$candidateVersion): candidateVersion = $$version
+ }
+ }
+ return($$candidateVersion)
+}
+
+defineReplace(FindCleanLLVMInstallDir) {
+ # Assume libclang is installed on the target system
+ equals(QMAKE_HOST.os, Windows) {
+ # on Windows we have only two host compilers, MSVC or mingw. The former we never
+ # use for cross-compilation where it isn't also the target compiler. The latter
+ # is not detectable as this .prf file is evaluated against the target configuration
+ # and therefore checking for "mingw" won't work when the target compiler is clang (Android)
+ # or qcc (QNX).
+ msvc {
+ isEmpty(LLVM_INSTALL_DIR): LLVM_INSTALL_DIR = $$(LLVM_INSTALL_DIR_MSVC)
+ } else {
+ isEmpty(LLVM_INSTALL_DIR): LLVM_INSTALL_DIR = $$(LLVM_INSTALL_DIR_MINGW)
+ }
+ }
+ isEmpty(LLVM_INSTALL_DIR): LLVM_INSTALL_DIR = $$(LLVM_INSTALL_DIR)
+ isEmpty(LLVM_INSTALL_DIR) {
+ llvmConfigCandidates = \
+ llvm-config-10 \
+ llvm-config-9 \
+ llvm-config-8 \
+ llvm-config-7 \
+ llvm-config-6.0 \
+ llvm-config-5.0 \
+ llvm-config-4.0 \
+ llvm-config-3.9 \
+ llvm-config
+
+ for (candidate, llvmConfigCandidates) {
+ LLVM_INSTALL_DIR = $$system("$$candidate --prefix 2>$$QMAKE_SYSTEM_NULL_DEVICE")
+ !isEmpty(LLVM_INSTALL_DIR) {
+ CLANG_INCLUDEPATH = $$system("$$candidate --includedir 2>/dev/null")
+ LIBCLANG_MAIN_HEADER = $$CLANG_INCLUDEPATH/clang-c/Index.h
+ !exists($$LIBCLANG_MAIN_HEADER) {
+ !isEmpty(LLVM_INSTALL_DIR): \
+ qtLog("Cannot find libclang's main header file, candidate: $${LIBCLANG_MAIN_HEADER}.")
+ continue
+ } else {
+ qtLog("QDoc:" \
+ "Using Clang installation found in $${LLVM_INSTALL_DIR}." \
+ "Set the LLVM_INSTALL_DIR environment variable to override.")
+ break()
+ }
+ }
+ }
+ }
+ LLVM_INSTALL_DIR = $$clean_path($$LLVM_INSTALL_DIR)
+ return($$LLVM_INSTALL_DIR)
+}
+
+defineReplace(FindClangInstallDir) {
+ llvm_install_dir=$$1
+ contains(QMAKE_HOST.arch, x86_64): \
+ clangInstallDir = $$replace(llvm_install_dir, _ARCH_, 64)
+ else: \
+ clangInstallDir = $$replace(llvm_install_dir, _ARCH_, 32)
+ isEmpty(llvm_install_dir) {
+ macos {
+ # Default to homebrew llvm on macOS. The CLANG_VERSION test below will complain if missing.
+ clangInstallDir = $$system("brew --prefix llvm")
+ } else {
+ clangInstallDir = /usr
+ }
+ }
+ return($$clangInstallDir)
+}
+
+defineReplace(CheckClangCppLibForLupdateParser) {
+ clangLibDir = $$1
+ libToTest = clangTooling \
+ clangFrontendTool \
+ clangFrontend \
+ clangDriver \
+ clangSerialization \
+ clangCodeGen \
+ clangParse \
+ clangSema \
+ clangStaticAnalyzerFrontend \
+ clangStaticAnalyzerCheckers \
+ clangStaticAnalyzerCore \
+ clangAnalysis \
+ clangARCMigrate \
+ clangASTMatchers \
+ clangAST \
+ clangRewrite \
+ clangRewriteFrontend \
+ clangEdit \
+ clangLex \
+ clangIndex \
+ clangBasic
+
+ versionIsAtLeast($$CLANG_VERSION, "9.0.0"){
+ libToTest += clangToolingRefactoring
+ } else {
+ libToTest += clangToolingRefactor
+ }
+
+
+ CLANG_CPP_LIBS =
+ for (lib, libToTest) {
+ libFullPath =
+ msvc {
+ libFullPath += $$clangLibDir/$${lib}.lib
+ } else {
+ equals(QMAKE_HOST.os, Windows): \
+ libFullPath += $$clangLibDir/$${lib}.lib
+ else: \
+ libFullPath += $$clangLibDir/lib$${lib}.a
+ }
+
+ CLANG_CPP_LIBS += -l$$lib
+ !exists($$libFullPath): {
+ CLANG_CPP_LIBS =
+ qtLog("Cannot locate $$libFullPath.")
+ return($$CLANG_CPP_LIBS)
+ }
+ }
+ return($$CLANG_CPP_LIBS)
+}
+
+defineReplace(CheckClangLlvmLibForLupdateParser) {
+ clangLibDir = $$1
+ libToTest += LLVMOption \
+ LLVMProfileData \
+ LLVMMCParser \
+ LLVMMC \
+ LLVMBitReader \
+ LLVMCore \
+ LLVMBinaryFormat \
+ LLVMSupport \
+ LLVMDemangle
+
+ versionIsAtLeast($$CLANG_VERSION, "9.0.0") {
+ libToTest += LLVMBitstreamReader\
+ LLVMRemarks
+ }
+
+ CLANG_LLVM_LIBS =
+ for (lib, libToTest) {
+ libFullPath =
+ msvc {
+ libFullPath += $$clangLibDir/$${lib}.lib
+ } else {
+ equals(QMAKE_HOST.os, Windows): \
+ libFullPath += $$clangLibDir/$${lib}.lib
+ else: \
+ libFullPath += $$clangLibDir/lib$${lib}.a
+ }
+
+ CLANG_LLVM_LIBS += -l$$lib
+ !exists($$libFullPath): {
+ CLANG_LLVM_LIBS =
+ return($$CLANG_LLVM_LIBS)
+ }
+ }
+ !equals(QMAKE_HOST.os, Windows): {
+ equals(QMAKE_HOST.os, Darwin): CLANG_LLVM_LIBS += -lz -lcurses
+ else: CLANG_LLVM_LIBS += -lz -ltinfo
+ }
+ return($$CLANG_LLVM_LIBS)
+}
+
+defineTest(qtConfTest_libclang) {
+ isEmpty(QDOC_USE_STATIC_LIBCLANG): QDOC_USE_STATIC_LIBCLANG = $$(QDOC_USE_STATIC_LIBCLANG)
+
+ LLVM_INSTALL_DIR = $$FindCleanLLVMInstallDir()
+ isEmpty(LLVM_INSTALL_DIR) {
+ equals(QMAKE_HOST.os, Windows) {
+ return(false)
+ }
+ }
+ clangInstallDir = $$FindClangInstallDir($$LLVM_INSTALL_DIR)
+
+ # note: llvm_config only exits on unix
+ llvm_config = $$clangInstallDir/bin/llvm-config
+ exists($$llvm_config) {
+ CLANG_LIBDIR = $$system("$$llvm_config --libdir 2>/dev/null")
+ CLANG_INCLUDEPATH = $$system("$$llvm_config --includedir 2>/dev/null")
+ output = $$system("$$llvm_config --version 2>/dev/null")
+ CLANG_VERSION = $$extractVersion($$output)
+ } else {
+ CLANG_LIBDIR = $$clangInstallDir/lib
+ CLANG_INCLUDEPATH = $$clangInstallDir/include
+ CLANG_VERSION = $$findLLVMVersionFromLibDir($$CLANG_LIBDIR)
+ }
+ isEmpty(CLANG_VERSION) {
+ !isEmpty(LLVM_INSTALL_DIR): \
+ qtLog("Cannot determine version of clang installation in $${clangInstallDir}.")
+ return(false)
+ } else {
+ CLANG_MAJOR_VERSION = $$extractMajorVersion($$CLANG_VERSION)
+ CLANG_MINOR_VERSION = $$extractMinorVersion($$CLANG_VERSION)
+ CLANG_PATCH_VERSION = $$extractPatchVersion($$CLANG_VERSION)
+ }
+
+ LIBCLANG_MAIN_HEADER = $$CLANG_INCLUDEPATH/clang-c/Index.h
+ !exists($$LIBCLANG_MAIN_HEADER) {
+ !isEmpty(LLVM_INSTALL_DIR): \
+ qtLog("Cannot find libclang's main header file, candidate: $${LIBCLANG_MAIN_HEADER}.")
+ return(false)
+ }
+
+ !contains(QMAKE_DEFAULT_LIBDIRS, $$CLANG_LIBDIR): CLANG_LIBS = -L$${CLANG_LIBDIR}
+
+ CLANG_DEFINES =
+ HAS_CLANGCPP = false
+ CLANGCPP_LIB =
+
+ isEmpty(QDOC_USE_STATIC_LIBCLANG) {
+ # entering here in case of user (as opposed to CI)
+
+ #--------------- QDoc needs --------------------------------
+ equals(QMAKE_HOST.os, Windows): \
+ CLANG_LIBS += -llibclang -ladvapi32 -lshell32 -lversion
+ else: \
+ CLANG_LIBS += -lclang
+
+ #--------------- Lupdate clang-based parser needs Clang C++ and llvm libraries
+ CLANGCPP_DY_LIB = $$CLANG_LIBDIR/libclang_shared.so
+ # Checking clang cpp libraries
+ # check for shared libraries (not available for Windows at the moment)
+ exists($$CLANGCPP_DY_LIB): {
+ CLANGCPP_LIBS += -lclang_shared
+ } else {
+ # check for static libraries
+ CLANGCPP_LIBS += $$CheckClangCppLibForLupdateParser($$CLANG_LIBDIR)
+ }
+ # Checking for LLVM libraries needed for Lupdate clang-based parser
+ # At this point, if CLANGCPP_LIBS is empty, no need to go further
+ !isEmpty(CLANGCPP_LIBS): {
+ LLVM_DY_LIB = $$CLANG_LIBDIR/libLLVM.so
+ # check for shared libraries (not available for Windows at the moment)
+ exists($$LLVM_DY_LIB): {
+ CLANGCPP_LIBS += -lLLVM
+ HAS_CLANGCPP = true # Clang cpp and llvm libraries have been found
+ } else: {
+ # check for static libraries
+ CLANGLLVM_LIBS = $$CheckClangLlvmLibForLupdateParser($$CLANG_LIBDIR)
+ !isEmpty(CLANGLLVM_LIBS): {
+ CLANGCPP_LIBS += $$CLANGLLVM_LIBS
+ HAS_CLANGCPP = true # Clang cpp and llvm libraries have been found
+ }
+ }
+ #----------------------------------------------------------------------
+ }
+ } else {
+ # CI
+ HAS_CLANGCPP = true #just assuming for now
+ equals(QMAKE_HOST.os, Windows) {
+ versionIsAtLeast($$CLANG_VERSION, "10.0.0") {
+ CLANG_DEFINES += CINDEX_NO_EXPORTS
+ } else {
+ CLANG_DEFINES += CINDEX_LINKAGE=
+ }
+ }
+ !equals(QMAKE_HOST.os, Darwin):!msvc: CLANG_LIBS+=-Wl,--start-group
+ CLANG_LIBS += -lclangAnalysis \
+ -lclangARCMigrate \
+ -lclangAST \
+ -lclangASTMatchers \
+ -lclangBasic \
+ -lclangCodeGen \
+ -lclangCrossTU \
+ -lclangDriver \
+ -lclangDynamicASTMatchers \
+ -lclangEdit \
+ -lclangFormat \
+ -lclangFrontend \
+ -lclangFrontendTool \
+ -lclangHandleCXX \
+ -lclangIndex \
+ -lclangLex \
+ -lclangParse \
+ -lclangRewrite \
+ -lclangRewriteFrontend \
+ -lclangSema \
+ -lclangSerialization \
+ -lclangStaticAnalyzerCheckers \
+ -lclangStaticAnalyzerCore \
+ -lclangStaticAnalyzerFrontend \
+ -lclangTooling \
+ -lclangToolingASTDiff \
+ -lclangToolingCore
+
+ versionIsAtLeast($$CLANG_VERSION, "10.0.0") {
+ equals(QMAKE_HOST.os, Windows): \
+ CLANG_LIBS += -llibclang
+ else: \
+ CLANG_LIBS += -lclang
+
+ CLANG_LIBS += -lclangToolingInclusions
+ } else {
+ equals(QMAKE_HOST.os, Windows): \
+ CLANG_LIBS += -llibclang_static
+ else: \
+ CLANG_LIBS += -lclang_static
+
+ CLANG_LIBS += \
+ -lclangApplyReplacements \
+ -lclangChangeNamespace \
+ -lclangDaemon \
+ -lclangIncludeFixer \
+ -lclangIncludeFixerPlugin \
+ -lclangMove \
+ -lclangQuery \
+ -lclangReorderFields \
+ -lclangTidy \
+ -lclangTidyAndroidModule \
+ -lclangTidyBoostModule \
+ -lclangTidyBugproneModule \
+ -lclangTidyCERTModule \
+ -lclangTidyCppCoreGuidelinesModule \
+ -lclangTidyFuchsiaModule \
+ -lclangTidyGoogleModule \
+ -lclangTidyHICPPModule \
+ -lclangTidyLLVMModule \
+ -lclangTidyMiscModule \
+ -lclangTidyModernizeModule \
+ -lclangTidyMPIModule \
+ -lclangTidyObjCModule \
+ -lclangTidyPerformanceModule \
+ -lclangTidyPlugin \
+ -lclangTidyReadabilityModule \
+ -lclangTidyUtils \
+ -lclangToolingRefactor \
+ -lfindAllSymbols
+ }
+
+ msvc {
+ LLVM_LIBS_STRING += $$system("$$llvm_config --libnames")
+ } else {
+ LLVM_LIBS_STRING += $$system("$$llvm_config --libs")
+ }
+ LLVM_LIBS_STRING += $$system("$$llvm_config --system-libs")
+ CLANG_LIBS += $$split(LLVM_LIBS_STRING, " ")
+
+ !equals(QMAKE_HOST.os, Darwin):!msvc: CLANG_LIBS+=-Wl,--end-group
+ equals(QMAKE_HOST.os, Windows): CLANG_LIBS += -lversion
+ }
+
+ !versionIsAtLeast($$CLANG_VERSION, "3.9.0") {
+ log("LLVM/Clang version >= 3.9.0 required, version provided: $${CLANG_VERSION}.$$escape_expand(\\n)")
+ return(false)
+ }
+
+ !versionIsAtLeast($$CLANG_VERSION, "8.0.0") {
+ # if not InitLLVM.h is missing
+ log("LLVM/Clang version >= 8.0.0 required for Clang-based lupdate parser. \
+ Version provided: $${CLANG_VERSION}.$$escape_expand(\\n)")
+ HAS_CLANGCPP = false
+ }
+
+ $${1}.libs = $$CLANG_LIBS
+ export($${1}.libs)
+ $${1}.cache += libs
+
+ $${1}.includepath = $$CLANG_INCLUDEPATH
+ export($${1}.includepath)
+ $${1}.cache += includepath
+
+ $${1}.libdir = $$CLANG_LIBDIR
+ export($${1}.libdir)
+ $${1}.cache += libdir
+
+ $${1}.defines = $$CLANG_DEFINES
+ export($${1}.defines)
+ $${1}.cache += defines
+
+ $${1}.version = $$CLANG_VERSION
+ export($${1}.version)
+ $${1}.cache += version
+
+ $${1}.major_version = $$CLANG_MAJOR_VERSION
+ export($${1}.major_version)
+ $${1}.cache += major_version
+
+ $${1}.minor_version = $$CLANG_MINOR_VERSION
+ export($${1}.minor_version)
+ $${1}.cache += minor_version
+
+ $${1}.patch_version = $$CLANG_PATCH_VERSION
+ export($${1}.patch_version)
+ $${1}.cache += patch_version
+
+ $${1}.has_clangcpp = $$HAS_CLANGCPP
+ export($${1}.has_clangcpp)
+ $${1}.cache += has_clangcpp
+
+ $${1}.clangcpp_libs = $$CLANGCPP_LIBS
+ export($${1}.clangcpp_libs)
+ $${1}.cache += clangcpp_libs
+
+ export($${1}.cache)
+
+ return(true)
+}
diff --git a/dependencies.yaml b/dependencies.yaml
new file mode 100644
index 0000000000..12aa807355
--- /dev/null
+++ b/dependencies.yaml
@@ -0,0 +1,10 @@
+dependencies:
+ ../qtactiveqt:
+ ref: 8aa4712020993be03e53006b2ab1bebf9a29638e
+ required: false
+ ../qtbase:
+ ref: b496064efab47743fff4eb22f68e3acb3315fd9d
+ required: true
+ ../qtdeclarative:
+ ref: 2f556e351d2ebdfc4561063665e266f800ec904f
+ required: false
diff --git a/dist/changes-5.12.10 b/dist/changes-5.12.10
new file mode 100644
index 0000000000..95c6a0b2fd
--- /dev/null
+++ b/dist/changes-5.12.10
@@ -0,0 +1,26 @@
+Qt 5.12.10 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.12.9.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+ https://doc.qt.io/qt-5.12/index.html
+
+The Qt version 5.12 series is binary compatible with the 5.11.x series.
+Applications compiled for 5.11 will continue to run with 5.12.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+ https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Important Behavior Changes *
+****************************************************************************
+
+****************************************************************************
+* Library *
+****************************************************************************
diff --git a/dist/changes-5.12.4 b/dist/changes-5.12.4
new file mode 100644
index 0000000000..4796a38281
--- /dev/null
+++ b/dist/changes-5.12.4
@@ -0,0 +1,33 @@
+Qt 5.12.4 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.12.0 through 5.12.3.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.12 series is binary compatible with the 5.11.x series.
+Applications compiled for 5.11 will continue to run with 5.12.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* lupdate *
+****************************************************************************
+
+ - lupdate will now generate an error if it is asked to update a .ts file
+ with translations, but without a target language. This is to ensure that
+ plural translations are not destroyed.
+
+****************************************************************************
+* qdoc *
+****************************************************************************
+
+ - [QTBUG-73058] qdoc now uses #! as a snippet marker in .cmake,
+ CMakeLists.txt files.
diff --git a/dist/changes-5.12.5 b/dist/changes-5.12.5
new file mode 100644
index 0000000000..379f39064c
--- /dev/null
+++ b/dist/changes-5.12.5
@@ -0,0 +1,37 @@
+Qt 5.12.5 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.12.0 through 5.12.4.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.12 series is binary compatible with the 5.11.x series.
+Applications compiled for 5.11 will continue to run with 5.12.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* distancefieldgenerator *
+****************************************************************************
+
+ - [QTBUG-76188] Fixed bug where the tool would fail for valid fonts with
+ the message "end of cmap table reached when parsing subtable".
+ - [QTBUG-76528] Fixed a bug where the generated textures might exceed the
+ maximum height.
+ - [QTBUG-76188][QTBUG-76528] Fixed possible crash when generating large
+ number of glyphs with a small texture size.
+ - [QTBUG-77501] Fixed broken text rendering when generating large glyph
+ sets.
+
+****************************************************************************
+* Qt Help *
+****************************************************************************
+
+ - [QDS-779] Fixed possible application freeze when using QtHelp module.
diff --git a/dist/changes-5.13.0 b/dist/changes-5.13.0
new file mode 100644
index 0000000000..2859e92607
--- /dev/null
+++ b/dist/changes-5.13.0
@@ -0,0 +1,37 @@
+Qt 5.13 introduces many new features and improvements as well as bugfixes
+over the 5.12.x series. For more details, refer to the online documentation
+included in this distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.13 series is binary compatible with the 5.12.x series.
+Applications compiled for 5.12 will continue to run with 5.13.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Designer *
+****************************************************************************
+
+ - Added a filter line edit to the object inspector.
+
+****************************************************************************
+* lupdate *
+****************************************************************************
+
+ - lupdate will now generate an error if it is asked to update a .ts file
+ with translations, but without a target language. This is to ensure that
+ plural translations are not destroyed.
+
+****************************************************************************
+* qdoc *
+****************************************************************************
+
+ - [QTBUG-73058] qdoc now uses #! as a snippet marker in .cmake,
+ CMakeLists.txt files.
diff --git a/dist/changes-5.13.1 b/dist/changes-5.13.1
new file mode 100644
index 0000000000..557d7021f5
--- /dev/null
+++ b/dist/changes-5.13.1
@@ -0,0 +1,29 @@
+Qt 5.13.1 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.13.0.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.13 series is binary compatible with the 5.12.x series.
+Applications compiled for 5.12 will continue to run with 5.13.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* distancefieldgenerator *
+****************************************************************************
+
+ - [QTBUG-76188] Fixed bug where the tool would fail for valid fonts with
+ the message "end of cmap table reached when parsing subtable".
+ - [QTBUG-76528] Fixed a bug where the generated textures might exceed the
+ maximum height.
+ - [QTBUG-76188][QTBUG-76528] Fixed possible crash when generating large
+ number of glyphs with a small texture size.
diff --git a/dist/changes-5.13.2 b/dist/changes-5.13.2
new file mode 100644
index 0000000000..f1a1f9dbbb
--- /dev/null
+++ b/dist/changes-5.13.2
@@ -0,0 +1,27 @@
+Qt 5.13.2 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.13.0 through 5.13.1.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.13 series is binary compatible with the 5.12.x series.
+Applications compiled for 5.12 will continue to run with 5.13.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Distance Field Generator *
+****************************************************************************
+
+ - [QTBUG-77499] Improved performance when selecting unicode ranges in
+ large fonts.
+ - [QTBUG-77501] Fixed broken text rendering when generating large glyph
+ sets.
diff --git a/dist/changes-5.14.0 b/dist/changes-5.14.0
new file mode 100644
index 0000000000..de2bb6fbdf
--- /dev/null
+++ b/dist/changes-5.14.0
@@ -0,0 +1,63 @@
+Qt 5.14 introduces many new features and improvements as well as bugfixes
+over the 5.13.x series. For more details, refer to the online documentation
+included in this distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.14 series is binary compatible with the 5.13.x series.
+Applications compiled for 5.13 will continue to run with 5.14.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* pixeltool *
+****************************************************************************
+
+ - 'c' now copies color under cursor, and shows it in the tool window title.
+
+****************************************************************************
+* Qt Designer *
+****************************************************************************
+
+ - [QTBUG-76375] A per-form setting for disabling generating calls to
+ QObject::connectSlotsByName() has been added to support migrating forms
+ to Qt 5 connection syntax.
+ - The multiselection-modifier of the buddy/signal slot editors has been
+ changed to Control instead of (historical) Shift.
+
+****************************************************************************
+* Qt Linguist *
+****************************************************************************
+
+ - [QTBUG-76265] lupdate now warns about qsTr() calls with template literals
+ in .qml files.
+ - [QTBUG-67908] Extra \n when reading translator comment from .po file now
+ gets removed.
+ - [QTBUG-76723] CMake: qt5_create_translation was creating a warning when
+ translation files had the same prefix, separated by a dot. This is now
+ fixed.
+
+****************************************************************************
+* windeployqt *
+****************************************************************************
+
+ - [QTBUG-15234] windeployqt does not patch paths in Qt5Core anymore if Qt
+ is configured with -feature-relocatable.
+ - [QTBUG-75272] Added option -no-virtualkeyboard to disable deployment of
+ Qt Virtual Keyboard.
+
+****************************************************************************
+* qdoc *
+****************************************************************************
+
+ - QDoc no longer attempts to run if 'project' configuration variable is
+ not set; it now fails with an appropriate error message.
+
+ - [QTBUG-80051] 'depends' configuration now accepts '*' as a value,
+ instructing QDoc to load all available index files as dependencies.
diff --git a/dist/changes-5.14.1 b/dist/changes-5.14.1
new file mode 100644
index 0000000000..ac11cec9df
--- /dev/null
+++ b/dist/changes-5.14.1
@@ -0,0 +1,26 @@
+Qt 5.14.1 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.14.0.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.14 series is binary compatible with the 5.13.x series.
+Applications compiled for 5.13 will continue to run with 5.14.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* windeployqt *
+****************************************************************************
+
+ - [QTBUG-80806] windeployqt has been fixed to work with MinGW, again.
+ - [QTBUG-78146] Fixed possible empty content and index widgets when using
+ Qt Help module.
diff --git a/dist/changes-5.14.2 b/dist/changes-5.14.2
new file mode 100644
index 0000000000..f90f453180
--- /dev/null
+++ b/dist/changes-5.14.2
@@ -0,0 +1,24 @@
+Qt 5.14.2 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.14.0 through 5.14.1.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.14 series is binary compatible with the 5.13.x series.
+Applications compiled for 5.13 will continue to run with 5.14.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* qdoc *
+****************************************************************************
+
+ - [QTBUG-82252] Fixed "-F" option on macOS
diff --git a/dist/changes-5.15.0 b/dist/changes-5.15.0
new file mode 100644
index 0000000000..b061a693f2
--- /dev/null
+++ b/dist/changes-5.15.0
@@ -0,0 +1,58 @@
+Qt 5.15 introduces many new features and improvements as well as bugfixes
+over the 5.14.x series. For more details, refer to the online documentation
+included in this distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.15 series is binary compatible with the 5.14.x series.
+Applications compiled for 5.14 will continue to run with 5.15.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* QtHelp *
+****************************************************************************
+
+ - QHelpLink data structure has been introduced and used in newly added
+ documentsForIdentifier() and documentsForKeyword() methods.
+ - Deprecated linksForIdentifier() and linksForKeyword() methods
+ in favor of the methods above.
+ - The QHelpFilterSettings class has been added, describing all
+ the available filter details.
+ - The QHelpFilterSettingsWidget class has been added, serving
+ as an editor for all available filters.
+
+****************************************************************************
+* Qt Designer *
+****************************************************************************
+
+ - The palette editor dialog has been overhauled.
+
+****************************************************************************
+* macdeployqt *
+****************************************************************************
+
+ - Added "-hardened-runtime" option to support app notarization.
+
+****************************************************************************
+* qdoc *
+****************************************************************************
+
+ - QDoc now supports DocBook as an output format.
+ - Introduced configuration variable 'locationinfo' to drop host-specific
+ paths from the generated output.
+ - Added capability to display class/method template parameters in the
+ generated documentation.
+ - QDoc now generates correct documentation for enum classes.
+ - QDoc is now aware of the namespace scope of an \fn command without
+ requiring fully qualified paths.
+ - Generate output for arguments passed to the \obsolete command.
+ - [QTBUG-37355] QDoc now generates a note for the name of the
+ corresponding handler in \qmlsignal documentation.
+ - Added support for CMake-based example projects.
diff --git a/dist/changes-5.15.1 b/dist/changes-5.15.1
new file mode 100644
index 0000000000..018a8c41cc
--- /dev/null
+++ b/dist/changes-5.15.1
@@ -0,0 +1,47 @@
+Qt 5.15.1 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.15.0.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+https://doc.qt.io/qt-5/index.html
+
+The Qt version 5.15 series is binary compatible with the 5.14.x series.
+Applications compiled for 5.14 will continue to run with 5.15.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Qt Designer *
+****************************************************************************
+
+ - New command line option --no-scaling allows to disable high-dpi
+ scaling.
+
+****************************************************************************
+* qdoc *
+****************************************************************************
+
+ - QDoc now correctly handles templated structs, unions, and type aliases.
+
+****************************************************************************
+* windeployqt *
+****************************************************************************
+
+ - New command line option --translations allows to pass a comma-separated
+ list of languages (.qm files) to deploy.
+ - Fixed an issue where the MSVC Runtime variant (Debug, Release) was
+ detected incorrectly especially on WinRT.
+ - Qt3D renderer plugins added in 5.15 are now automatically deployed.
+
+****************************************************************************
+* macdeployqt *
+****************************************************************************
+
+ - .prl files are not copied anymore to the Resources folder.
diff --git a/dist/changes-5.15.2 b/dist/changes-5.15.2
new file mode 100644
index 0000000000..fe9d83781e
--- /dev/null
+++ b/dist/changes-5.15.2
@@ -0,0 +1,72 @@
+Qt 5.15.2 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.15.1.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+ https://doc.qt.io/qt-5.15/index.html
+
+The Qt version 5.15 series is binary compatible with the 5.14.x series.
+Applications compiled for 5.14 will continue to run with 5.15.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+ https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Important Behavior Changes *
+****************************************************************************
+
+****************************************************************************
+* Library *
+****************************************************************************
+
+ - [QTBUG-87802] qdoc: Fix broken links generated by \sincelist
+ The combination of single-exec mode and outputting to subdirectories
+ (offline mode) made \sincelist generate href's to new classes and
+ functions that are missing the target subdirectory. This happened
+ because we did not pass the relative node to the function(s) that
+ generate that list - proper link resolution requires a check if the
+ page containing the \sincelist command comes from a different doc
+ module, and the relative node is used for that.
+ The bug was: qdoc: \sincelist generates broken links in certain
+ conditions
+ - [QTBUG-84703] qdoc: DocBook generator: Correctly handle enum classes
+ While commit 46f71fcc fixed handling of enum classes for the code
+ parser and marker, the DocBook generator has some dedicated code that
+ also needs to be amended.
+ The bug was: qdoc: DocBook generator: scoped enums not handled
+ correctly
+ - [QTBUG-86988] qdoc: DocBook generator: Remove code for encoding special characters
+ QXmlStreamWriter already handles this for us.
+ The bug was: qdoc: DocBook output format: XML special characters are
+ escaped twice
+ - [QTBUG-86759] Revert "macdeployqt: Don't copy .prl files into the Resources folder"
+ This was skipping other files from Resources/ as well, such as
+ “en-GB.pak” and “QtWebEngineProcess”. This reverts commit
+ aabba72f7965e06e2e6ed960d8cf8078249dac8c.
+ The bug was: Missing QtWebEngineProcess Application in application
+ frameworks
+ - [QTBUG-84727] QtHelp: Fix documentsFor() when not using filter engine
+ The bug was: QHelpIndexWidget does not emit documentActivated or
+ documentsActivated
+ - [QTBUG-86598] Assistant: fix build with QT_NO_CLIPBOARD
+ The bug was: Assistant fails to compile if QT_NO_CLIPBOARD is defined
+ - [QTBUG-86477] Fix static build of assistant
+ The bug was: [REG 5.15.0->5.15.1] assistant not build when building
+ whole Qt statically
+ - [QTBUG-86293] winrtrunner: Remove Windows Phone support
+ Windows Phone has not been supported for a while now. With newer
+ Windows versions the functionality causes issues. On build 1909 the
+ application hangs in CoUninitialize when called with --list-devices
+ and in build 2004 the needed classes are not registered at all.
+ The bug was: "winrtrunner --list-devices" hangs
+ - [QTBUG-86188] qdoc: Fix incorrect loop when processing tagged \fn parameters
+ This fixes ASSERT: "uint(i) < uint(size())" in file
+ qt5/qtbase/src/corelib/text/qstring.h, line 1067
+ The bug was: qdoc: Crash when using a tagged \fn command
+
diff --git a/dist/changes-6.0.0 b/dist/changes-6.0.0
new file mode 100644
index 0000000000..c7d04efec3
--- /dev/null
+++ b/dist/changes-6.0.0
@@ -0,0 +1,16 @@
+Qt 6.0.0 is a new major version release of Qt. It is not binary compatible with
+earlier Qt releases.
+
+The goal has been to retain as much source compatibility with Qt 5.15 as
+possible, but some changes were inevitable to make Qt a better framework.
+
+To make it easier to port to Qt 6.0, we have created a porting guide to
+summarize those changes and provide guidance to handle them. In the guide, you
+can find links to articles about changes that may affect your application and
+help you transition from Qt 5.15 to Qt 6.0:
+
+https://doc.qt.io/qt-6/portingguide.html
+
+For more details refer to the online documentation of Qt 6.0:
+
+https://doc.qt.io/qt-6/index.html
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
new file mode 100644
index 0000000000..8a360b99e7
--- /dev/null
+++ b/examples/CMakeLists.txt
@@ -0,0 +1,20 @@
+# Generated from examples.pro.
+
+qt_examples_build_begin()
+
+
+qt_exclude_tool_directories_from_default_target(
+ assistant
+)
+
+if(TARGET Qt::Widgets)
+ add_subdirectory(help)
+ add_subdirectory(linguist)
+ add_subdirectory(uitools)
+endif()
+if(QT_FEATURE_process AND TARGET Qt::Widgets)
+ add_subdirectory(designer)
+ add_subdirectory(assistant)
+endif()
+
+qt_examples_build_end()
diff --git a/examples/assistant/CMakeLists.txt b/examples/assistant/CMakeLists.txt
new file mode 100644
index 0000000000..bed9e1c4f8
--- /dev/null
+++ b/examples/assistant/CMakeLists.txt
@@ -0,0 +1,4 @@
+# Generated from assistant.pro.
+
+add_subdirectory(simpletextviewer)
+add_subdirectory(remotecontrol)
diff --git a/examples/assistant/remotecontrol/CMakeLists.txt b/examples/assistant/remotecontrol/CMakeLists.txt
new file mode 100644
index 0000000000..6f80e04780
--- /dev/null
+++ b/examples/assistant/remotecontrol/CMakeLists.txt
@@ -0,0 +1,53 @@
+# Generated from remotecontrol.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(remotecontrol LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/assistant/remotecontrol")
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Widgets)
+
+qt_add_executable(remotecontrol
+ main.cpp
+ remotecontrol.cpp remotecontrol.h remotecontrol.ui
+)
+set_target_properties(remotecontrol PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+target_link_libraries(remotecontrol PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Widgets
+)
+
+
+# Resources:
+set(remotecontrol_resource_files
+ "enter.png"
+)
+
+qt6_add_resources(remotecontrol "remotecontrol"
+ PREFIX
+ "/remotecontrol"
+ FILES
+ ${remotecontrol_resource_files}
+)
+
+install(TARGETS remotecontrol
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/assistant/remotecontrol/remotecontrol.h b/examples/assistant/remotecontrol/remotecontrol.h
index 40e370f713..f59ffb7aab 100644
--- a/examples/assistant/remotecontrol/remotecontrol.h
+++ b/examples/assistant/remotecontrol/remotecontrol.h
@@ -64,7 +64,7 @@ class RemoteControl : public QMainWindow
Q_OBJECT
public:
- RemoteControl(QWidget *parent = nullptr, Qt::WindowFlags flags = 0);
+ RemoteControl(QWidget *parent = nullptr, Qt::WindowFlags flags = {});
~RemoteControl();
private:
diff --git a/examples/assistant/simpletextviewer/.prev_CMakeLists.txt b/examples/assistant/simpletextviewer/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..7721159416
--- /dev/null
+++ b/examples/assistant/simpletextviewer/.prev_CMakeLists.txt
@@ -0,0 +1,47 @@
+# Generated from simpletextviewer.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(simpletextviewer LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/assistant/simpletextviewer")
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Widgets)
+
+qt_add_executable(simpletextviewer
+ assistant.cpp assistant.h
+ findfiledialog.cpp findfiledialog.h
+ main.cpp
+ mainwindow.cpp mainwindow.h
+ textedit.cpp textedit.h
+)
+set_target_properties(simpletextviewer PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+target_compile_definitions(simpletextviewer PUBLIC
+ SRCDIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/\\\"
+)
+
+target_link_libraries(simpletextviewer PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Widgets
+)
+
+install(TARGETS simpletextviewer
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/assistant/simpletextviewer/CMakeLists.txt b/examples/assistant/simpletextviewer/CMakeLists.txt
new file mode 100644
index 0000000000..7340062562
--- /dev/null
+++ b/examples/assistant/simpletextviewer/CMakeLists.txt
@@ -0,0 +1,47 @@
+# Generated from simpletextviewer.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(simpletextviewer LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/assistant/simpletextviewer")
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Widgets)
+
+qt_add_executable(simpletextviewer
+ assistant.cpp assistant.h
+ findfiledialog.cpp findfiledialog.h
+ main.cpp
+ mainwindow.cpp mainwindow.h
+ textedit.cpp textedit.h
+)
+set_target_properties(simpletextviewer PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+target_compile_definitions(simpletextviewer PUBLIC
+ SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}/" # special case
+)
+
+target_link_libraries(simpletextviewer PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Widgets
+)
+
+install(TARGETS simpletextviewer
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/assistant/simpletextviewer/assistant.cpp b/examples/assistant/simpletextviewer/assistant.cpp
index 58103c14a3..d222bda6e6 100644
--- a/examples/assistant/simpletextviewer/assistant.cpp
+++ b/examples/assistant/simpletextviewer/assistant.cpp
@@ -50,25 +50,23 @@
#include "assistant.h"
+#include
#include
#include
#include
#include
-#include
+#include
-Assistant::Assistant()
- : proc(0)
-{
-}
+Assistant::Assistant() = default;
//! [0]
Assistant::~Assistant()
{
- if (proc && proc->state() == QProcess::Running) {
- proc->terminate();
- proc->waitForFinished(3000);
+ if (!m_process.isNull() && m_process->state() == QProcess::Running) {
+ QObject::disconnect(m_process.data(), &QProcess::finished, nullptr, nullptr);
+ m_process->terminate();
+ m_process->waitForFinished(3000);
}
- delete proc;
}
//! [0]
@@ -81,39 +79,79 @@ void Assistant::showDocumentation(const QString &page)
QByteArray ba("SetSource ");
ba.append("qthelp://org.qt-project.examples.simpletextviewer/doc/");
- proc->write(ba + page.toLocal8Bit() + '\n');
+ m_process->write(ba + page.toLocal8Bit() + '\n');
}
//! [1]
+QString documentationDirectory()
+{
+ QStringList paths;
+#ifdef SRCDIR
+ paths.append(QLatin1String(SRCDIR));
+#endif
+ paths.append(QLibraryInfo::location(QLibraryInfo::ExamplesPath));
+ paths.append(QCoreApplication::applicationDirPath());
+ paths.append(QStandardPaths::standardLocations(QStandardPaths::AppDataLocation));
+ for (const auto &dir : qAsConst(paths)) {
+ const QString path = dir + QLatin1String("/documentation");
+ if (QFileInfo::exists(path))
+ return path;
+ }
+ return QString();
+}
+
//! [2]
bool Assistant::startAssistant()
{
- if (!proc)
- proc = new QProcess();
+ if (m_process.isNull()) {
+ m_process.reset(new QProcess());
+ QObject::connect(m_process.data(), &QProcess::finished,
+ m_process.data(), [this](int exitCode, QProcess::ExitStatus status) {
+ this->finished(exitCode, status);
+ });
+ }
- if (proc->state() != QProcess::Running) {
+ if (m_process->state() != QProcess::Running) {
QString app = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QDir::separator();
-#if !defined(Q_OS_MAC)
+#ifndef Q_OS_DARWIN
app += QLatin1String("assistant");
#else
app += QLatin1String("Assistant.app/Contents/MacOS/Assistant");
#endif
- QStringList args;
- args << QLatin1String("-collectionFile")
- << QLibraryInfo::location(QLibraryInfo::ExamplesPath)
- + QLatin1String("/assistant/simpletextviewer/documentation/simpletextviewer.qhc")
- << QLatin1String("-enableRemoteControl");
+ const QString collectionDirectory = documentationDirectory();
+ if (collectionDirectory.isEmpty()) {
+ showError(tr("The documentation directory cannot be found"));
+ return false;
+ }
+
+ QStringList args{QLatin1String("-collectionFile"),
+ collectionDirectory + QLatin1String("/simpletextviewer.qhc"),
+ QLatin1String("-enableRemoteControl")};
- proc->start(app, args);
+ m_process->start(app, args);
- if (!proc->waitForStarted()) {
- QMessageBox::critical(nullptr,
- tr("Simple Text Viewer"),
- tr("Unable to launch Qt Assistant (%1)").arg(app));
+ if (!m_process->waitForStarted()) {
+ showError(tr("Unable to launch Qt Assistant (%1): %2").arg(app, m_process->errorString()));
return false;
}
}
return true;
}
//! [2]
+
+void Assistant::showError(const QString &message)
+{
+ QMessageBox::critical(QApplication::activeWindow(),
+ tr("Simple Text Viewer"), message);
+}
+
+void Assistant::finished(int exitCode, QProcess::ExitStatus status)
+{
+ const QString stdErr = QString::fromLocal8Bit(m_process->readAllStandardError());
+ if (status != QProcess::NormalExit) {
+ showError(tr("Assistant crashed: ").arg(stdErr));
+ } else if (exitCode != 0) {
+ showError(tr("Assistant exited with %1: %2").arg(exitCode).arg(stdErr));
+ }
+}
diff --git a/examples/assistant/simpletextviewer/assistant.h b/examples/assistant/simpletextviewer/assistant.h
index 1ea7dd78f2..c513c34284 100644
--- a/examples/assistant/simpletextviewer/assistant.h
+++ b/examples/assistant/simpletextviewer/assistant.h
@@ -52,11 +52,10 @@
#define ASSISTANT_H
#include
+#include
+#include
#include
-QT_BEGIN_NAMESPACE
-class QProcess;
-QT_END_NAMESPACE
class Assistant
{
@@ -69,7 +68,10 @@ class Assistant
private:
bool startAssistant();
- QProcess *proc;
+ void showError(const QString &message);
+ void finished(int exitCode, QProcess::ExitStatus status);
+
+ QScopedPointer m_process;
};
#endif
diff --git a/examples/assistant/simpletextviewer/findfiledialog.cpp b/examples/assistant/simpletextviewer/findfiledialog.cpp
index cf64e9a6a5..e17f7ec0f7 100644
--- a/examples/assistant/simpletextviewer/findfiledialog.cpp
+++ b/examples/assistant/simpletextviewer/findfiledialog.cpp
@@ -59,6 +59,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -105,13 +106,11 @@ void FindFileDialog::help()
}
//! [2]
-void FindFileDialog::openFile(QTreeWidgetItem *item)
+void FindFileDialog::openFile()
{
- if (!item) {
- item = foundFilesTree->currentItem();
- if (!item)
- return;
- }
+ auto item = foundFilesTree->currentItem();
+ if (!item)
+ return;
QString fileName = item->text(0);
QString path = directoryComboBox->currentText() + QDir::separator();
@@ -129,8 +128,10 @@ void FindFileDialog::update()
void FindFileDialog::findFiles()
{
- QRegExp filePattern(fileNameComboBox->currentText() + "*");
- filePattern.setPatternSyntax(QRegExp::Wildcard);
+ QString wildCard = fileNameComboBox->currentText();
+ if (!wildCard.endsWith('*'))
+ wildCard += '*';
+ QRegularExpression filePattern(QRegularExpression::wildcardToRegularExpression(wildCard));
QDir directory(directoryComboBox->currentText());
@@ -138,7 +139,7 @@ void FindFileDialog::findFiles()
QStringList matchingFiles;
for (const QString &file : allFiles) {
- if (filePattern.exactMatch(file))
+ if (filePattern.match(file).hasMatch())
matchingFiles << file;
}
showFiles(matchingFiles);
@@ -161,14 +162,14 @@ void FindFileDialog::createButtons()
{
browseButton = new QToolButton;
browseButton->setText(tr("..."));
- connect(browseButton, SIGNAL(clicked()), this, SLOT(browse()));
+ connect(browseButton, &QAbstractButton::clicked, this, &FindFileDialog::browse);
buttonBox = new QDialogButtonBox(QDialogButtonBox::Open
| QDialogButtonBox::Cancel
| QDialogButtonBox::Help);
- connect(buttonBox, SIGNAL(accepted()), this, SLOT(openFile()));
- connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
- connect(buttonBox, SIGNAL(helpRequested()), this, SLOT(help()));
+ connect(buttonBox, &QDialogButtonBox::accepted, this, &FindFileDialog::openFile);
+ connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
+ connect(buttonBox, &QDialogButtonBox::helpRequested, this, &FindFileDialog::help);
}
void FindFileDialog::createComboBoxes()
@@ -182,14 +183,14 @@ void FindFileDialog::createComboBoxes()
directoryComboBox->setMinimumContentsLength(30);
directoryComboBox->setSizeAdjustPolicy(
- QComboBox::AdjustToMinimumContentsLength);
+ QComboBox::AdjustToContents);
directoryComboBox->setSizePolicy(QSizePolicy::Expanding,
QSizePolicy::Preferred);
- connect(fileNameComboBox, SIGNAL(editTextChanged(QString)),
- this, SLOT(update()));
- connect(directoryComboBox, SIGNAL(currentIndexChanged(QString)),
- this, SLOT(update()));
+ connect(fileNameComboBox, &QComboBox::editTextChanged,
+ this, &FindFileDialog::update);
+ connect(directoryComboBox, &QComboBox::currentTextChanged,
+ this, &FindFileDialog::update);
}
void FindFileDialog::createFilesTree()
@@ -200,8 +201,8 @@ void FindFileDialog::createFilesTree()
foundFilesTree->setRootIsDecorated(false);
foundFilesTree->setSelectionMode(QAbstractItemView::SingleSelection);
- connect(foundFilesTree, SIGNAL(itemActivated(QTreeWidgetItem*,int)),
- this, SLOT(openFile(QTreeWidgetItem*)));
+ connect(foundFilesTree, &QTreeWidget::itemActivated,
+ this, &FindFileDialog::openFile);
}
void FindFileDialog::createLabels()
diff --git a/examples/assistant/simpletextviewer/findfiledialog.h b/examples/assistant/simpletextviewer/findfiledialog.h
index 6ca57b061d..605da09543 100644
--- a/examples/assistant/simpletextviewer/findfiledialog.h
+++ b/examples/assistant/simpletextviewer/findfiledialog.h
@@ -76,7 +76,7 @@ class FindFileDialog : public QDialog
private slots:
void browse();
void help();
- void openFile(QTreeWidgetItem *item = nullptr);
+ void openFile();
void update();
private:
diff --git a/examples/assistant/simpletextviewer/mainwindow.cpp b/examples/assistant/simpletextviewer/mainwindow.cpp
index 5b0564ca12..f70162c218 100644
--- a/examples/assistant/simpletextviewer/mainwindow.cpp
+++ b/examples/assistant/simpletextviewer/mainwindow.cpp
@@ -112,26 +112,26 @@ void MainWindow::createActions()
{
assistantAct = new QAction(tr("Help Contents"), this);
assistantAct->setShortcut(QKeySequence::HelpContents);
- connect(assistantAct, SIGNAL(triggered()), this, SLOT(showDocumentation()));
+ connect(assistantAct, &QAction::triggered, this, &MainWindow::showDocumentation);
//! [4]
openAct = new QAction(tr("&Open..."), this);
openAct->setShortcut(QKeySequence::Open);
- connect(openAct, SIGNAL(triggered()), this, SLOT(open()));
+ connect(openAct, &QAction::triggered, this, &MainWindow::open);
clearAct = new QAction(tr("&Clear"), this);
clearAct->setShortcut(tr("Ctrl+C"));
- connect(clearAct, SIGNAL(triggered()), textViewer, SLOT(clear()));
+ connect(clearAct, &QAction::triggered, textViewer, &QTextEdit::clear);
exitAct = new QAction(tr("E&xit"), this);
exitAct->setShortcuts(QKeySequence::Quit);
- connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
+ connect(exitAct, &QAction::triggered, this, &QWidget::close);
aboutAct = new QAction(tr("&About"), this);
- connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
+ connect(aboutAct, &QAction::triggered, this, &MainWindow::about);
aboutQtAct = new QAction(tr("About &Qt"), this);
- connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
+ connect(aboutQtAct, &QAction::triggered, QApplication::aboutQt);
//! [5]
}
//! [5]
diff --git a/examples/assistant/simpletextviewer/mainwindow.h b/examples/assistant/simpletextviewer/mainwindow.h
index e8e917ea38..1c7f21761e 100644
--- a/examples/assistant/simpletextviewer/mainwindow.h
+++ b/examples/assistant/simpletextviewer/mainwindow.h
@@ -67,7 +67,6 @@ class MainWindow : public QMainWindow
public:
MainWindow();
- void showDocumentation(const QString &file);
private slots:
void about();
diff --git a/examples/assistant/simpletextviewer/simpletextviewer.pro b/examples/assistant/simpletextviewer/simpletextviewer.pro
index 314e75b36a..b0de7f4e7f 100644
--- a/examples/assistant/simpletextviewer/simpletextviewer.pro
+++ b/examples/assistant/simpletextviewer/simpletextviewer.pro
@@ -8,6 +8,8 @@ SOURCES = main.cpp \
assistant.cpp \
textedit.cpp
+DEFINES += SRCDIR=\\\"$$PWD/\\\"
+
QT += widgets
target.path = $$[QT_INSTALL_EXAMPLES]/assistant/simpletextviewer
diff --git a/examples/designer/CMakeLists.txt b/examples/designer/CMakeLists.txt
new file mode 100644
index 0000000000..f5de4c52fb
--- /dev/null
+++ b/examples/designer/CMakeLists.txt
@@ -0,0 +1,19 @@
+# Generated from designer.pro.
+
+
+qt_exclude_tool_directories_from_default_target(
+ containerextension
+ taskmenuextension
+)
+
+add_subdirectory(calculatorform)
+if(QT_BUILD_SHARED_LIBS AND NOT solaris-cc_x_)
+ add_subdirectory(calculatorbuilder)
+ add_subdirectory(worldtimeclockbuilder)
+endif()
+if(QT_BUILD_SHARED_LIBS)
+ add_subdirectory(containerextension)
+ add_subdirectory(customwidgetplugin)
+ add_subdirectory(taskmenuextension)
+ add_subdirectory(worldtimeclockplugin)
+endif()
diff --git a/examples/designer/calculatorbuilder/CMakeLists.txt b/examples/designer/calculatorbuilder/CMakeLists.txt
new file mode 100644
index 0000000000..2cb01e9470
--- /dev/null
+++ b/examples/designer/calculatorbuilder/CMakeLists.txt
@@ -0,0 +1,55 @@
+# Generated from calculatorbuilder.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(calculatorbuilder LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/designer/calculatorbuilder")
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 COMPONENTS UiTools)
+
+qt_add_executable(calculatorbuilder
+ calculatorform.cpp calculatorform.h
+ main.cpp
+)
+set_target_properties(calculatorbuilder PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+target_link_libraries(calculatorbuilder PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::UiTools
+ Qt::Widgets
+)
+
+
+# Resources:
+set(calculatorbuilder_resource_files
+ "calculatorform.ui"
+)
+
+qt6_add_resources(calculatorbuilder "calculatorbuilder"
+ PREFIX
+ "/forms"
+ FILES
+ ${calculatorbuilder_resource_files}
+)
+
+install(TARGETS calculatorbuilder
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/designer/calculatorform/CMakeLists.txt b/examples/designer/calculatorform/CMakeLists.txt
new file mode 100644
index 0000000000..ad721d0ccb
--- /dev/null
+++ b/examples/designer/calculatorform/CMakeLists.txt
@@ -0,0 +1,40 @@
+# Generated from calculatorform.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(calculatorform LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/designer/calculatorform")
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Widgets)
+
+qt_add_executable(calculatorform
+ calculatorform.cpp calculatorform.h calculatorform.ui
+ main.cpp
+)
+set_target_properties(calculatorform PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+target_link_libraries(calculatorform PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Widgets
+)
+
+install(TARGETS calculatorform
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/designer/containerextension/.prev_CMakeLists.txt b/examples/designer/containerextension/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..3225c4093e
--- /dev/null
+++ b/examples/designer/containerextension/.prev_CMakeLists.txt
@@ -0,0 +1,44 @@
+# Generated from containerextension.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(containerextension LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}")
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 COMPONENTS Designer)
+
+qt_add_executable(containerextension
+ multipagewidget.cpp multipagewidget.h
+ multipagewidgetcontainerextension.cpp multipagewidgetcontainerextension.h
+ multipagewidgetextensionfactory.cpp multipagewidgetextensionfactory.h
+ multipagewidgetplugin.cpp multipagewidgetplugin.h
+)
+set_target_properties(containerextension PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+target_link_libraries(containerextension PUBLIC
+ Qt::Core
+ Qt::Designer
+ Qt::Gui
+ Qt::Widgets
+)
+
+install(TARGETS containerextension
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/designer/containerextension/CMakeLists.txt b/examples/designer/containerextension/CMakeLists.txt
new file mode 100644
index 0000000000..1a6a0f61b7
--- /dev/null
+++ b/examples/designer/containerextension/CMakeLists.txt
@@ -0,0 +1,47 @@
+# Generated from containerextension.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(containerextension LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/plugins/designer") # special case
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 COMPONENTS Designer)
+
+# special case begin
+qt_add_plugin(containerextension)
+target_sources(containerextension PRIVATE
+ multipagewidget.cpp multipagewidget.h
+ multipagewidgetcontainerextension.cpp multipagewidgetcontainerextension.h
+ multipagewidgetextensionfactory.cpp multipagewidgetextensionfactory.h
+ multipagewidgetplugin.cpp multipagewidgetplugin.h
+)
+# special case end
+set_target_properties(containerextension PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+target_link_libraries(containerextension PUBLIC
+ Qt::Core
+ Qt::Designer
+ Qt::Gui
+ Qt::Widgets
+)
+
+install(TARGETS containerextension
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/designer/containerextension/multipagewidgetcontainerextension.cpp b/examples/designer/containerextension/multipagewidgetcontainerextension.cpp
index ca9e79d786..2c8eff6bd7 100644
--- a/examples/designer/containerextension/multipagewidgetcontainerextension.cpp
+++ b/examples/designer/containerextension/multipagewidgetcontainerextension.cpp
@@ -61,6 +61,11 @@ MultiPageWidgetContainerExtension::MultiPageWidgetContainerExtension(MultiPageWi
//! [0]
//! [1]
+bool MultiPageWidgetContainerExtension::canAddWidget() const
+{
+ return true;
+}
+
void MultiPageWidgetContainerExtension::addWidget(QWidget *widget)
{
myWidget->addPage(widget);
@@ -89,6 +94,12 @@ void MultiPageWidgetContainerExtension::insertWidget(int index, QWidget *widget)
//! [4]
//! [5]
+bool MultiPageWidgetContainerExtension::canRemove(int index) const
+{
+ Q_UNUSED(index);
+ return true;
+}
+
void MultiPageWidgetContainerExtension::remove(int index)
{
myWidget->removePage(index);
diff --git a/examples/designer/containerextension/multipagewidgetcontainerextension.h b/examples/designer/containerextension/multipagewidgetcontainerextension.h
index 7813aee9eb..47814c6925 100644
--- a/examples/designer/containerextension/multipagewidgetcontainerextension.h
+++ b/examples/designer/containerextension/multipagewidgetcontainerextension.h
@@ -68,10 +68,12 @@ class MultiPageWidgetContainerExtension: public QObject,
public:
explicit MultiPageWidgetContainerExtension(MultiPageWidget *widget, QObject *parent);
+ bool canAddWidget() const override;
void addWidget(QWidget *widget) override;
int count() const override;
int currentIndex() const override;
void insertWidget(int index, QWidget *widget) override;
+ bool canRemove(int index) const override;
void remove(int index) override;
void setCurrentIndex(int index) override;
QWidget *widget(int index) const override;
diff --git a/examples/designer/containerextension/multipagewidgetplugin.cpp b/examples/designer/containerextension/multipagewidgetplugin.cpp
index d29043ecf1..a5a3272b59 100644
--- a/examples/designer/containerextension/multipagewidgetplugin.cpp
+++ b/examples/designer/containerextension/multipagewidgetplugin.cpp
@@ -144,19 +144,19 @@ void MultiPageWidgetPlugin::initialize(QDesignerFormEditorInterface *formEditor)
//! [7]
QString MultiPageWidgetPlugin::domXml() const
{
- return QLatin1String("\
-\
- \
- \
- \
- \
- \
- MultiPageWidget\
- QWidget\
- addPage\
- \
- \
-");
+ return QLatin1String(R"(
+
+
+
+
+
+
+ MultiPageWidget
+ QWidget
+ addPage
+
+
+)");
}
//! [7]
diff --git a/examples/designer/customwidgetplugin/.prev_CMakeLists.txt b/examples/designer/customwidgetplugin/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..1e25517f83
--- /dev/null
+++ b/examples/designer/customwidgetplugin/.prev_CMakeLists.txt
@@ -0,0 +1,42 @@
+# Generated from customwidgetplugin.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(customwidgetplugin LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}")
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 COMPONENTS UiPlugin)
+
+qt_add_executable(customwidgetplugin
+ analogclock.cpp analogclock.h
+ customwidgetplugin.cpp customwidgetplugin.h
+)
+set_target_properties(customwidgetplugin PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+target_link_libraries(customwidgetplugin PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::UiPlugin
+ Qt::Widgets
+)
+
+install(TARGETS customwidgetplugin
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/designer/customwidgetplugin/CMakeLists.txt b/examples/designer/customwidgetplugin/CMakeLists.txt
new file mode 100644
index 0000000000..764fe7373b
--- /dev/null
+++ b/examples/designer/customwidgetplugin/CMakeLists.txt
@@ -0,0 +1,45 @@
+# Generated from customwidgetplugin.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(customwidgetplugin LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/plugins/designer") # special case
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 COMPONENTS UiPlugin)
+
+# special case begin
+qt_add_plugin(customwidgetplugin)
+target_sources(customwidgetplugin PRIVATE
+ analogclock.cpp analogclock.h
+ customwidgetplugin.cpp customwidgetplugin.h
+)
+# special case end
+set_target_properties(customwidgetplugin PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+target_link_libraries(customwidgetplugin PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::UiPlugin
+ Qt::Widgets
+)
+
+install(TARGETS customwidgetplugin
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/designer/customwidgetplugin/customwidgetplugin.cpp b/examples/designer/customwidgetplugin/customwidgetplugin.cpp
index a3d75d311d..a728a689c8 100644
--- a/examples/designer/customwidgetplugin/customwidgetplugin.cpp
+++ b/examples/designer/customwidgetplugin/customwidgetplugin.cpp
@@ -129,26 +129,32 @@ bool AnalogClockPlugin::isContainer() const
//! [10]
QString AnalogClockPlugin::domXml() const
{
- return "\n"
- " \n"
+ return QLatin1String(R"(
+
+
+)"
//! [11]
- " \n"
- " \n"
- " 0\n"
- " 0\n"
- " 100\n"
- " 100\n"
- " \n"
- " \n"
+R"(
+
+
+ 0
+ 0
+ 100
+ 100
+
+
+")
//! [11]
- " \n"
- " The current time\n"
- " \n"
- " \n"
- " The analog clock widget displays the current time.\n"
- " \n"
- " \n"
- "\n";
+R"(
+
+ The current time
+
+
+ The analog clock widget displays the current time.
+
+
+
+)");
}
//! [10]
diff --git a/examples/designer/designer.pro b/examples/designer/designer.pro
index 2248d3ec19..3ffd443e17 100644
--- a/examples/designer/designer.pro
+++ b/examples/designer/designer.pro
@@ -1,12 +1,14 @@
TEMPLATE = subdirs
SUBDIRS = calculatorform
-!static:SUBDIRS += calculatorbuilder \
+!contains(CONFIG, static) {
+ SUBDIRS += calculatorbuilder \
containerextension \
customwidgetplugin \
taskmenuextension \
worldtimeclockbuilder \
worldtimeclockplugin
+}
# the sun cc compiler has a problem with the include lines for the form.prf
solaris-cc*:SUBDIRS -= calculatorbuilder \
diff --git a/examples/designer/doc/src/containerextension.qdoc b/examples/designer/doc/src/containerextension.qdoc
index ce5d161fff..6b3f9c989c 100644
--- a/examples/designer/doc/src/containerextension.qdoc
+++ b/examples/designer/doc/src/containerextension.qdoc
@@ -171,18 +171,17 @@
another page or changes one of the page titles. To be able to give
each page their own title, we have chosen to use the
QWidget::windowTitle property to store the page title (for more
- information see the MultiPageWidget class \l
- {containerextension/multipagewidget.cpp}{implementation}). Note
- that currently there is no way of adding a custom property (e.g.,
- a page title) to the pages without using a predefined property as
- placeholder.
+ information see the MultiPageWidget class implementation in
+ \e containerextension/multipagewidget.cpp. Note that currently there
+ is no way of adding a custom property (for example, a page title) to
+ the pages without using a predefined property as placeholder.
The \c MultiPageWidgetPlugin class inherits from both QObject and
QDesignerCustomWidgetInterface. It is important to remember, when
using multiple inheritance, to ensure that all the interfaces
(i.e. the classes that doesn't inherit Q_OBJECT) are made known to
the meta object system using the Q_INTERFACES() macro. This
- enables \QD to use \l {qobject_cast(QObject * object)} to query for supported
+ enables \QD to use qobject_cast() to query for supported
interfaces using nothing but a QObject pointer.
\section1 MultiPageWidgetPlugin Class Implementation
@@ -279,8 +278,8 @@
QDesignerPropertySheetExtension::indexOf() function. As previously
mentioned, we have chosen to use the QWidget::windowTitle property
to store the page title (for more information see the
- MultiPageWidget class \l
- {containerextension/multipagewidget.cpp}{implementation}).
+ MultiPageWidget class implementation in
+ \e containerextension/multipagewidget.cpp.
Finally, we implicitly force an update of the page's property
sheet by calling the
QDesignerPropertySheetExtension::setChanged() function.
@@ -429,6 +428,7 @@
\snippet containerextension/multipagewidgetcontainerextension.cpp 3
You must reimplement \l
+ {QDesignerContainerExtension::canAddWidget()}{canAddWidget()} and \l
{QDesignerContainerExtension::addWidget()}{addWidget()} adding a
given page to the container, \l
{QDesignerContainerExtension::count()}{count()} returning the
@@ -447,6 +447,7 @@
You must reimplement \l
{QDesignerContainerExtension::insertWidget()}{insertWidget()}
adding a given page to the container at a given index, \l
+ {QDesignerContainerExtension::canRemove()}{canRemove()} and \l
{QDesignerContainerExtension::remove()}{remove()} deleting the
page at a given index, \l
{QDesignerContainerExtension::setCurrentIndex()}{setCurrentIndex()}
@@ -489,7 +490,6 @@
updated whenever the user views another page or changes one of the
page titles.
- See the MultiPageWidget class \l
- {containerextension/multipagewidget.cpp}{implementation}
- for more details.
+ See the MultiPageWidget class implementation in
+ \e containerextension/multipagewidget.cpp for more details.
*/
diff --git a/examples/designer/doc/src/taskmenuextension.qdoc b/examples/designer/doc/src/taskmenuextension.qdoc
index a480fa3a83..6b5df136ab 100644
--- a/examples/designer/doc/src/taskmenuextension.qdoc
+++ b/examples/designer/doc/src/taskmenuextension.qdoc
@@ -171,7 +171,7 @@
using multiple inheritance, to ensure that all the interfaces
(i.e. the classes that doesn't inherit Q_OBJECT) are made known to
the meta object system using the Q_INTERFACES() macro. This
- enables \QD to use \l {qobject_cast(QObject * object)} to query for supported
+ enables \QD to use qobject_cast() to query for supported
interfaces using nothing but a QObject pointer.
\section1 TicTacToePlugin Class Implementation
diff --git a/examples/designer/doc/src/worldtimeclockplugin.qdoc b/examples/designer/doc/src/worldtimeclockplugin.qdoc
index 99a4528679..19ec83f6b9 100644
--- a/examples/designer/doc/src/worldtimeclockplugin.qdoc
+++ b/examples/designer/doc/src/worldtimeclockplugin.qdoc
@@ -121,7 +121,7 @@
using multiple inheritance, to ensure that all the interfaces
(i.e. the classes that doesn't inherit Q_OBJECT) are made known to
the meta object system using the Q_INTERFACES() macro. This
- enables \QD to use \l {qobject_cast(QObject * object)} to query for supported
+ enables \QD to use qobject_cast() to query for supported
interfaces using nothing but a QObject pointer.
The implementation of the \c WorldTimeClockPlugin is also
diff --git a/examples/designer/taskmenuextension/.prev_CMakeLists.txt b/examples/designer/taskmenuextension/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..8551d0a466
--- /dev/null
+++ b/examples/designer/taskmenuextension/.prev_CMakeLists.txt
@@ -0,0 +1,44 @@
+# Generated from taskmenuextension.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(taskmenuextension LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}")
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 COMPONENTS Designer)
+
+qt_add_executable(taskmenuextension
+ tictactoe.cpp tictactoe.h
+ tictactoedialog.cpp tictactoedialog.h
+ tictactoeplugin.cpp tictactoeplugin.h
+ tictactoetaskmenu.cpp tictactoetaskmenu.h
+)
+set_target_properties(taskmenuextension PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+target_link_libraries(taskmenuextension PUBLIC
+ Qt::Core
+ Qt::Designer
+ Qt::Gui
+ Qt::Widgets
+)
+
+install(TARGETS taskmenuextension
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/designer/taskmenuextension/CMakeLists.txt b/examples/designer/taskmenuextension/CMakeLists.txt
new file mode 100644
index 0000000000..a91b58eac9
--- /dev/null
+++ b/examples/designer/taskmenuextension/CMakeLists.txt
@@ -0,0 +1,47 @@
+# Generated from taskmenuextension.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(taskmenuextension LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/plugins/designer") # special case
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 COMPONENTS Designer)
+
+# special case begin
+qt_add_plugin(taskmenuextension)
+target_sources(taskmenuextension PRIVATE
+ tictactoe.cpp tictactoe.h
+ tictactoedialog.cpp tictactoedialog.h
+ tictactoeplugin.cpp tictactoeplugin.h
+ tictactoetaskmenu.cpp tictactoetaskmenu.h
+)
+# special case end
+set_target_properties(taskmenuextension PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+target_link_libraries(taskmenuextension PUBLIC
+ Qt::Core
+ Qt::Designer
+ Qt::Gui
+ Qt::Widgets
+)
+
+install(TARGETS taskmenuextension
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/designer/taskmenuextension/tictactoe.h b/examples/designer/taskmenuextension/tictactoe.h
index 1904f9c977..23784d7502 100644
--- a/examples/designer/taskmenuextension/tictactoe.h
+++ b/examples/designer/taskmenuextension/tictactoe.h
@@ -78,7 +78,9 @@ class TicTacToe : public QWidget
void paintEvent(QPaintEvent *event) override;
private:
- enum : char { Empty = '-', Cross = 'X', Nought = 'O' };
+ static constexpr char16_t Empty = '-';
+ static constexpr char16_t Cross = 'X';
+ static constexpr char16_t Nought = 'O';
QRect cellRect(int row, int col) const;
int cellWidth() const { return width() / 3; }
diff --git a/examples/designer/taskmenuextension/tictactoeplugin.cpp b/examples/designer/taskmenuextension/tictactoeplugin.cpp
index 724720ad53..45075fe62a 100644
--- a/examples/designer/taskmenuextension/tictactoeplugin.cpp
+++ b/examples/designer/taskmenuextension/tictactoeplugin.cpp
@@ -129,19 +129,20 @@ void TicTacToePlugin::initialize(QDesignerFormEditorInterface *formEditor)
QString TicTacToePlugin::domXml() const
{
- return QLatin1String("\
-\
- \
- \
- \
- TicTacToe\
- \
- Tic Tac Toe state\
- \
- \
- \
- \
-");
+ return QLatin1String(R"(
+
+
+
+
+ TicTacToe
+
+ Tic Tac Toe state
+
+
+
+
+
+)");
}
//! [3]
diff --git a/examples/designer/worldtimeclockbuilder/CMakeLists.txt b/examples/designer/worldtimeclockbuilder/CMakeLists.txt
new file mode 100644
index 0000000000..2c93155c75
--- /dev/null
+++ b/examples/designer/worldtimeclockbuilder/CMakeLists.txt
@@ -0,0 +1,54 @@
+# Generated from worldtimeclockbuilder.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(worldtimeclockbuilder LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/designer/worldtimeclockbuilder")
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 COMPONENTS UiTools)
+
+qt_add_executable(worldtimeclockbuilder
+ main.cpp
+)
+set_target_properties(worldtimeclockbuilder PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+target_link_libraries(worldtimeclockbuilder PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::UiTools
+ Qt::Widgets
+)
+
+
+# Resources:
+set(worldtimeclockbuilder_resource_files
+ "form.ui"
+)
+
+qt6_add_resources(worldtimeclockbuilder "worldtimeclockbuilder"
+ PREFIX
+ "/forms"
+ FILES
+ ${worldtimeclockbuilder_resource_files}
+)
+
+install(TARGETS worldtimeclockbuilder
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/designer/worldtimeclockplugin/.prev_CMakeLists.txt b/examples/designer/worldtimeclockplugin/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..1886b1ce64
--- /dev/null
+++ b/examples/designer/worldtimeclockplugin/.prev_CMakeLists.txt
@@ -0,0 +1,42 @@
+# Generated from worldtimeclockplugin.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(worldtimeclockplugin LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}")
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 COMPONENTS UiPlugin)
+
+qt_add_executable(worldtimeclockplugin
+ worldtimeclock.cpp worldtimeclock.h
+ worldtimeclockplugin.cpp worldtimeclockplugin.h
+)
+set_target_properties(worldtimeclockplugin PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+target_link_libraries(worldtimeclockplugin PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::UiPlugin
+ Qt::Widgets
+)
+
+install(TARGETS worldtimeclockplugin
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/designer/worldtimeclockplugin/CMakeLists.txt b/examples/designer/worldtimeclockplugin/CMakeLists.txt
new file mode 100644
index 0000000000..6e675fc9b4
--- /dev/null
+++ b/examples/designer/worldtimeclockplugin/CMakeLists.txt
@@ -0,0 +1,45 @@
+# Generated from worldtimeclockplugin.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(worldtimeclockplugin LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/plugins/designer") # special case
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 COMPONENTS UiPlugin)
+
+# special case begin
+qt_add_plugin(worldtimeclockplugin)
+target_sources(worldtimeclockplugin PRIVATE
+ worldtimeclock.cpp worldtimeclock.h
+ worldtimeclockplugin.cpp worldtimeclockplugin.h
+)
+# special case end
+set_target_properties(worldtimeclockplugin PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+target_link_libraries(worldtimeclockplugin PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::UiPlugin
+ Qt::Widgets
+)
+
+install(TARGETS worldtimeclockplugin
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/designer/worldtimeclockplugin/worldtimeclockplugin.cpp b/examples/designer/worldtimeclockplugin/worldtimeclockplugin.cpp
index 8cd059c561..83223d59fc 100644
--- a/examples/designer/worldtimeclockplugin/worldtimeclockplugin.cpp
+++ b/examples/designer/worldtimeclockplugin/worldtimeclockplugin.cpp
@@ -108,18 +108,20 @@ bool WorldTimeClockPlugin::isContainer() const
QString WorldTimeClockPlugin::domXml() const
{
- return "\n"
- " \n"
- " \n"
- " \n"
- " 0\n"
- " 0\n"
- " 100\n"
- " 100\n"
- " \n"
- " \n"
- " \n"
- "";
+ return QLatin1String(R"(
+
+
+
+
+ 0
+ 0
+ 100
+ 100
+
+
+
+
+)");
}
QString WorldTimeClockPlugin::includeFile() const
diff --git a/examples/help/CMakeLists.txt b/examples/help/CMakeLists.txt
new file mode 100644
index 0000000000..b61829db77
--- /dev/null
+++ b/examples/help/CMakeLists.txt
@@ -0,0 +1,3 @@
+# Generated from help.pro.
+
+add_subdirectory(contextsensitivehelp)
diff --git a/examples/help/contextsensitivehelp/CMakeLists.txt b/examples/help/contextsensitivehelp/CMakeLists.txt
new file mode 100644
index 0000000000..40d89a3e44
--- /dev/null
+++ b/examples/help/contextsensitivehelp/CMakeLists.txt
@@ -0,0 +1,43 @@
+# Generated from contextsensitivehelp.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(contextsensitivehelp LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/help/contextsensitivehelp")
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Help)
+find_package(Qt6 COMPONENTS Widgets)
+
+qt_add_executable(contextsensitivehelp
+ helpbrowser.cpp helpbrowser.h
+ main.cpp
+ wateringconfigdialog.cpp wateringconfigdialog.h wateringconfigdialog.ui
+)
+set_target_properties(contextsensitivehelp PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+target_link_libraries(contextsensitivehelp PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Help
+ Qt::Widgets
+)
+
+install(TARGETS contextsensitivehelp
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/help/contextsensitivehelp/docs/wateringmachine.qch b/examples/help/contextsensitivehelp/docs/wateringmachine.qch
index 35d29be226..1433acfc98 100644
Binary files a/examples/help/contextsensitivehelp/docs/wateringmachine.qch and b/examples/help/contextsensitivehelp/docs/wateringmachine.qch differ
diff --git a/examples/help/contextsensitivehelp/docs/wateringmachine.qhc b/examples/help/contextsensitivehelp/docs/wateringmachine.qhc
index b5653c3ff7..98cfa14817 100644
Binary files a/examples/help/contextsensitivehelp/docs/wateringmachine.qhc and b/examples/help/contextsensitivehelp/docs/wateringmachine.qhc differ
diff --git a/examples/help/contextsensitivehelp/helpbrowser.cpp b/examples/help/contextsensitivehelp/helpbrowser.cpp
index 67314374d9..f0cc4a1d72 100644
--- a/examples/help/contextsensitivehelp/helpbrowser.cpp
+++ b/examples/help/contextsensitivehelp/helpbrowser.cpp
@@ -53,6 +53,7 @@
#include
#include "helpbrowser.h"
+#include "qhelplink.h"
HelpBrowser::HelpBrowser(QWidget *parent)
: QTextBrowser(parent)
@@ -70,9 +71,9 @@ HelpBrowser::HelpBrowser(QWidget *parent)
void HelpBrowser::showHelpForKeyword(const QString &id)
{
if (m_helpEngine) {
- QMap links = m_helpEngine->linksForIdentifier(id);
- if (links.count())
- setSource(links.constBegin().value());
+ QList documents = m_helpEngine->documentsForIdentifier(id);
+ if (documents.count())
+ setSource(documents.first().url);
}
}
diff --git a/examples/linguist/CMakeLists.txt b/examples/linguist/CMakeLists.txt
new file mode 100644
index 0000000000..612ae91cc4
--- /dev/null
+++ b/examples/linguist/CMakeLists.txt
@@ -0,0 +1,5 @@
+# Generated from linguist.pro.
+
+add_subdirectory(arrowpad)
+add_subdirectory(hellotr)
+add_subdirectory(trollprint)
diff --git a/examples/linguist/arrowpad/CMakeLists.txt b/examples/linguist/arrowpad/CMakeLists.txt
new file mode 100644
index 0000000000..cf652c8f2b
--- /dev/null
+++ b/examples/linguist/arrowpad/CMakeLists.txt
@@ -0,0 +1,41 @@
+# Generated from arrowpad.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(arrowpad LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/linguist/arrowpad")
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Widgets)
+
+qt_add_executable(arrowpad
+ arrowpad.cpp arrowpad.h
+ main.cpp
+ mainwindow.cpp mainwindow.h
+)
+set_target_properties(arrowpad PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+target_link_libraries(arrowpad PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Widgets
+)
+
+install(TARGETS arrowpad
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/linguist/hellotr/CMakeLists.txt b/examples/linguist/hellotr/CMakeLists.txt
new file mode 100644
index 0000000000..c9c65ac6ce
--- /dev/null
+++ b/examples/linguist/hellotr/CMakeLists.txt
@@ -0,0 +1,39 @@
+# Generated from hellotr.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(hellotr LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/linguist/hellotr")
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Widgets)
+
+qt_add_executable(hellotr
+ main.cpp
+)
+set_target_properties(hellotr PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+target_link_libraries(hellotr PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Widgets
+)
+
+install(TARGETS hellotr
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/linguist/hellotr/main.cpp b/examples/linguist/hellotr/main.cpp
index bf7effc46d..24206f093e 100644
--- a/examples/linguist/hellotr/main.cpp
+++ b/examples/linguist/hellotr/main.cpp
@@ -64,7 +64,8 @@ int main(int argc, char *argv[])
//! [5]
QTranslator translator;
//! [5] //! [6]
- translator.load("hellotr_la");
+ if (!translator.load("hellotr_la"))
+ return 1;
//! [6] //! [7]
app.installTranslator(&translator);
//! [4] //! [7]
diff --git a/examples/linguist/trollprint/CMakeLists.txt b/examples/linguist/trollprint/CMakeLists.txt
new file mode 100644
index 0000000000..e1c953cdfb
--- /dev/null
+++ b/examples/linguist/trollprint/CMakeLists.txt
@@ -0,0 +1,41 @@
+# Generated from trollprint.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(trollprint LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/linguist/trollprint")
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Widgets)
+
+qt_add_executable(trollprint
+ main.cpp
+ mainwindow.cpp mainwindow.h
+ printpanel.cpp printpanel.h
+)
+set_target_properties(trollprint PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+target_link_libraries(trollprint PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Widgets
+)
+
+install(TARGETS trollprint
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/uitools/CMakeLists.txt b/examples/uitools/CMakeLists.txt
new file mode 100644
index 0000000000..a31646da0f
--- /dev/null
+++ b/examples/uitools/CMakeLists.txt
@@ -0,0 +1,4 @@
+# Generated from uitools.pro.
+
+add_subdirectory(multipleinheritance)
+add_subdirectory(textfinder)
diff --git a/examples/uitools/multipleinheritance/CMakeLists.txt b/examples/uitools/multipleinheritance/CMakeLists.txt
new file mode 100644
index 0000000000..7a942d53a0
--- /dev/null
+++ b/examples/uitools/multipleinheritance/CMakeLists.txt
@@ -0,0 +1,40 @@
+# Generated from multipleinheritance.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(multipleinheritance LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/uitools/multipleinheritance")
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Widgets)
+
+qt_add_executable(multipleinheritance
+ calculatorform.cpp calculatorform.h calculatorform.ui
+ main.cpp
+)
+set_target_properties(multipleinheritance PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+target_link_libraries(multipleinheritance PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Widgets
+)
+
+install(TARGETS multipleinheritance
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/uitools/textfinder/CMakeLists.txt b/examples/uitools/textfinder/CMakeLists.txt
new file mode 100644
index 0000000000..84fbd72c4e
--- /dev/null
+++ b/examples/uitools/textfinder/CMakeLists.txt
@@ -0,0 +1,56 @@
+# Generated from textfinder.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(textfinder LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/uitools/textfinder")
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 COMPONENTS UiTools)
+
+qt_add_executable(textfinder
+ main.cpp
+ textfinder.cpp textfinder.h
+)
+set_target_properties(textfinder PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+target_link_libraries(textfinder PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::UiTools
+ Qt::Widgets
+)
+
+
+# Resources:
+set(textfinder_resource_files
+ "forms/input.txt"
+ "forms/textfinder.ui"
+)
+
+qt6_add_resources(textfinder "textfinder"
+ PREFIX
+ "/"
+ FILES
+ ${textfinder_resource_files}
+)
+
+install(TARGETS textfinder
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/uitools/textfinder/textfinder.cpp b/examples/uitools/textfinder/textfinder.cpp
index a18505c8c1..d6c11906b8 100644
--- a/examples/uitools/textfinder/textfinder.cpp
+++ b/examples/uitools/textfinder/textfinder.cpp
@@ -75,7 +75,6 @@ static QString loadTextFile()
QFile inputFile(":/forms/input.txt");
inputFile.open(QIODevice::ReadOnly);
QTextStream in(&inputFile);
- in.setCodec("UTF-8");
return in.readAll();
}
//! [5]
diff --git a/qt_cmdline.cmake b/qt_cmdline.cmake
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/qttools.pro b/qttools.pro
deleted file mode 100644
index 58c33f27ca..0000000000
--- a/qttools.pro
+++ /dev/null
@@ -1 +0,0 @@
-load(qt_parts)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000000..416c98a911
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,69 @@
+# Generated from src.pro.
+
+# special case begin
+# Need to stop building these apps by default because they would fail
+# in device_and_simulator builds.
+if(IOS)
+ set(_qt_additional_tools_to_exclude qtplugininfo qtpaths)
+endif()
+# special case end
+
+qt_exclude_tool_directories_from_default_target(
+ distancefieldgenerator
+ pixeltool
+ ${_qt_additional_tools_to_exclude} # special case
+)
+
+# Check whether the sqlite plugin is available.
+set(sqlite_plugin_available FALSE)
+if(TARGET ${QT_CMAKE_EXPORT_NAMESPACE}::Sql)
+ get_target_property(sql_plugins ${QT_CMAKE_EXPORT_NAMESPACE}::Sql QT_PLUGINS)
+ if(QSQLiteDriverPlugin IN_LIST sql_plugins)
+ set(sqlite_plugin_available TRUE)
+ endif()
+endif()
+
+# special case begin
+# Evaluate features to decide what to build.
+# The config files will be written in the src/global module.
+qt_feature_evaluate_features("${CMAKE_CURRENT_SOURCE_DIR}/../configure.cmake")
+# special case end
+
+add_subdirectory(global) # special case add as first directory
+add_subdirectory(linguist)
+# add_subdirectory(global) # special case remove
+if(QT_FEATURE_png AND QT_FEATURE_pushbutton AND QT_FEATURE_toolbutton AND TARGET Qt::Widgets)
+ add_subdirectory(designer)
+ add_subdirectory(pixeltool)
+endif()
+if(QT_FEATURE_png AND QT_FEATURE_pushbutton AND QT_FEATURE_toolbutton AND TARGET Qt::Widgets
+ AND (sqlite_plugin_available OR QT_BUILD_SHARED_LIBS))
+ add_subdirectory(assistant)
+endif()
+if(QT_FEATURE_png AND QT_FEATURE_thread AND QT_FEATURE_toolbutton AND TARGET Qt::Quick AND TARGET Qt::Widgets)
+ add_subdirectory(distancefieldgenerator)
+endif()
+if(QT_FEATURE_commandlineparser)
+ add_subdirectory(qtattributionsscanner)
+endif()
+if(QT_FEATURE_commandlineparser AND QT_FEATURE_library AND (android_app OR NOT ANDROID))
+ add_subdirectory(qtplugininfo)
+endif()
+if(QT_FEATURE_clang AND QT_FEATURE_commandlineparser AND QT_FEATURE_thread)
+ add_subdirectory(qdoc)
+endif()
+if(android_app OR (QT_FEATURE_commandlineparser AND NOT ANDROID))
+ add_subdirectory(qtpaths)
+endif()
+if(MACOS)
+ add_subdirectory(macdeployqt)
+endif()
+if(TARGET Qt::DBus)
+ add_subdirectory(qdbus)
+endif()
+if(QT_FEATURE_windeployqt) # special case
+ add_subdirectory(windeployqt)
+endif()
+if(QT_FEATURE_commandlineparser AND TARGET Qt::Gui AND NOT ANDROID AND NOT QNX AND NOT UIKIT AND NOT WASM)
+ add_subdirectory(qtdiag)
+endif()
diff --git a/src/assistant/.gitignore b/src/assistant/.gitignore
deleted file mode 100644
index 146319596b..0000000000
--- a/src/assistant/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-clucene/qtcluceneversion.h
-help/qthelpversion.h
diff --git a/src/assistant/CMakeLists.txt b/src/assistant/CMakeLists.txt
new file mode 100644
index 0000000000..27f9024f8f
--- /dev/null
+++ b/src/assistant/CMakeLists.txt
@@ -0,0 +1,22 @@
+# Generated from assistant.pro.
+
+# special case begin
+if(NOT TARGET Qt::Sql OR NOT TARGET Qt::PrintSupport)
+ return()
+endif()
+# special case end
+
+qt_exclude_tool_directories_from_default_target(
+ assistant
+ qhelpgenerator
+)
+
+if(NOT TARGET Qt::Sql)
+ return()
+endif()
+if(NOT QT_FEATURE_assistant)
+ return()
+endif()
+add_subdirectory(help)
+add_subdirectory(assistant)
+add_subdirectory(qhelpgenerator)
diff --git a/src/assistant/assistant.pro b/src/assistant/assistant.pro
deleted file mode 100644
index 1529167c05..0000000000
--- a/src/assistant/assistant.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-requires(qtHaveModule(sql))
-TEMPLATE = subdirs
-
-SUBDIRS += \
- help \
- assistant \
- qhelpgenerator \
- qcollectiongenerator
-
-assistant.depends = help
-qhelpgenerator.depends = help
-
-qtNomakeTools( \
- assistant \
- qhelpgenerator \
- qcollectiongenerator \
-)
diff --git a/src/assistant/assistant/CMakeLists.txt b/src/assistant/assistant/CMakeLists.txt
new file mode 100644
index 0000000000..cada391a54
--- /dev/null
+++ b/src/assistant/assistant/CMakeLists.txt
@@ -0,0 +1,215 @@
+# Generated from assistant.pro.
+
+#####################################################################
+## assistant App:
+#####################################################################
+
+qt_internal_add_app(assistant
+ SOURCES
+ ../../shared/fontpanel/fontpanel.cpp ../../shared/fontpanel/fontpanel.h
+ ../shared/collectionconfiguration.cpp ../shared/collectionconfiguration.h
+ aboutdialog.cpp aboutdialog.h
+ bookmarkdialog.cpp bookmarkdialog.h bookmarkdialog.ui
+ bookmarkfiltermodel.cpp bookmarkfiltermodel.h
+ bookmarkitem.cpp bookmarkitem.h
+ bookmarkmanager.cpp bookmarkmanager.h
+ bookmarkmanagerwidget.cpp bookmarkmanagerwidget.h bookmarkmanagerwidget.ui
+ bookmarkmodel.cpp bookmarkmodel.h
+ bookmarkwidget.ui
+ centralwidget.cpp centralwidget.h
+ cmdlineparser.cpp cmdlineparser.h
+ contentwindow.cpp contentwindow.h
+ findwidget.cpp findwidget.h
+ globalactions.cpp globalactions.h
+ helpbrowsersupport.cpp helpbrowsersupport.h
+ helpdocsettings.cpp helpdocsettings.h
+ helpdocsettingswidget.cpp helpdocsettingswidget.h helpdocsettingswidget.ui
+ helpenginewrapper.cpp helpenginewrapper.h
+ helpviewer.cpp helpviewer.h helpviewer_p.h
+ indexwindow.cpp indexwindow.h
+ main.cpp
+ mainwindow.cpp mainwindow.h
+ openpagesmanager.cpp openpagesmanager.h
+ openpagesmodel.cpp openpagesmodel.h
+ openpagesswitcher.cpp openpagesswitcher.h
+ openpageswidget.cpp openpageswidget.h
+ preferencesdialog.cpp preferencesdialog.h preferencesdialog.ui
+ qtdocinstaller.cpp qtdocinstaller.h
+ remotecontrol.cpp remotecontrol.h
+ searchwidget.cpp searchwidget.h
+ topicchooser.cpp topicchooser.h topicchooser.ui
+ tracer.h
+ xbelsupport.cpp xbelsupport.h
+ INCLUDE_DIRECTORIES
+ ../../shared/fontpanel
+ PUBLIC_LIBRARIES
+ Qt::Gui
+ Qt::Help
+ Qt::Network
+ Qt::Sql
+ Qt::Widgets
+ Qt::PrintSupport # special case
+ ENABLE_AUTOGEN_TOOLS
+ uic
+)
+
+# Resources:
+set(assistant_resource_files
+ "assistant.qch"
+)
+
+qt_internal_add_resource(assistant "assistant"
+ PREFIX
+ "/qt-project.org/assistant"
+ FILES
+ ${assistant_resource_files}
+)
+set(assistant_images_resource_files
+ "images/assistant-128.png"
+ "images/assistant.png"
+ "images/bookmark.png"
+ "images/closebutton.png"
+ "images/darkclosebutton.png"
+ "images/mac/addtab.png"
+ "images/mac/book.png"
+ "images/mac/closetab.png"
+ "images/mac/editcopy.png"
+ "images/mac/find.png"
+ "images/mac/home.png"
+ "images/mac/next.png"
+ "images/mac/previous.png"
+ "images/mac/print.png"
+ "images/mac/resetzoom.png"
+ "images/mac/synctoc.png"
+ "images/mac/zoomin.png"
+ "images/mac/zoomout.png"
+ "images/win/addtab.png"
+ "images/win/book.png"
+ "images/win/closetab.png"
+ "images/win/editcopy.png"
+ "images/win/find.png"
+ "images/win/home.png"
+ "images/win/next.png"
+ "images/win/previous.png"
+ "images/win/print.png"
+ "images/win/resetzoom.png"
+ "images/win/synctoc.png"
+ "images/win/zoomin.png"
+ "images/win/zoomout.png"
+ "images/wrap.png"
+)
+
+qt_internal_add_resource(assistant "assistant_images"
+ PREFIX
+ "/qt-project.org/assistant"
+ FILES
+ ${assistant_images_resource_files}
+)
+
+set_target_properties(assistant PROPERTIES
+ QT_TARGET_DESCRIPTION "Qt Assistant"
+)
+
+#### Keys ignored in scope 1:.:.:assistant.pro::
+# PROJECTNAME = "Assistant"
+
+## Scopes:
+#####################################################################
+
+#### Keys ignored in scope 2:.:.:assistant.pro:TARGET Qt::WebKitWidgets AND NOT QT_CONFIG___contains___static:
+# BROWSER = "qtwebkit"
+
+#### Keys ignored in scope 3:.:.:assistant.pro:TARGET Qt::WebEngineWidgets AND NOT QT_CONFIG___contains___static:
+# BROWSER = "qtwebengine"
+find_package(Qt6 ${PROJECT_VERSION} QUIET CONFIG OPTIONAL_COMPONENTS WebEngineWidgets)
+
+IF( ${QT_CMAKE_EXPORT_NAMESPACE}WebEngineWidgets_FOUND )
+ set(BROWSER "qtwebengine")
+ENDIF()
+
+## Keys ignored in scope 4:.:.:assistant.pro:else:
+# BROWSER = "qtextbrowser"
+
+qt_internal_extend_target(assistant CONDITION TARGET Qt::PrintSupport
+ PUBLIC_LIBRARIES
+ Qt::PrintSupport
+)
+
+qt_internal_extend_target(assistant CONDITION BROWSER STREQUAL qtwebkit
+ SOURCES
+ helpviewer_qwv.cpp
+ DEFINES
+ BROWSER_QTWEBKIT
+ PUBLIC_LIBRARIES
+ Qt::WebKitWidgets
+)
+
+qt_internal_extend_target(assistant CONDITION BROWSER STREQUAL qtwebengine AND NOT BROWSER STREQUAL qtwebkit
+ SOURCES
+ helpviewer_qwev.cpp
+ DEFINES
+ BROWSER_QTWEBENGINE
+ PUBLIC_LIBRARIES
+ Qt::WebEngineWidgets
+)
+
+qt_internal_extend_target(assistant CONDITION NOT BROWSER STREQUAL qtwebkit AND NOT BROWSER STREQUAL qtwebengine
+ SOURCES
+ helpviewer_qtb.cpp
+ DEFINES
+ BROWSER_QTEXTBROWSER
+)
+
+if(WIN32)
+ set_target_properties(assistant PROPERTIES
+ QT_TARGET_RC_ICONS "${CMAKE_CURRENT_SOURCE_DIR}/assistant.ico"
+ )
+endif()
+
+if(WIN32)
+ set_target_properties(assistant PROPERTIES
+ QT_TARGET_VERSION "${PROJECT_VERSION}.0"
+ )
+endif()
+
+qt_internal_extend_target(assistant CONDITION WIN32
+ SOURCES
+ stdinlistener_win.cpp stdinlistener_win.h
+ PUBLIC_LIBRARIES
+ shell32
+)
+
+if(UNIX)
+ set_target_properties(assistant PROPERTIES
+ QT_TARGET_VERSION "${PROJECT_VERSION}"
+ )
+endif()
+
+qt_internal_extend_target(assistant CONDITION UNIX
+ SOURCES
+ stdinlistener.cpp stdinlistener.h
+)
+
+if(APPLE)
+ set_target_properties(assistant PROPERTIES
+ MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info_mac.plist"
+ MACOSX_BUNDLE TRUE
+ MACOSX_BUNDLE_ICON_FILE "assistant.icns"
+ OUTPUT_NAME "Assistant"
+ )
+ set_source_files_properties(assistant.icns PROPERTIES
+ MACOSX_PACKAGE_LOCATION Resources
+ )
+ target_sources(assistant PRIVATE
+ assistant.icns
+ )
+ # special case end
+ # Set values to be replaced in the custom Info_mac.plist.
+ set(ICON "assistant.icns")
+ set(EXECUTABLE "Assistant")
+ # special case end
+endif()
+qt_internal_add_docs(assistant
+ doc/qtassistant.qdocconf
+)
+
diff --git a/src/assistant/assistant/aboutdialog.cpp b/src/assistant/assistant/aboutdialog.cpp
index 3682f1291a..774b6fd4bb 100644
--- a/src/assistant/assistant/aboutdialog.cpp
+++ b/src/assistant/assistant/aboutdialog.cpp
@@ -37,7 +37,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -82,9 +81,17 @@ QVariant AboutLabel::loadResource(int type, const QUrl &name)
return QVariant();
}
+
+#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
void AboutLabel::setSource(const QUrl &url)
+#else
+void AboutLabel::doSetSource(const QUrl &url, QTextDocument::ResourceType type)
+#endif
{
TRACE_OBJ
+#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
+ Q_UNUSED(type);
+#endif
if (url.isValid() && (!HelpViewer::isLocalUrl(url)
|| !HelpViewer::canOpenPage(url.path()))) {
if (!QDesktopServices::openUrl(url)) {
diff --git a/src/assistant/assistant/aboutdialog.h b/src/assistant/assistant/aboutdialog.h
index b791a4891a..720292d7b3 100644
--- a/src/assistant/assistant/aboutdialog.h
+++ b/src/assistant/assistant/aboutdialog.h
@@ -49,7 +49,12 @@ class AboutLabel : public QTextBrowser
private:
QVariant loadResource(int type, const QUrl &name) override;
+
+#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
void setSource(const QUrl &url) override;
+#else
+ void doSetSource(const QUrl &name, QTextDocument::ResourceType type) override;
+#endif
QMap m_resourceMap;
};
diff --git a/src/assistant/assistant/assistant.pro b/src/assistant/assistant/assistant.pro
deleted file mode 100644
index b63be28c72..0000000000
--- a/src/assistant/assistant/assistant.pro
+++ /dev/null
@@ -1,123 +0,0 @@
-qtHaveModule(webkitwidgets):!contains(QT_CONFIG, static) {
- BROWSER = qtwebkit
-} else {
- BROWSER = qtextbrowser
-}
-
-QT += widgets network help sql
-qtHaveModule(printsupport): QT += printsupport
-PROJECTNAME = Assistant
-
-include(../../shared/fontpanel/fontpanel.pri)
-
-QMAKE_DOCS = $$PWD/doc/qtassistant.qdocconf
-
-HEADERS += aboutdialog.h \
- bookmarkdialog.h \
- bookmarkfiltermodel.h \
- bookmarkitem.h \
- bookmarkmanager.h \
- bookmarkmanagerwidget.h \
- bookmarkmodel.h \
- centralwidget.h \
- cmdlineparser.h \
- contentwindow.h \
- findwidget.h \
- filternamedialog.h \
- helpenginewrapper.h \
- helpbrowsersupport.h \
- helpviewer.h \
- helpviewer_p.h \
- indexwindow.h \
- mainwindow.h \
- optionswidget.h \
- preferencesdialog.h \
- qtdocinstaller.h \
- remotecontrol.h \
- searchwidget.h \
- topicchooser.h \
- tracer.h \
- xbelsupport.h \
- ../shared/collectionconfiguration.h \
- openpagesmodel.h \
- globalactions.h \
- openpageswidget.h \
- openpagesmanager.h \
- openpagesswitcher.h
-
-SOURCES += aboutdialog.cpp \
- bookmarkdialog.cpp \
- bookmarkfiltermodel.cpp \
- bookmarkitem.cpp \
- bookmarkmanager.cpp \
- bookmarkmanagerwidget.cpp \
- bookmarkmodel.cpp \
- centralwidget.cpp \
- cmdlineparser.cpp \
- contentwindow.cpp \
- findwidget.cpp \
- filternamedialog.cpp \
- helpenginewrapper.cpp \
- helpbrowsersupport.cpp \
- helpviewer.cpp \
- indexwindow.cpp \
- main.cpp \
- mainwindow.cpp \
- optionswidget.cpp \
- preferencesdialog.cpp \
- qtdocinstaller.cpp \
- remotecontrol.cpp \
- searchwidget.cpp \
- topicchooser.cpp \
- xbelsupport.cpp \
- ../shared/collectionconfiguration.cpp \
- openpagesmodel.cpp \
- globalactions.cpp \
- openpageswidget.cpp \
- openpagesmanager.cpp \
- openpagesswitcher.cpp
-
-equals(BROWSER, "qtwebkit") {
- DEFINES += BROWSER_QTWEBKIT
- QT += webkitwidgets
- SOURCES += helpviewer_qwv.cpp
-} else {
- DEFINES += BROWSER_QTEXTBROWSER
- SOURCES += helpviewer_qtb.cpp
-}
-
-win32 {
- HEADERS += stdinlistener_win.h
- SOURCES += stdinlistener_win.cpp
-} else {
- HEADERS += stdinlistener.h
- SOURCES += stdinlistener.cpp
-}
-
-FORMS += bookmarkdialog.ui \
- bookmarkmanagerwidget.ui \
- bookmarkwidget.ui \
- filternamedialog.ui \
- preferencesdialog.ui \
- topicchooser.ui
-
-RESOURCES += assistant.qrc \
- assistant_images.qrc
-
-QMAKE_TARGET_DESCRIPTION = Qt Assistant
-
-win32 {
- LIBS += -lshell32
- RC_ICONS = assistant.ico
- VERSION = $${QT_VERSION}.0
-} else {
- VERSION = $${QT_VERSION}
-}
-
-mac {
- ICON = assistant.icns
- TARGET = Assistant
- QMAKE_INFO_PLIST = Info_mac.plist
-}
-
-load(qt_app)
diff --git a/src/assistant/assistant/assistant.qch b/src/assistant/assistant/assistant.qch
index fded08e620..9da49aa5fe 100644
Binary files a/src/assistant/assistant/assistant.qch and b/src/assistant/assistant/assistant.qch differ
diff --git a/src/assistant/assistant/assistant_images.qrc b/src/assistant/assistant/assistant_images.qrc
index e55b6b27e7..948de970f7 100644
--- a/src/assistant/assistant/assistant_images.qrc
+++ b/src/assistant/assistant/assistant_images.qrc
@@ -10,9 +10,7 @@
images/mac/editcopy.png
images/mac/find.png
images/mac/home.png
- images/mac/minus.png
images/mac/next.png
- images/mac/plus.png
images/mac/previous.png
images/mac/print.png
images/mac/synctoc.png
@@ -25,9 +23,7 @@
images/win/editcopy.png
images/win/find.png
images/win/home.png
- images/win/minus.png
images/win/next.png
- images/win/plus.png
images/win/previous.png
images/win/print.png
images/win/synctoc.png
diff --git a/src/assistant/assistant/bookmarkdialog.cpp b/src/assistant/assistant/bookmarkdialog.cpp
index 8207da04e1..cb775d30af 100644
--- a/src/assistant/assistant/bookmarkdialog.cpp
+++ b/src/assistant/assistant/bookmarkdialog.cpp
@@ -60,7 +60,7 @@ BookmarkDialog::BookmarkDialog(BookmarkModel *sourceModel, const QString &title,
bookmarkProxyModel = new BookmarkFilterModel(this);
bookmarkProxyModel->setSourceModel(bookmarkModel);
ui.bookmarkFolders->setModel(bookmarkProxyModel);
- connect(ui.bookmarkFolders, QOverload::of(&QComboBox::currentIndexChanged),
+ connect(ui.bookmarkFolders, &QComboBox::currentIndexChanged,
this, QOverload::of(&BookmarkDialog::currentIndexChanged));
bookmarkTreeModel = new BookmarkTreeModel(this);
diff --git a/src/assistant/assistant/bookmarkitem.h b/src/assistant/assistant/bookmarkitem.h
index 31ecff80bf..c7e37dc55a 100644
--- a/src/assistant/assistant/bookmarkitem.h
+++ b/src/assistant/assistant/bookmarkitem.h
@@ -30,7 +30,7 @@
#define BOOKMARKITEM_H
#include
-#include
+#include
QT_BEGIN_NAMESPACE
@@ -40,7 +40,7 @@ enum {
UserRoleExpanded = Qt::UserRole + 150
};
-typedef QVector DataVector;
+typedef QList DataVector;
class BookmarkItem
{
diff --git a/src/assistant/assistant/bookmarkmanager.cpp b/src/assistant/assistant/bookmarkmanager.cpp
index 331cea8647..5daab74e8a 100644
--- a/src/assistant/assistant/bookmarkmanager.cpp
+++ b/src/assistant/assistant/bookmarkmanager.cpp
@@ -270,14 +270,14 @@ bool BookmarkManager::eventFilter(QObject *object, QEvent *event)
if (event->type() == QEvent::MouseButtonRelease && !isWidget) {
QMouseEvent *me = static_cast(event);
switch (me->button()) {
- case Qt::LeftButton: {
+ case Qt::LeftButton:
if (me->modifiers() & Qt::ControlModifier)
setSourceFromIndex(bookmarkTreeView->currentIndex(), true);
- } break;
+ break;
- case Qt::MidButton: {
+ case Qt::MiddleButton:
setSourceFromIndex(bookmarkTreeView->currentIndex(), true);
- } break;
+ break;
default: break;
}
@@ -543,7 +543,7 @@ void BookmarkManager::textChanged(const QString &text)
bookmarkTreeView->setRootIsDecorated(false);
bookmarkTreeView->setModel(typeAndSearchModel);
}
- typeAndSearchModel->setFilterRegExp(QRegExp(text));
+ typeAndSearchModel->setFilterRegularExpression(text);
} else {
typeAndSearch = false;
bookmarkTreeView->setModel(bookmarkModel);
diff --git a/src/assistant/assistant/bookmarkmanagerwidget.cpp b/src/assistant/assistant/bookmarkmanagerwidget.cpp
index ba4f5cfd43..090d7c754f 100644
--- a/src/assistant/assistant/bookmarkmanagerwidget.cpp
+++ b/src/assistant/assistant/bookmarkmanagerwidget.cpp
@@ -31,15 +31,16 @@
#include "tracer.h"
#include "xbelsupport.h"
-#include
-#include
-#include
+#include
+#include
#include
-#include
#include
-#include
-#include
+#include
+
+#include
+#include
+#include
QT_BEGIN_NAMESPACE
@@ -143,13 +144,13 @@ bool BookmarkManagerWidget::eventFilter(QObject *object, QEvent *event)
if (event->type() == QEvent::KeyPress) {
QKeyEvent *ke = static_cast(event);
switch (ke->key()) {
- case Qt::Key_F2: {
+ case Qt::Key_F2:
renameItem(ui.treeView->currentIndex());
- } break;
+ break;
- case Qt::Key_Delete: {
+ case Qt::Key_Delete:
removeItem(ui.treeView->currentIndex());
- } break;
+ break;
default: break;
}
@@ -158,14 +159,14 @@ bool BookmarkManagerWidget::eventFilter(QObject *object, QEvent *event)
if (event->type() == QEvent::MouseButtonRelease) {
QMouseEvent *me = static_cast(event);
switch (me->button()) {
- case Qt::LeftButton: {
+ case Qt::LeftButton:
if (me->modifiers() & Qt::ControlModifier)
setSourceFromIndex(ui.treeView->currentIndex(), true);
- } break;
+ break;
- case Qt::MidButton: {
+ case Qt::MiddleButton:
setSourceFromIndex(ui.treeView->currentIndex(), true);
- } break;
+ break;
default: break;
}
diff --git a/src/assistant/assistant/bookmarkmodel.cpp b/src/assistant/assistant/bookmarkmodel.cpp
index e80842d457..3f8b5e8936 100644
--- a/src/assistant/assistant/bookmarkmodel.cpp
+++ b/src/assistant/assistant/bookmarkmodel.cpp
@@ -28,6 +28,7 @@
#include "bookmarkmodel.h"
#include "bookmarkitem.h"
+#include
#include
#include
@@ -127,7 +128,7 @@ BookmarkModel::setItemsEditable(bool editable)
void
BookmarkModel::expandFoldersIfNeeeded(QTreeView *treeView)
{
- for (const QModelIndex &index : qAsConst(cache))
+ for (QModelIndex index : qAsConst(cache))
treeView->setExpanded(index, index.data(UserRoleExpanded).toBool());
}
diff --git a/src/assistant/assistant/bookmarkmodel.h b/src/assistant/assistant/bookmarkmodel.h
index 998e7d7ca8..73e6595af0 100644
--- a/src/assistant/assistant/bookmarkmodel.h
+++ b/src/assistant/assistant/bookmarkmodel.h
@@ -66,7 +66,7 @@ class BookmarkModel : public QAbstractItemModel
Qt::ItemFlags flags(const QModelIndex &index) const override;
QVariant data(const QModelIndex &index, int role) const override;
- void setData(const QModelIndex &index, const QVector &data);
+ void setData(const QModelIndex &index, const QList &data);
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
diff --git a/src/assistant/assistant/centralwidget.cpp b/src/assistant/assistant/centralwidget.cpp
index 34304f737c..4f3d749f4b 100644
--- a/src/assistant/assistant/centralwidget.cpp
+++ b/src/assistant/assistant/centralwidget.cpp
@@ -34,7 +34,7 @@
#include "openpagesmanager.h"
#include "tracer.h"
-#include
+#include
#include
#include
@@ -330,7 +330,7 @@ void CentralWidget::connectTabBar()
// -- public slots
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void CentralWidget::copy()
{
TRACE_OBJ
@@ -396,9 +396,9 @@ void CentralWidget::print()
QPrintDialog dlg(m_printer, this);
if (!currentHelpViewer()->selectedText().isEmpty())
- dlg.addEnabledOption(QAbstractPrintDialog::PrintSelection);
- dlg.addEnabledOption(QAbstractPrintDialog::PrintPageRange);
- dlg.addEnabledOption(QAbstractPrintDialog::PrintCollateCopies);
+ dlg.setOption(QAbstractPrintDialog::PrintSelection);
+ dlg.setOption(QAbstractPrintDialog::PrintPageRange);
+ dlg.setOption(QAbstractPrintDialog::PrintCollateCopies);
dlg.setWindowTitle(tr("Print Document"));
if (dlg.exec() == QDialog::Accepted)
currentHelpViewer()->print(m_printer);
@@ -545,10 +545,10 @@ void CentralWidget::highlightSearchTerms()
const bool wholePhrase = searchInput.startsWith(QLatin1Char('"')) &&
searchInput.endsWith(QLatin1Char('"'));
const QStringList &words = wholePhrase ? QStringList(searchInput.mid(1, searchInput.length() - 2)) :
- searchInput.split(QRegExp("\\W+"), QString::SkipEmptyParts);
+ searchInput.split(QRegularExpression("\\W+"), Qt::SkipEmptyParts);
HelpViewer *viewer = currentHelpViewer();
for (const QString &word : words)
- viewer->findText(word, nullptr, false, true);
+ viewer->findText(word, {}, false, true);
disconnect(viewer, &HelpViewer::loadFinished,
this, &CentralWidget::highlightSearchTerms);
}
@@ -568,12 +568,12 @@ void CentralWidget::handleSourceChanged(const QUrl &url)
emit sourceChanged(url);
}
-void CentralWidget::slotHighlighted(const QString &link)
+void CentralWidget::slotHighlighted(const QUrl &link)
{
TRACE_OBJ
- QString resolvedLink = m_resolvedLinks.value(link);
+ QUrl resolvedLink = m_resolvedLinks.value(link);
if (!link.isEmpty() && resolvedLink.isEmpty()) {
- resolvedLink = HelpEngineWrapper::instance().findFile(link).toString();
+ resolvedLink = HelpEngineWrapper::instance().findFile(link);
m_resolvedLinks.insert(link, resolvedLink);
}
emit highlighted(resolvedLink);
@@ -597,15 +597,17 @@ void CentralWidget::connectSignals(HelpViewer *page)
connect(page, &HelpViewer::printRequested,
this, &CentralWidget::print);
#endif
+#if QT_CONFIG(clipboard)
connect(page, &HelpViewer::copyAvailable,
this, &CentralWidget::copyAvailable);
+#endif
connect(page, &HelpViewer::forwardAvailable,
this, &CentralWidget::forwardAvailable);
connect(page, &HelpViewer::backwardAvailable,
this, &CentralWidget::backwardAvailable);
connect(page, &HelpViewer::sourceChanged,
this, &CentralWidget::handleSourceChanged);
- connect(page, QOverload::of(&HelpViewer::highlighted),
+ connect(page, QOverload::of(&HelpViewer::highlighted),
this, &CentralWidget::slotHighlighted);
}
diff --git a/src/assistant/assistant/centralwidget.h b/src/assistant/assistant/centralwidget.h
index 34de716a40..6962c9931a 100644
--- a/src/assistant/assistant/centralwidget.h
+++ b/src/assistant/assistant/centralwidget.h
@@ -30,6 +30,7 @@
#define CENTRALWIDGET_H
#include
+#include
#include
#include
@@ -94,7 +95,7 @@ class CentralWidget : public QWidget
void connectTabBar();
public slots:
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void copy();
#endif
void home();
@@ -127,9 +128,11 @@ public slots:
signals:
void currentViewerChanged();
+#if QT_CONFIG(clipboard)
void copyAvailable(bool yes);
+#endif
void sourceChanged(const QUrl &url);
- void highlighted(const QString &link);
+ void highlighted(const QUrl &link);
void forwardAvailable(bool available);
void backwardAvailable(bool available);
void addBookmark(const QString &title, const QString &url);
@@ -142,7 +145,7 @@ private slots:
void highlightSearchTerms();
void printPreviewToPrinter(QPrinter *printer);
void handleSourceChanged(const QUrl &url);
- void slotHighlighted(const QString &link);
+ void slotHighlighted(const QUrl& link);
private:
void initPrinter();
@@ -160,7 +163,7 @@ private slots:
FindWidget *m_findWidget;
QStackedWidget *m_stackedWidget;
TabBar *m_tabBar;
- QHash m_resolvedLinks;
+ QHash m_resolvedLinks;
};
QT_END_NAMESPACE
diff --git a/src/assistant/assistant/contentwindow.cpp b/src/assistant/assistant/contentwindow.cpp
index c932c06b73..fdfc7b5ff3 100644
--- a/src/assistant/assistant/contentwindow.cpp
+++ b/src/assistant/assistant/contentwindow.cpp
@@ -77,6 +77,7 @@ bool ContentWindow::syncToContent(const QUrl& url)
if (!idx.isValid())
return false;
m_contentWidget->setCurrentIndex(idx);
+ m_contentWidget->scrollTo(idx);
return true;
}
@@ -131,7 +132,7 @@ bool ContentWindow::eventFilter(QObject *o, QEvent *e)
QItemSelectionModel *sm = m_contentWidget->selectionModel();
if (sm->isSelected(index)) {
if ((button == Qt::LeftButton && (me->modifiers() & Qt::ControlModifier))
- || (button == Qt::MidButton)) {
+ || (button == Qt::MiddleButton)) {
QHelpContentModel *contentModel =
qobject_cast(m_contentWidget->model());
if (contentModel) {
diff --git a/src/assistant/assistant/doc/images/assistant-assistant.png b/src/assistant/assistant/doc/images/assistant-assistant.png
index d76ec04209..368b5c9325 100644
Binary files a/src/assistant/assistant/doc/images/assistant-assistant.png and b/src/assistant/assistant/doc/images/assistant-assistant.png differ
diff --git a/src/assistant/assistant/doc/images/assistant-bookmarks.png b/src/assistant/assistant/doc/images/assistant-bookmarks.png
index 810d239606..9acdb83006 100644
Binary files a/src/assistant/assistant/doc/images/assistant-bookmarks.png and b/src/assistant/assistant/doc/images/assistant-bookmarks.png differ
diff --git a/src/assistant/assistant/doc/images/assistant-dockwidgets.png b/src/assistant/assistant/doc/images/assistant-dockwidgets.png
index 7a9c386a6f..c657426e99 100644
Binary files a/src/assistant/assistant/doc/images/assistant-dockwidgets.png and b/src/assistant/assistant/doc/images/assistant-dockwidgets.png differ
diff --git a/src/assistant/assistant/doc/images/assistant-index.png b/src/assistant/assistant/doc/images/assistant-index.png
index 548c349e5b..685396c977 100644
Binary files a/src/assistant/assistant/doc/images/assistant-index.png and b/src/assistant/assistant/doc/images/assistant-index.png differ
diff --git a/src/assistant/assistant/doc/images/assistant-preferences-documentation.png b/src/assistant/assistant/doc/images/assistant-preferences-documentation.png
index e640176ac7..92e8e0568b 100644
Binary files a/src/assistant/assistant/doc/images/assistant-preferences-documentation.png and b/src/assistant/assistant/doc/images/assistant-preferences-documentation.png differ
diff --git a/src/assistant/assistant/doc/images/assistant-preferences-filters.png b/src/assistant/assistant/doc/images/assistant-preferences-filters.png
index 3af2830850..cdeda5c3d1 100644
Binary files a/src/assistant/assistant/doc/images/assistant-preferences-filters.png and b/src/assistant/assistant/doc/images/assistant-preferences-filters.png differ
diff --git a/src/assistant/assistant/doc/images/assistant-preferences-fonts.png b/src/assistant/assistant/doc/images/assistant-preferences-fonts.png
index 4d93759177..a3879ec89b 100644
Binary files a/src/assistant/assistant/doc/images/assistant-preferences-fonts.png and b/src/assistant/assistant/doc/images/assistant-preferences-fonts.png differ
diff --git a/src/assistant/assistant/doc/images/assistant-preferences-options.png b/src/assistant/assistant/doc/images/assistant-preferences-options.png
index 3a9efad6ab..38233b7cfa 100644
Binary files a/src/assistant/assistant/doc/images/assistant-preferences-options.png and b/src/assistant/assistant/doc/images/assistant-preferences-options.png differ
diff --git a/src/assistant/assistant/doc/images/assistant-search.png b/src/assistant/assistant/doc/images/assistant-search.png
index 3ab3caf9dd..847af8ba27 100644
Binary files a/src/assistant/assistant/doc/images/assistant-search.png and b/src/assistant/assistant/doc/images/assistant-search.png differ
diff --git a/src/assistant/assistant/doc/qtassistant.qdocconf b/src/assistant/assistant/doc/qtassistant.qdocconf
index d6c714a6d2..7788191766 100644
--- a/src/assistant/assistant/doc/qtassistant.qdocconf
+++ b/src/assistant/assistant/doc/qtassistant.qdocconf
@@ -1,4 +1,5 @@
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
+include($QT_INSTALL_DOCS/config/exampleurl-qttools.qdocconf)
project = QtAssistant
description = Qt Assistant Manual
@@ -39,3 +40,5 @@ depends += qtdoc qmake
manifestmeta.thumbnail.names += "QtAssistant/Remote Control Example"
navigation.landingpage = "Qt Assistant Manual"
+
+warninglimit = 0
diff --git a/src/assistant/assistant/doc/snippets/doc_src_assistant-manual.qdoc b/src/assistant/assistant/doc/snippets/doc_src_assistant-manual.qdoc
index feae787840..7c1e5f1df8 100644
--- a/src/assistant/assistant/doc/snippets/doc_src_assistant-manual.qdoc
+++ b/src/assistant/assistant/doc/snippets/doc_src_assistant-manual.qdoc
@@ -150,7 +150,7 @@ assistant -collectionFile mycollection.qhc
//! [8]
//! [9]
-%QDesktopServices::DataLocation%/mycompany/myapplication/mycollection.qhc
+%QDesktopServices::AppDataLocation%/mycompany/myapplication/mycollection.qhc
//! [9]
//! [10]
diff --git a/src/assistant/assistant/doc/src/assistant-manual.qdoc b/src/assistant/assistant/doc/src/assistant-manual.qdoc
index c86a19cac0..8c2ae44fae 100644
--- a/src/assistant/assistant/doc/src/assistant-manual.qdoc
+++ b/src/assistant/assistant/doc/src/assistant-manual.qdoc
@@ -62,7 +62,6 @@
\page assistant-custom-help-viewer.html
\title Customizing Qt Assistant
- \contentspage {Qt Assistant Manual}{Contents}
\previouspage Using Qt Assistant
Using \QA as custom help viewer requires more than just being able to
@@ -120,7 +119,7 @@
To solve this dilemma, \QA creates user specific collection files which
are more or less copied from the original collection file. The user-specific
collection file will be saved in a subdirectory of the path returned by
- QDesktopServices::DataLocation. The subdirectory, or \e{cache directory}
+ QDesktopServices::AppDataLocation. The subdirectory, or \e{cache directory}
within this user-specific location, can be defined in the help collection
project file. For example:
@@ -261,7 +260,7 @@
relative to the directory the collection file resides in.
If the attribute is set to "default" or if it is missing,
the path is relative to the directory given by
- QDesktopServices::DataLocation. The first form is useful for
+ QDesktopServices::AppDataLocation. The first form is useful for
collections that are used in a \e mobile way, such as carried around
on a USB stick.
\row
diff --git a/src/assistant/assistant/doc/src/assistant-quick-guide.qdoc b/src/assistant/assistant/doc/src/assistant-quick-guide.qdoc
index 28590fa259..2a8dc01e1d 100644
--- a/src/assistant/assistant/doc/src/assistant-quick-guide.qdoc
+++ b/src/assistant/assistant/doc/src/assistant-quick-guide.qdoc
@@ -27,7 +27,6 @@
/*!
\if !defined(ASSISTANT_INTERNAL)
- \contentspage {Qt Assistant Manual}{Contents}
\previouspage Qt Assistant Manual
\endif
\page assistant-quick-guide.html
@@ -99,7 +98,6 @@
/*!
\if !defined(ASSISTANT_INTERNAL)
- \contentspage {Qt Assistant Manual}{Contents}
\nextpage Customizing Qt Assistant
\endif
\page assistant-details.html
@@ -169,8 +167,12 @@
\QA provides a powerful full text search engine. You can search for certain
words or text in the \gui Search window. Enter the text you want to look for
and press \key{Enter} or click \gui{Search}. The search is not case sensitive.
- For example, \b Foo, \b fOo and \b FOO are all treated as the same. The
- following are examples of common search patterns:
+ For example, \b Foo, \b fOo and \b FOO are all treated as the same.
+
+ You can create complex queries using the
+ \l{https://sqlite.org/fts5.html#full_text_query_syntax}{FTS query syntax}.
+
+ The following are examples of common search patterns:
\list
\li \c deep -- lists all the documents that contain the word \b deep
@@ -182,19 +184,6 @@
\b {deep copy}
\endlist
- Use the \gui{Advanced search} for more flexibility.
- You can specify some words so that hits containing these are excluded from the
- result, or you can search for an exact phrase. Searching for similar words will
- give results like these:
-
- \list
- \li \c{QStin} -- lists all the documents with titles that are similar, such as \c{QString}
- \li \c{QSting} -- lists all the documents with titles that are similar, such as \c{QString}
- \li \c{QStrin} -- lists all the documents with titles that are similar, such as \c{QString}
- \endlist
-
- Options can be combined to improve the search results.
-
The list of documents found is ordered according to the number of
occurrences of the search text which they contain, with those containing
the highest number of occurrences appearing first. Simply click any
diff --git a/src/assistant/assistant/globalactions.cpp b/src/assistant/assistant/globalactions.cpp
index 6accd6dcdd..a46a615657 100644
--- a/src/assistant/assistant/globalactions.cpp
+++ b/src/assistant/assistant/globalactions.cpp
@@ -32,11 +32,18 @@
#include "helpviewer.h"
#include "tracer.h"
-#include
#include
+#include
+
#if defined(BROWSER_QTWEBKIT)
# include
+# define WEBHISTORY QWebHistory
+# define WEBHISTORYITEM QWebHistoryItem
+#elif defined(BROWSER_QTWEBENGINE)
+# include
+# define WEBHISTORY QWebEngineHistory
+# define WEBHISTORYITEM QWebEngineHistoryItem
#endif
GlobalActions *GlobalActions::instance(QObject *parent)
@@ -105,6 +112,7 @@ GlobalActions::GlobalActions(QObject *parent) : QObject(parent)
separator->setSeparator(true);
m_actionList << separator;
+#if QT_CONFIG(clipboard)
m_copyAction = new QAction(tr("&Copy selected Text"), parent);
m_copyAction->setPriority(QAction::LowPriority);
m_copyAction->setIconText("&Copy");
@@ -113,6 +121,7 @@ GlobalActions::GlobalActions(QObject *parent) : QObject(parent)
m_copyAction->setEnabled(false);
connect(m_copyAction, &QAction::triggered, centralWidget, &CentralWidget::copy);
m_actionList << m_copyAction;
+#endif
m_printAction = new QAction(tr("&Print..."), parent);
m_printAction->setPriority(QAction::LowPriority);
@@ -133,7 +142,9 @@ GlobalActions::GlobalActions(QObject *parent) : QObject(parent)
m_nextAction->setIcon(QIcon::fromTheme(QStringLiteral("go-next") , m_nextAction->icon()));
m_zoomInAction->setIcon(QIcon::fromTheme(QStringLiteral("zoom-in") , m_zoomInAction->icon()));
m_zoomOutAction->setIcon(QIcon::fromTheme(QStringLiteral("zoom-out") , m_zoomOutAction->icon()));
+#if QT_CONFIG(clipboard)
m_copyAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-copy") , m_copyAction->icon()));
+#endif
m_findAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-find") , m_findAction->icon()));
m_homeAction->setIcon(QIcon::fromTheme(QStringLiteral("go-home") , m_homeAction->icon()));
m_printAction->setIcon(QIcon::fromTheme(QStringLiteral("document-print") , m_printAction->icon()));
@@ -144,26 +155,30 @@ void GlobalActions::updateActions()
{
TRACE_OBJ
CentralWidget *centralWidget = CentralWidget::instance();
+#if QT_CONFIG(clipboard)
m_copyAction->setEnabled(centralWidget->hasSelection());
+#endif
m_nextAction->setEnabled(centralWidget->isForwardAvailable());
m_backAction->setEnabled(centralWidget->isBackwardAvailable());
}
+#if QT_CONFIG(clipboard)
void GlobalActions::setCopyAvailable(bool available)
{
TRACE_OBJ
m_copyAction->setEnabled(available);
}
+#endif
-#if defined(BROWSER_QTWEBKIT)
+#if defined(BROWSER_QTWEBKIT) || defined(BROWSER_QTWEBENGINE)
void GlobalActions::slotAboutToShowBackMenu()
{
TRACE_OBJ
m_backMenu->clear();
- if (QWebHistory *history = CentralWidget::instance()->currentHelpViewer()->history()) {
+ if (WEBHISTORY *history = CentralWidget::instance()->currentHelpViewer()->history()) {
const int currentItemIndex = history->currentItemIndex();
- QList items = history->backItems(history->count());
+ QList items = history->backItems(history->count());
for (int i = items.count() - 1; i >= 0; --i) {
QAction *action = new QAction(this);
action->setText(items.at(i).title());
@@ -177,9 +192,9 @@ void GlobalActions::slotAboutToShowNextMenu()
{
TRACE_OBJ
m_nextMenu->clear();
- if (QWebHistory *history = CentralWidget::instance()->currentHelpViewer()->history()) {
+ if (WEBHISTORY *history = CentralWidget::instance()->currentHelpViewer()->history()) {
const int count = history->count();
- QList items = history->forwardItems(count);
+ QList items = history->forwardItems(count);
for (int i = 0; i < items.count(); ++i) {
QAction *action = new QAction(this);
action->setData(count - i);
@@ -194,7 +209,7 @@ void GlobalActions::slotOpenActionUrl(QAction *action)
TRACE_OBJ
if (HelpViewer* viewer = CentralWidget::instance()->currentHelpViewer()) {
const int offset = action->data().toInt();
- QWebHistory *history = viewer->history();
+ WEBHISTORY *history = viewer->history();
if (offset > 0) {
history->goToItem(history->forwardItems(history->count()
- offset + 1).back()); // forward
@@ -204,12 +219,12 @@ void GlobalActions::slotOpenActionUrl(QAction *action)
}
}
-#endif // BROWSER_QTWEBKIT
+#endif // BROWSER_QTWEBKIT || BROWSER_QTWEBENGINE
void GlobalActions::setupNavigationMenus(QAction *back, QAction *next,
QWidget *parent)
{
-#if defined(BROWSER_QTWEBKIT)
+#if defined(BROWSER_QTWEBKIT) || defined(BROWSER_QTWEBENGINE)
m_backMenu = new QMenu(parent);
connect(m_backMenu, &QMenu::aboutToShow,
this, &GlobalActions::slotAboutToShowBackMenu);
diff --git a/src/assistant/assistant/globalactions.h b/src/assistant/assistant/globalactions.h
index a3a4dec63f..338672fa26 100644
--- a/src/assistant/assistant/globalactions.h
+++ b/src/assistant/assistant/globalactions.h
@@ -26,11 +26,12 @@
**
****************************************************************************/
-#ifndef GLOBALACTION_H
-#define GLOBALACTION_H
+#ifndef GLOBALACTIONS_H
+#define GLOBALACTIONS_H
#include
#include
+#include
QT_BEGIN_NAMESPACE
@@ -50,14 +51,19 @@ class GlobalActions : public QObject
QAction *homeAction() const { return m_homeAction; }
QAction *zoomInAction() const { return m_zoomInAction; }
QAction *zoomOutAction() const { return m_zoomOutAction; }
+#if QT_CONFIG(clipboard)
QAction *copyAction() const { return m_copyAction; }
+#endif
QAction *printAction() const { return m_printAction; }
QAction *findAction() const { return m_findAction; }
- Q_SLOT void updateActions();
- Q_SLOT void setCopyAvailable(bool available);
+public slots:
+#if QT_CONFIG(clipboard)
+ void setCopyAvailable(bool available);
+#endif
+ void updateActions();
-#if defined(BROWSER_QTWEBKIT)
+#if defined(BROWSER_QTWEBKIT) || defined(BROWSER_QTWEBENGINE)
private slots:
void slotAboutToShowBackMenu();
void slotAboutToShowNextMenu();
@@ -77,7 +83,9 @@ private slots:
QAction *m_homeAction;
QAction *m_zoomInAction;
QAction *m_zoomOutAction;
+#if QT_CONFIG(clipboard)
QAction *m_copyAction;
+#endif
QAction *m_printAction;
QAction *m_findAction;
@@ -89,4 +97,4 @@ private slots:
QT_END_NAMESPACE
-#endif // GLOBALACTION_H
+#endif // GLOBALACTIONS_H
diff --git a/src/assistant/assistant/helpbrowsersupport.cpp b/src/assistant/assistant/helpbrowsersupport.cpp
index 86f44f9c8c..921da11c30 100644
--- a/src/assistant/assistant/helpbrowsersupport.cpp
+++ b/src/assistant/assistant/helpbrowsersupport.cpp
@@ -42,6 +42,11 @@
#include
#include
+#ifdef BROWSER_QTWEBENGINE
+#include
+#include
+#endif
+
QT_BEGIN_NAMESPACE
// -- messages
@@ -159,6 +164,57 @@ class HelpRedirectNetworkReply : public QNetworkReply
qint64 readData(char*, qint64) override { TRACE_OBJ return qint64(-1); }
};
+// -- HelpDeviceReply
+
+#if defined(BROWSER_QTWEBENGINE)
+class HelpDeviceReply : public QIODevice
+{
+public:
+ HelpDeviceReply(const QUrl &request, const QByteArray &fileData);
+
+ qint64 bytesAvailable() const override
+ { return data.length() + QIODevice::bytesAvailable(); }
+
+ void close() override
+ { QIODevice::close(); deleteLater(); }
+
+protected:
+ qint64 readData(char *data, qint64 maxlen) override;
+ qint64 writeData(const char *data, qint64 maxlen) override;
+
+private:
+ QByteArray data;
+ const qint64 origLen;
+};
+
+HelpDeviceReply::HelpDeviceReply(const QUrl &/*request*/, const QByteArray &fileData)
+ : data(fileData), origLen(fileData.length())
+{
+ TRACE_OBJ
+ setOpenMode(QIODevice::ReadOnly);
+
+ QTimer::singleShot(0, this, &QIODevice::readyRead);
+ QTimer::singleShot(0, this, &QIODevice::readChannelFinished);
+}
+
+qint64 HelpDeviceReply::readData(char *buffer, qint64 maxlen)
+{
+ TRACE_OBJ
+ qint64 len = qMin(qint64(data.length()), maxlen);
+ if (len) {
+ memcpy(buffer, data.constData(), len);
+ data.remove(0, len);
+ }
+ return len;
+}
+
+qint64 HelpDeviceReply::writeData(const char */*buffer*/, qint64 /*maxlen*/)
+{
+ TRACE_OBJ
+ return 0;
+}
+#endif
+
// -- HelpNetworkAccessManager
class HelpNetworkAccessManager : public QNetworkAccessManager
@@ -229,4 +285,52 @@ QNetworkAccessManager *HelpBrowserSupport::createNetworkAccessManager(QObject *p
return new HelpNetworkAccessManager(parent);
}
+#if defined(BROWSER_QTWEBENGINE)
+// -- HelpUrlSchemeHandler
+
+class HelpUrlSchemeHandler : public QWebEngineUrlSchemeHandler
+{
+public:
+ HelpUrlSchemeHandler(QObject *parent);
+
+ void requestStarted(QWebEngineUrlRequestJob *job) override;
+};
+
+HelpUrlSchemeHandler::HelpUrlSchemeHandler(QObject *parent)
+ : QWebEngineUrlSchemeHandler(parent)
+{
+ TRACE_OBJ
+}
+
+void HelpUrlSchemeHandler::requestStarted(QWebEngineUrlRequestJob *job)
+{
+ TRACE_OBJ
+
+ QByteArray data;
+ const QUrl url = job->requestUrl();
+ QUrl redirectedUrl;
+ switch (HelpBrowserSupport::resolveUrl(url, &redirectedUrl, &data)) {
+ case HelpBrowserSupport::UrlRedirect:
+ job->redirect(redirectedUrl);
+ return;
+ case HelpBrowserSupport::UrlLocalData: {
+ const QString mimeType = HelpViewer::mimeFromUrl(url);
+ QIODevice *reply = new HelpDeviceReply(url, data);
+ job->reply(mimeType.toLatin1(), reply);
+ return;
+ }
+ case HelpBrowserSupport::UrlResolveError:
+ job->fail(QWebEngineUrlRequestJob::UrlInvalid);
+ return;
+ }
+ Q_UNREACHABLE();
+}
+
+QWebEngineUrlSchemeHandler *HelpBrowserSupport::createUrlSchemeHandler(QObject *parent)
+{
+ return new HelpUrlSchemeHandler(parent);
+}
+#endif
+
+
QT_END_NAMESPACE
diff --git a/src/assistant/assistant/helpbrowsersupport.h b/src/assistant/assistant/helpbrowsersupport.h
index d10056645f..ddf4770f11 100644
--- a/src/assistant/assistant/helpbrowsersupport.h
+++ b/src/assistant/assistant/helpbrowsersupport.h
@@ -38,6 +38,7 @@ class QObject;
class QString;
class QByteArray;
class QUrl;
+class QWebEngineUrlSchemeHandler;
// Provide helper functions for feeding the QtHelp data stored in the help database
// into various browsers.
@@ -62,6 +63,10 @@ class HelpBrowserSupport
// Create an instance of QNetworkAccessManager for WebKit-type browsers.
static QNetworkAccessManager *createNetworkAccessManager(QObject *parent = nullptr);
+
+#if defined(BROWSER_QTWEBENGINE)
+ static QWebEngineUrlSchemeHandler *createUrlSchemeHandler(QObject *parent = nullptr);
+#endif
};
QT_END_NAMESPACE
diff --git a/src/assistant/assistant/helpdocsettings.cpp b/src/assistant/assistant/helpdocsettings.cpp
new file mode 100644
index 0000000000..dc4afdb865
--- /dev/null
+++ b/src/assistant/assistant/helpdocsettings.cpp
@@ -0,0 +1,231 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "helpdocsettings.h"
+
+#include
+#include
+#include
+
+#include
+
+#include
+
+QT_BEGIN_NAMESPACE
+
+class HelpDocSettingsPrivate : public QSharedData
+{
+public:
+ HelpDocSettingsPrivate() = default;
+ HelpDocSettingsPrivate(const HelpDocSettingsPrivate &other) = default;
+ ~HelpDocSettingsPrivate() = default;
+
+ QMap m_namespaceToComponent;
+ QMap m_componentToNamespace;
+
+ QMap m_namespaceToVersion;
+ QMap m_versionToNamespace;
+
+ QMap m_namespaceToFileName;
+ QMap m_fileNameToNamespace;
+};
+
+
+HelpDocSettings::HelpDocSettings()
+ : d(new HelpDocSettingsPrivate)
+{
+}
+
+HelpDocSettings::HelpDocSettings(const HelpDocSettings &) = default;
+
+HelpDocSettings::HelpDocSettings(HelpDocSettings &&) = default;
+
+HelpDocSettings::~HelpDocSettings() = default;
+
+HelpDocSettings &HelpDocSettings::operator=(const HelpDocSettings &) = default;
+
+HelpDocSettings &HelpDocSettings::operator=(HelpDocSettings &&) = default;
+
+bool HelpDocSettings::addDocumentation(const QString &fileName)
+{
+ const QCompressedHelpInfo info = QCompressedHelpInfo::fromCompressedHelpFile(fileName);
+
+ if (info.isNull())
+ return false;
+
+ const QString namespaceName = info.namespaceName();
+
+ if (d->m_namespaceToFileName.contains(namespaceName))
+ return false;
+
+ if (d->m_fileNameToNamespace.contains(fileName))
+ return false;
+
+ const QString component = info.component();
+ const QVersionNumber version = info.version();
+
+ d->m_namespaceToFileName.insert(namespaceName, fileName);
+ d->m_fileNameToNamespace.insert(fileName, namespaceName);
+
+ d->m_namespaceToComponent.insert(namespaceName, component);
+ d->m_componentToNamespace[component].append(namespaceName);
+
+ d->m_namespaceToVersion.insert(namespaceName, version);
+ d->m_versionToNamespace[version].append(namespaceName);
+
+ return true;
+}
+
+bool HelpDocSettings::removeDocumentation(const QString &namespaceName)
+{
+ if (namespaceName.isEmpty())
+ return false;
+
+ const QString fileName = d->m_namespaceToFileName.value(namespaceName);
+ if (fileName.isEmpty())
+ return false;
+
+ const QString component = d->m_namespaceToComponent.value(namespaceName);
+ const QVersionNumber version = d->m_namespaceToVersion.value(namespaceName);
+
+ d->m_namespaceToComponent.remove(namespaceName);
+ d->m_namespaceToVersion.remove(namespaceName);
+ d->m_namespaceToFileName.remove(namespaceName);
+ d->m_fileNameToNamespace.remove(fileName);
+ d->m_componentToNamespace[component].removeOne(namespaceName);
+ if (d->m_componentToNamespace[component].isEmpty())
+ d->m_componentToNamespace.remove(component);
+ d->m_versionToNamespace[version].removeOne(namespaceName);
+ if (d->m_versionToNamespace[version].isEmpty())
+ d->m_versionToNamespace.remove(version);
+
+ return true;
+}
+
+QString HelpDocSettings::namespaceName(const QString &fileName) const
+{
+ return d->m_fileNameToNamespace.value(fileName);
+}
+
+QStringList HelpDocSettings::components() const
+{
+ return d->m_componentToNamespace.keys();
+}
+
+QList HelpDocSettings::versions() const
+{
+ return d->m_versionToNamespace.keys();
+}
+
+QStringList HelpDocSettings::namespaces() const
+{
+ return d->m_namespaceToFileName.keys();
+}
+
+QMap HelpDocSettings::namespaceToFileName() const
+{
+ return d->m_namespaceToFileName;
+}
+
+HelpDocSettings HelpDocSettings::readSettings(QHelpEngineCore *helpEngine)
+{
+ QHelpFilterEngine *filterEngine = helpEngine->filterEngine();
+
+ HelpDocSettings docSettings;
+ docSettings.d->m_namespaceToComponent = filterEngine->namespaceToComponent();
+ docSettings.d->m_namespaceToVersion = filterEngine->namespaceToVersion();
+ for (auto it = docSettings.d->m_namespaceToComponent.constBegin();
+ it != docSettings.d->m_namespaceToComponent.constEnd(); ++it) {
+ const QString namespaceName = it.key();
+ const QString namespaceFileName = helpEngine->documentationFileName(namespaceName);
+ docSettings.d->m_namespaceToFileName.insert(namespaceName, namespaceFileName);
+ docSettings.d->m_fileNameToNamespace.insert(namespaceFileName, namespaceName);
+ docSettings.d->m_componentToNamespace[it.value()].append(namespaceName);
+ }
+ for (auto it = docSettings.d->m_namespaceToVersion.constBegin();
+ it != docSettings.d->m_namespaceToVersion.constEnd(); ++it) {
+ docSettings.d->m_versionToNamespace[it.value()].append(it.key());
+ }
+
+ return docSettings;
+}
+
+static QMap subtract(const QMap &minuend,
+ const QMap &subtrahend)
+{
+ auto result = minuend;
+
+ for (auto itSubtrahend = subtrahend.cbegin(); itSubtrahend != subtrahend.cend(); ++itSubtrahend) {
+ auto itResult = result.find(itSubtrahend.key());
+ if (itResult != result.end() && itSubtrahend.value() == itResult.value())
+ result.erase(itResult);
+ }
+
+ return result;
+}
+
+bool HelpDocSettings::applySettings(QHelpEngineCore *helpEngine,
+ const HelpDocSettings &settings)
+{
+ const HelpDocSettings oldSettings = readSettings(helpEngine);
+
+ const QMap docsToRemove = subtract(
+ oldSettings.namespaceToFileName(),
+ settings.namespaceToFileName());
+ const QMap docsToAdd = subtract(
+ settings.namespaceToFileName(),
+ oldSettings.namespaceToFileName());
+
+ bool changed = false;
+ for (const QString &namespaceName : docsToRemove.keys()) {
+ if (!helpEngine->unregisterDocumentation(namespaceName))
+ qWarning() << "Cannot unregister documentation:" << namespaceName;
+ changed = true;
+ }
+
+ for (const QString &fileName : docsToAdd.values()) {
+ if (!helpEngine->registerDocumentation(fileName))
+ qWarning() << "Cannot register documentation file:" << fileName;
+ changed = true;
+ }
+
+ return changed;
+}
+
+QT_END_NAMESPACE
diff --git a/src/winrtrunner/runner.h b/src/assistant/assistant/helpdocsettings.h
similarity index 57%
rename from src/winrtrunner/runner.h
rename to src/assistant/assistant/helpdocsettings.h
index 00b251be80..7476eb63a2 100644
--- a/src/winrtrunner/runner.h
+++ b/src/assistant/assistant/helpdocsettings.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
-** This file is part of the tools applications of the Qt Toolkit.
+** This file is part of the Qt Assistant of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -37,54 +37,46 @@
**
****************************************************************************/
-#ifndef RUNNER_H
-#define RUNNER_H
+#ifndef HELPDOCSETTINGS_H
+#define HELPDOCSETTINGS_H
-#include
-#include
-#include
-#include
-#include
+#include
-QT_USE_NAMESPACE
+QT_BEGIN_NAMESPACE
-class RunnerPrivate;
-class Runner
+class QVersionNumber;
+class QHelpEngineCore;
+class HelpDocSettingsPrivate;
+
+class HelpDocSettings final
{
public:
- static QMap deviceNames();
+ HelpDocSettings();
+ HelpDocSettings(const HelpDocSettings &other);
+ HelpDocSettings(HelpDocSettings &&other);
+ ~HelpDocSettings();
+
+ HelpDocSettings &operator=(const HelpDocSettings &other);
+ HelpDocSettings &operator=(HelpDocSettings &&other);
- Runner(const QString &app, const QStringList &arguments, const QString &profile = QString(),
- const QString &device = QString());
- ~Runner();
+ void swap(HelpDocSettings &other) noexcept
+ { d.swap(other.d); }
- bool isValid() const;
- QString app() const;
- QStringList arguments() const;
- int deviceIndex() const;
+ bool addDocumentation(const QString &fileName);
+ bool removeDocumentation(const QString &namespaceName);
+ QString namespaceName(const QString &fileName) const;
+ QStringList components() const;
+ QList versions() const;
+ QStringList namespaces() const;
+ QMap namespaceToFileName() const;
- bool install(bool removeFirst = false);
- bool remove();
- bool start();
- bool enableDebugging(const QString &debuggerExecutable, const QString &debuggerArguments);
- bool disableDebugging();
- bool setLoopbackExemptClientEnabled(bool enabled);
- bool setLoopbackExemptServerEnabled(bool enabled);
- bool setLoggingRules(const QByteArray &rules);
- bool suspend();
- bool stop();
- bool wait(int maxWaitTime = 0);
- bool setupTest();
- bool collectTest();
- qint64 pid();
- int exitCode();
+ static HelpDocSettings readSettings(QHelpEngineCore *helpEngine);
+ static bool applySettings(QHelpEngineCore *helpEngine, const HelpDocSettings &settings);
private:
- QScopedPointer d_ptr;
- Q_DECLARE_PRIVATE(Runner)
+ QSharedDataPointer d;
};
-Q_DECLARE_LOGGING_CATEGORY(lcWinRtRunner)
-Q_DECLARE_LOGGING_CATEGORY(lcWinRtRunnerApp)
+QT_END_NAMESPACE
-#endif // RUNNER_H
+#endif // HELPDOCSETTINGS_H
diff --git a/src/assistant/assistant/helpdocsettingswidget.cpp b/src/assistant/assistant/helpdocsettingswidget.cpp
new file mode 100644
index 0000000000..646026a23a
--- /dev/null
+++ b/src/assistant/assistant/helpdocsettingswidget.cpp
@@ -0,0 +1,195 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "helpdocsettings.h"
+#include "helpdocsettingswidget.h"
+#include "ui_helpdocsettingswidget.h"
+
+#include
+#include
+
+QT_BEGIN_NAMESPACE
+
+class HelpDocSettingsWidgetPrivate
+{
+ HelpDocSettingsWidget *q_ptr;
+ Q_DECLARE_PUBLIC(HelpDocSettingsWidget)
+public:
+ HelpDocSettingsWidgetPrivate() = default;
+
+ void addDocumentation();
+ void removeDocumentation();
+ void applyDocListFilter(QListWidgetItem *item);
+
+ QMap m_namespaceToItem;
+ QHash m_itemToNamespace;
+
+ Ui::HelpDocSettingsWidget m_ui;
+ HelpDocSettings m_settings;
+};
+
+void HelpDocSettingsWidgetPrivate::addDocumentation()
+{
+ Q_Q(HelpDocSettingsWidget);
+
+ const QStringList &fileNames =
+ QFileDialog::getOpenFileNames(q, HelpDocSettingsWidget::tr("Add Documentation"), {},
+ HelpDocSettingsWidget::tr("Qt Compressed Help Files (*.qch)"));
+ if (fileNames.isEmpty())
+ return;
+
+ bool added = false;
+
+ for (const QString &fileName : fileNames) {
+ if (!m_settings.addDocumentation(fileName))
+ continue;
+
+ if (!added) {
+ added = true;
+ m_ui.registeredDocsListWidget->clearSelection();
+ }
+
+ const QString namespaceName = m_settings.namespaceName(fileName);
+ QListWidgetItem *item = new QListWidgetItem(namespaceName);
+ m_namespaceToItem.insert(namespaceName, item);
+ m_itemToNamespace.insert(item, namespaceName);
+ m_ui.registeredDocsListWidget->insertItem(m_namespaceToItem.keys().indexOf(namespaceName), item);
+
+ item->setSelected(true);
+ applyDocListFilter(item);
+ }
+
+ if (added)
+ emit q->docSettingsChanged(m_settings);
+}
+
+void HelpDocSettingsWidgetPrivate::removeDocumentation()
+{
+ Q_Q(HelpDocSettingsWidget);
+
+ const QList selectedItems = m_ui.registeredDocsListWidget->selectedItems();
+ if (selectedItems.isEmpty())
+ return;
+
+ for (QListWidgetItem *item : selectedItems) {
+ const QString namespaceName = m_itemToNamespace.value(item);
+ m_itemToNamespace.remove(item);
+ m_namespaceToItem.remove(namespaceName);
+ delete item;
+
+ m_settings.removeDocumentation(namespaceName);
+ }
+
+ emit q->docSettingsChanged(m_settings);
+}
+
+void HelpDocSettingsWidgetPrivate::applyDocListFilter(QListWidgetItem *item)
+{
+ const QString namespaceName = m_itemToNamespace.value(item);
+ const QString nameFilter = m_ui.registeredDocsFilterLineEdit->text();
+
+ const bool matches = nameFilter.isEmpty() || namespaceName.contains(nameFilter);
+
+ if (!matches)
+ item->setSelected(false);
+ item->setHidden(!matches);
+}
+
+HelpDocSettingsWidget::HelpDocSettingsWidget(QWidget *parent)
+ : QWidget(parent)
+ , d_ptr(new HelpDocSettingsWidgetPrivate())
+{
+ Q_D(HelpDocSettingsWidget);
+ d->q_ptr = this;
+ d->m_ui.setupUi(this);
+
+ connect(d->m_ui.docAddButton, &QAbstractButton::clicked,
+ [this]() {
+ Q_D(HelpDocSettingsWidget);
+ d->addDocumentation();
+ });
+ connect(d->m_ui.docRemoveButton, &QAbstractButton::clicked,
+ [this]() {
+ Q_D(HelpDocSettingsWidget);
+ d->removeDocumentation();
+ });
+ connect(d->m_ui.registeredDocsFilterLineEdit, &QLineEdit::textChanged,
+ [this](const QString &) {
+ Q_D(HelpDocSettingsWidget);
+ for (const auto item : d->m_namespaceToItem)
+ d->applyDocListFilter(item);
+ });
+ connect(d->m_ui.registeredDocsListWidget, &QListWidget::itemSelectionChanged,
+ [this]() {
+ Q_D(HelpDocSettingsWidget);
+ d->m_ui.docRemoveButton->setEnabled(
+ !d->m_ui.registeredDocsListWidget->selectedItems().isEmpty());
+ });
+}
+
+HelpDocSettingsWidget::~HelpDocSettingsWidget() = default;
+
+void HelpDocSettingsWidget::setDocSettings(const HelpDocSettings &settings)
+{
+ Q_D(HelpDocSettingsWidget);
+ d->m_settings = settings;
+
+ d->m_ui.registeredDocsListWidget->clear();
+ d->m_namespaceToItem.clear();
+ d->m_itemToNamespace.clear();
+
+ for (const QString &namespaceName : d->m_settings.namespaces()) {
+ QListWidgetItem *item = new QListWidgetItem(namespaceName);
+ d->m_namespaceToItem.insert(namespaceName, item);
+ d->m_itemToNamespace.insert(item, namespaceName);
+ d->m_ui.registeredDocsListWidget->addItem(item);
+ d->applyDocListFilter(item);
+ }
+
+ d->m_ui.docRemoveButton->setEnabled(
+ !d->m_ui.registeredDocsListWidget->selectedItems().isEmpty());
+}
+
+HelpDocSettings HelpDocSettingsWidget::docSettings() const
+{
+ Q_D(const HelpDocSettingsWidget);
+ return d->m_settings;
+}
+
+QT_END_NAMESPACE
diff --git a/src/winrtrunner/appxengine.h b/src/assistant/assistant/helpdocsettingswidget.h
similarity index 64%
rename from src/winrtrunner/appxengine.h
rename to src/assistant/assistant/helpdocsettingswidget.h
index c2d235ec67..3ed0893537 100644
--- a/src/winrtrunner/appxengine.h
+++ b/src/assistant/assistant/helpdocsettingswidget.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
-** This file is part of the tools applications of the Qt Toolkit.
+** This file is part of the Qt Assistant of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -37,40 +37,37 @@
**
****************************************************************************/
-#ifndef APPXENGINE_H
-#define APPXENGINE_H
+#ifndef HELPDOCSETTINGSWIDGET_H
+#define HELPDOCSETTINGSWIDGET_H
-#include "runnerengine.h"
-#include "runner.h"
+#include
-#include
-#include
+QT_BEGIN_NAMESPACE
-QT_USE_NAMESPACE
+class HelpDocSettings;
+class HelpDocSettingsWidgetPrivate;
-struct IAppxManifestReader;
-class AppxEnginePrivate;
-class AppxEngine : public RunnerEngine
+class HelpDocSettingsWidget : public QWidget
{
+ Q_OBJECT
public:
- qint64 pid() const override;
- int exitCode() const override;
- QString executable() const override;
+ HelpDocSettingsWidget(QWidget *parent = nullptr);
-protected:
- explicit AppxEngine(Runner *runner, AppxEnginePrivate *dd);
- ~AppxEngine();
+ ~HelpDocSettingsWidget();
- virtual QString extensionSdkPath() const = 0;
- virtual bool installPackage(IAppxManifestReader *reader, const QString &filePath) = 0;
+ void setDocSettings(const HelpDocSettings &settings);
+ HelpDocSettings docSettings() const;
- bool installDependencies();
- bool createPackage(const QString &packageFileName);
- bool sign(const QString &fileName);
- static bool getManifestFile(const QString &fileName, QString *manifest = 0);
+Q_SIGNALS:
+ void docSettingsChanged(const HelpDocSettings &settings);
- QScopedPointer d_ptr;
- Q_DECLARE_PRIVATE(AppxEngine)
+private:
+ QScopedPointer d_ptr;
+ Q_DECLARE_PRIVATE(HelpDocSettingsWidget)
+ Q_DISABLE_COPY_MOVE(HelpDocSettingsWidget)
};
-#endif // APPXENGINE_H
+QT_END_NAMESPACE
+
+#endif
+
diff --git a/src/assistant/assistant/helpdocsettingswidget.ui b/src/assistant/assistant/helpdocsettingswidget.ui
new file mode 100644
index 0000000000..4897dfe865
--- /dev/null
+++ b/src/assistant/assistant/helpdocsettingswidget.ui
@@ -0,0 +1,76 @@
+
+
+ HelpDocSettingsWidget
+
+
+
+ 0
+ 0
+ 268
+ 128
+
+
+
+ Form
+
+
+ -
+
+
+ Registered Documentation
+
+
+
+ -
+
+
+ <Filter>
+
+
+ true
+
+
+
+ -
+
+
-
+
+
+ Add...
+
+
+
+ -
+
+
+ Remove
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+ -
+
+
+ QAbstractItemView::ExtendedSelection
+
+
+
+
+
+
+
+
diff --git a/src/assistant/assistant/helpenginewrapper.cpp b/src/assistant/assistant/helpenginewrapper.cpp
index 17e4bde8c9..6f077d60bd 100644
--- a/src/assistant/assistant/helpenginewrapper.cpp
+++ b/src/assistant/assistant/helpenginewrapper.cpp
@@ -30,6 +30,7 @@
#include "helpenginewrapper.h"
#include "../shared/collectionconfiguration.h"
#include "../help/qhelpengine_p.h"
+#include "helpbrowsersupport.h"
#include
#include
@@ -41,8 +42,13 @@
#include
#include
#include
+#include
#include
+#if defined(BROWSER_QTWEBENGINE)
+#include
+#endif
+
QT_BEGIN_NAMESPACE
namespace {
@@ -102,6 +108,9 @@ private slots:
QFileSystemWatcher * const m_qchWatcher;
typedef QPair > RecentSignal;
QMap m_recentQchUpdates;
+#if defined(BROWSER_QTWEBENGINE)
+ QWebEngineUrlSchemeHandler *m_helpSchemeHandler;
+#endif
};
HelpEngineWrapper *HelpEngineWrapper::helpEngineWrapper = nullptr;
@@ -153,6 +162,10 @@ HelpEngineWrapper::HelpEngineWrapper(const QString &collectionFile)
HelpEngineWrapper::~HelpEngineWrapper()
{
TRACE_OBJ
+#if defined(BROWSER_QTWEBENGINE)
+ QWebEngineProfile::defaultProfile()->removeUrlSchemeHandler(d->m_helpSchemeHandler);
+#endif
+
const QStringList &namespaces = d->m_helpEngine->registeredDocumentations();
for (const QString &nameSpace : namespaces) {
const QString &docFile
@@ -261,10 +274,10 @@ QByteArray HelpEngineWrapper::fileData(const QUrl &url) const
return d->m_helpEngine->fileData(url);
}
-QMap HelpEngineWrapper::linksForIdentifier(const QString &id) const
+QList HelpEngineWrapper::documentsForIdentifier(const QString &id) const
{
TRACE_OBJ
- return d->m_helpEngine->linksForIdentifier(id);
+ return d->m_helpEngine->documentsForIdentifier(id);
}
QString HelpEngineWrapper::error() const
@@ -670,6 +683,12 @@ void HelpEngineWrapper::setTopicChooserGeometry(const QByteArray &geometry)
d->m_helpEngine->setCustomValue(TopicChooserGeometryKey, geometry);
}
+QHelpEngineCore *HelpEngineWrapper::helpEngine() const
+{
+ return d->m_helpEngine;
+}
+
+
// -- TimeoutForwarder
TimeoutForwarder::TimeoutForwarder(const QString &fileName)
@@ -687,12 +706,16 @@ void TimeoutForwarder::forward()
// -- HelpEngineWrapperPrivate
HelpEngineWrapperPrivate::HelpEngineWrapperPrivate(const QString &collectionFile)
- : m_helpEngine(new QHelpEngine(collectionFile, this)),
- m_qchWatcher(new QFileSystemWatcher(this))
+ : m_helpEngine(new QHelpEngine(collectionFile, this))
+ , m_qchWatcher(new QFileSystemWatcher(this))
+#if defined(BROWSER_QTWEBENGINE)
+ , m_helpSchemeHandler(0)
+#endif
{
TRACE_OBJ
- initFileSystemWatchers();
+ m_helpEngine->setReadOnly(false);
m_helpEngine->setUsesFilterEngine(true);
+ initFileSystemWatchers();
}
void HelpEngineWrapperPrivate::initFileSystemWatchers()
@@ -791,6 +814,17 @@ void HelpEngineWrapperPrivate::qchFileChanged(const QString &fileName,
m_recentQchUpdates.erase(it);
}
+#if defined(BROWSER_QTWEBENGINE)
+
+void HelpEngineWrapper::ensureUrlSchemeHandler()
+{
+ if (!d->m_helpSchemeHandler) {
+ d->m_helpSchemeHandler = HelpBrowserSupport::createUrlSchemeHandler(this);
+ QWebEngineProfile::defaultProfile()->installUrlSchemeHandler(QByteArrayLiteral("qthelp"), d->m_helpSchemeHandler);
+ }
+}
+#endif
+
QT_END_NAMESPACE
#include "helpenginewrapper.moc"
diff --git a/src/assistant/assistant/helpenginewrapper.h b/src/assistant/assistant/helpenginewrapper.h
index 6026a04736..c3ccef13f4 100644
--- a/src/assistant/assistant/helpenginewrapper.h
+++ b/src/assistant/assistant/helpenginewrapper.h
@@ -37,6 +37,8 @@
#include
#include
+#include "qhelplink.h"
+
QT_BEGIN_NAMESPACE
class QFileSystemWatcher;
@@ -46,6 +48,7 @@ class QHelpIndexModel;
class QHelpIndexWidget;
class QHelpSearchEngine;
class QHelpFilterEngine;
+class QHelpEngineCore;
enum {
ShowHomePage = 0,
@@ -79,7 +82,7 @@ class HelpEngineWrapper : public QObject
bool unregisterDocumentation(const QString &namespaceName);
QUrl findFile(const QUrl &url) const;
QByteArray fileData(const QUrl &url) const;
- QMap linksForIdentifier(const QString &id) const;
+ QList documentsForIdentifier(const QString &id) const;
QString error() const;
QHelpFilterEngine *filterEngine() const;
@@ -175,6 +178,13 @@ class HelpEngineWrapper : public QObject
const QByteArray topicChooserGeometry() const;
void setTopicChooserGeometry(const QByteArray &geometry);
+ QHelpEngineCore *helpEngine() const;
+
+#if defined(BROWSER_QTWEBENGINE)
+ void ensureUrlSchemeHandler();
+#endif
+
+
signals:
// For asynchronous doc updates triggered by external actions.
diff --git a/src/assistant/assistant/helpviewer.h b/src/assistant/assistant/helpviewer.h
index 00e941000e..882323abdd 100644
--- a/src/assistant/assistant/helpviewer.h
+++ b/src/assistant/assistant/helpviewer.h
@@ -34,11 +34,13 @@
#include
#include
-#include
+#include
#include
#if defined(BROWSER_QTWEBKIT)
# include
+#elif defined(BROWSER_QTWEBENGINE)
+# include
#elif defined(BROWSER_QTEXTBROWSER)
# include
#endif
@@ -46,10 +48,14 @@
QT_BEGIN_NAMESPACE
class HelpEngineWrapper;
+class QPrinter;
#if defined(BROWSER_QTWEBKIT)
#define TEXTBROWSER_OVERRIDE
class HelpViewer : public QWebView
+#elif defined(BROWSER_QTWEBENGINE)
+#define TEXTBROWSER_OVERRIDE
+class HelpViewer : public QWebEngineView
#elif defined(BROWSER_QTEXTBROWSER)
#define TEXTBROWSER_OVERRIDE override
class HelpViewer : public QTextBrowser
@@ -82,7 +88,11 @@ class HelpViewer : public QTextBrowser
void setTitle(const QString &title);
QUrl source() const;
+#if QT_VERSION < QT_VERSION_CHECK(6,0,0) || BROWSER_QTWEBENGINE
void setSource(const QUrl &url) TEXTBROWSER_OVERRIDE;
+#else
+ void doSetSource(const QUrl &url, QTextDocument::ResourceType type) TEXTBROWSER_OVERRIDE;
+#endif
QString selectedText() const;
bool isForwardAvailable() const;
@@ -101,7 +111,7 @@ class HelpViewer : public QTextBrowser
static bool launchWithExternalApp(const QUrl &url);
public slots:
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void copy();
#endif
void home() TEXTBROWSER_OVERRIDE;
@@ -117,7 +127,7 @@ public slots:
void sourceChanged(const QUrl &url);
void forwardAvailable(bool enabled);
void backwardAvailable(bool enabled);
- void highlighted(const QString &link);
+ void highlighted(const QUrl &link);
void printRequested();
#elif !defined(BROWSER_QTWEBKIT)
// Provide signals present in QWebView for browsers that do not inherit QWebView
@@ -130,6 +140,7 @@ public slots:
void wheelEvent(QWheelEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
+ void resizeEvent(QResizeEvent *e) override;
private slots:
void actionChanged();
@@ -141,6 +152,7 @@ private slots:
void contextMenuEvent(QContextMenuEvent *event) override;
QVariant loadResource(int type, const QUrl &name) TEXTBROWSER_OVERRIDE;
bool handleForwardBackwardMouseButtons(QMouseEvent *e);
+ void scrollToTextPosition(int position);
private:
HelpViewerPrivate *d;
diff --git a/src/assistant/assistant/helpviewer_p.h b/src/assistant/assistant/helpviewer_p.h
index 8a85fdcea5..47615feb81 100644
--- a/src/assistant/assistant/helpviewer_p.h
+++ b/src/assistant/assistant/helpviewer_p.h
@@ -36,7 +36,7 @@
#include
#if defined(BROWSER_QTEXTBROWSER)
# include
-#elif defined(BROWSER_QTWEBKIT)
+#elif defined(BROWSER_QTWEBKIT) || defined(BROWSER_QTWEBENGINE)
# include
# include
#endif // BROWSER_QTWEBKIT
@@ -52,7 +52,7 @@ class HelpViewer::HelpViewerPrivate : public QObject
HelpViewerPrivate(int zoom)
: zoomCount(zoom)
{ }
-#elif defined(BROWSER_QTWEBKIT)
+#elif defined(BROWSER_QTWEBKIT) || defined(BROWSER_QTWEBENGINE)
HelpViewerPrivate()
: m_loadFinished(false)
{
@@ -112,7 +112,7 @@ public slots:
lastAnchor.clear();
}
-#elif defined(BROWSER_QTWEBKIT)
+#elif defined(BROWSER_QTWEBKIT) || defined(BROWSER_QTWEBENGINE)
qreal webDpiRatio;
#endif // BROWSER_QTWEBKIT
diff --git a/src/assistant/assistant/helpviewer_qtb.cpp b/src/assistant/assistant/helpviewer_qtb.cpp
index b522e1ba2d..e8eb273389 100644
--- a/src/assistant/assistant/helpviewer_qtb.cpp
+++ b/src/assistant/assistant/helpviewer_qtb.cpp
@@ -38,7 +38,8 @@
#include
#include
-#ifndef QT_NO_CLIPBOARD
+#include
+#if QT_CONFIG(clipboard)
#include
#endif
#include
@@ -143,9 +144,16 @@ QUrl HelpViewer::source() const
return QTextBrowser::source();
}
+#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
void HelpViewer::setSource(const QUrl &url)
+#else
+void HelpViewer::doSetSource(const QUrl &url, QTextDocument::ResourceType type)
+#endif
{
TRACE_OBJ
+#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
+ Q_UNUSED(type);
+#endif
if (launchWithExternalApp(url))
return;
@@ -153,7 +161,7 @@ void HelpViewer::setSource(const QUrl &url)
bool helpOrAbout = (url.toString() == QLatin1String("help"));
const QUrl resolvedUrl = (helpOrAbout ? LocalHelpFile : HelpEngineWrapper::instance().findFile(url));
- QTextBrowser::setSource(resolvedUrl);
+ QTextBrowser::doSetSource(resolvedUrl, type);
if (!resolvedUrl.isValid()) {
helpOrAbout = (url.toString() == QLatin1String("about:blank"));
@@ -237,7 +245,7 @@ bool HelpViewer::findText(const QString &text, FindFlags flags, bool incremental
// -- public slots
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void HelpViewer::copy()
{
TRACE_OBJ
@@ -277,7 +285,7 @@ void HelpViewer::wheelEvent(QWheelEvent *e)
TRACE_OBJ
if (e->modifiers() == Qt::ControlModifier) {
e->accept();
- e->delta() > 0 ? scaleUp() : scaleDown();
+ e->angleDelta().y() > 0 ? scaleUp() : scaleDown();
} else {
QTextBrowser::wheelEvent(e);
}
@@ -304,7 +312,7 @@ void HelpViewer::mouseReleaseEvent(QMouseEvent *e)
bool controlPressed = e->modifiers() & Qt::ControlModifier;
if ((controlPressed && d->hasAnchorAt(this, e->pos())) ||
- (e->button() == Qt::MidButton && d->hasAnchorAt(this, e->pos()))) {
+ (e->button() == Qt::MiddleButton && d->hasAnchorAt(this, e->pos()))) {
d->openLinkInNewPage();
return;
}
@@ -312,6 +320,14 @@ void HelpViewer::mouseReleaseEvent(QMouseEvent *e)
QTextBrowser::mouseReleaseEvent(e);
}
+
+void HelpViewer::resizeEvent(QResizeEvent *e)
+{
+ const int topTextPosition = cursorForPosition({width() / 2, 0}).position();
+ QTextBrowser::resizeEvent(e);
+ scrollToTextPosition(topTextPosition);
+}
+
// -- private slots
void HelpViewer::actionChanged()
@@ -336,7 +352,9 @@ void HelpViewer::contextMenuEvent(QContextMenuEvent *event)
QMenu menu(QString(), nullptr);
QUrl link;
+#if QT_CONFIG(clipboard)
QAction *copyAnchorAction = nullptr;
+#endif
if (d->hasAnchorAt(this, event->pos())) {
link = anchorAt(event->pos());
if (link.isRelative())
@@ -344,17 +362,19 @@ void HelpViewer::contextMenuEvent(QContextMenuEvent *event)
menu.addAction(tr("Open Link"), d, &HelpViewerPrivate::openLink);
menu.addAction(tr("Open Link in New Tab\tCtrl+LMB"), d, &HelpViewerPrivate::openLinkInNewPage);
+#if QT_CONFIG(clipboard)
if (!link.isEmpty() && link.isValid())
copyAnchorAction = menu.addAction(tr("Copy &Link Location"));
+#endif
} else if (!selectedText().isEmpty()) {
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
menu.addAction(tr("Copy"), this, &HelpViewer::copy);
#endif
} else {
menu.addAction(tr("Reload"), this, &HelpViewer::reload);
}
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
if (copyAnchorAction == menu.exec(event->globalPos()))
QApplication::clipboard()->setText(link.toString());
#endif
@@ -377,4 +397,16 @@ QVariant HelpViewer::loadResource(int type, const QUrl &name)
return ba;
}
+
+void HelpViewer::scrollToTextPosition(int position)
+{
+ QTextCursor tc(document());
+ tc.setPosition(position);
+ const int dy = cursorRect(tc).top();
+ if (verticalScrollBar()) {
+ verticalScrollBar()->setValue(
+ std::min(verticalScrollBar()->value() + dy, verticalScrollBar()->maximum()));
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/assistant/assistant/helpviewer_qwev.cpp b/src/assistant/assistant/helpviewer_qwev.cpp
new file mode 100644
index 0000000000..ddd9a19208
--- /dev/null
+++ b/src/assistant/assistant/helpviewer_qwev.cpp
@@ -0,0 +1,419 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "helpviewer.h"
+#include "helpviewer_p.h"
+
+#include "centralwidget.h"
+#include "helpenginewrapper.h"
+#include "helpbrowsersupport.h"
+#include "openpagesmanager.h"
+#include "tracer.h"
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+
+QT_BEGIN_NAMESPACE
+
+// -- HelpPage
+
+class HelpPage : public QWebEnginePage
+{
+public:
+ HelpPage(QObject *parent);
+ void upcomingLoad(const QUrl &url);
+
+protected:
+ QWebEnginePage *createWindow(QWebEnginePage::WebWindowType) override;
+ void triggerAction(WebAction action, bool checked = false) override;
+
+ bool acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame) override;
+
+private:
+ bool closeNewTabIfNeeded;
+
+ friend class HelpViewer;
+ QUrl m_loadingUrl;
+ Qt::MouseButtons m_pressedButtons;
+ Qt::KeyboardModifiers m_keyboardModifiers;
+};
+
+HelpPage::HelpPage(QObject *parent)
+ : QWebEnginePage(parent)
+ , closeNewTabIfNeeded(false)
+ , m_pressedButtons(Qt::NoButton)
+ , m_keyboardModifiers(Qt::NoModifier)
+{
+ TRACE_OBJ
+}
+
+QWebEnginePage *HelpPage::createWindow(QWebEnginePage::WebWindowType)
+{
+ TRACE_OBJ
+ HelpPage* newPage = static_cast(OpenPagesManager::instance()
+ ->createBlankPage()->page());
+ newPage->closeNewTabIfNeeded = closeNewTabIfNeeded;
+ closeNewTabIfNeeded = false;
+ return newPage;
+}
+
+void HelpPage::triggerAction(WebAction action, bool checked)
+{
+ TRACE_OBJ
+ switch (action) {
+ case OpenLinkInNewWindow:
+ closeNewTabIfNeeded = true;
+ Q_FALLTHROUGH();
+ default:
+ QWebEnginePage::triggerAction(action, checked);
+ break;
+ }
+
+#ifndef QT_NO_CLIPBOARD
+ if (action == CopyLinkToClipboard || action == CopyImageUrlToClipboard) {
+ const QString link = QApplication::clipboard()->text();
+ QApplication::clipboard()->setText(HelpEngineWrapper::instance().findFile(link).toString());
+ }
+#endif
+}
+
+bool HelpPage::acceptNavigationRequest(const QUrl &url, NavigationType type, bool /*isMainFrame*/)
+{
+ TRACE_OBJ
+ const bool closeNewTab = closeNewTabIfNeeded;
+ closeNewTabIfNeeded = false;
+
+ if (HelpViewer::launchWithExternalApp(url)) {
+ if (closeNewTab)
+ QMetaObject::invokeMethod(OpenPagesManager::instance(), "closeCurrentPage");
+ return false;
+ }
+
+ if (type == QWebEnginePage::NavigationTypeLinkClicked &&
+ (m_keyboardModifiers & Qt::ControlModifier || m_pressedButtons == Qt::MiddleButton)) {
+ m_pressedButtons = Qt::NoButton;
+ m_keyboardModifiers = Qt::NoModifier;
+ OpenPagesManager::instance()->createPage(url);
+ return false;
+ }
+
+ m_loadingUrl = url; // because of async page loading, we will hit some kind
+ // of race condition while using a remote command, like a combination of
+ // SetSource; SyncContent. SetSource would be called and SyncContents shortly
+ // afterwards, but the page might not have finished loading and the old url
+ // would be returned.
+ return true;
+}
+
+void HelpPage::upcomingLoad(const QUrl &url)
+{
+ m_loadingUrl = url;
+}
+
+// -- HelpViewer
+
+HelpViewer::HelpViewer(qreal zoom, QWidget *parent)
+ : QWebEngineView(parent)
+ , d(new HelpViewerPrivate)
+{
+ TRACE_OBJ
+ setAcceptDrops(false);
+ settings()->setAttribute(QWebEngineSettings::PluginsEnabled, false);
+ settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, true);
+ settings()->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, false);
+
+ HelpEngineWrapper::instance().ensureUrlSchemeHandler();
+ setPage(new HelpPage(this));
+
+ QAction* action = pageAction(QWebEnginePage::OpenLinkInNewWindow);
+ action->setText(tr("Open Link in New Page"));
+
+ pageAction(QWebEnginePage::DownloadLinkToDisk)->setVisible(false);
+ pageAction(QWebEnginePage::DownloadImageToDisk)->setVisible(false);
+
+ connect(pageAction(QWebEnginePage::Copy), SIGNAL(changed()), this,
+ SLOT(actionChanged()));
+ connect(pageAction(QWebEnginePage::Back), SIGNAL(changed()), this,
+ SLOT(actionChanged()));
+ connect(pageAction(QWebEnginePage::Forward), SIGNAL(changed()), this,
+ SLOT(actionChanged()));
+ connect(page(), SIGNAL(linkHovered(QString)), this,
+ SIGNAL(highlighted(QString)));
+ connect(this, SIGNAL(urlChanged(QUrl)), this, SIGNAL(sourceChanged(QUrl)));
+ connect(this, SIGNAL(loadStarted()), this, SLOT(setLoadStarted()));
+ connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setLoadFinished(bool)));
+ connect(this, SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged()));
+
+ setFont(viewerFont());
+ setZoomFactor(d->webDpiRatio * (zoom == 0.0 ? 1.0 : zoom));
+}
+
+QFont HelpViewer::viewerFont() const
+{
+ TRACE_OBJ
+ if (HelpEngineWrapper::instance().usesBrowserFont())
+ return HelpEngineWrapper::instance().browserFont();
+
+ QWebEngineSettings *webSettings = QWebEngineProfile::defaultProfile()->settings();
+ return QFont(webSettings->fontFamily(QWebEngineSettings::StandardFont),
+ webSettings->fontSize(QWebEngineSettings::DefaultFontSize));
+}
+
+void HelpViewer::setViewerFont(const QFont &font)
+{
+ TRACE_OBJ
+ QWebEngineSettings *webSettings = settings();
+ webSettings->setFontFamily(QWebEngineSettings::StandardFont, font.family());
+ webSettings->setFontSize(QWebEngineSettings::DefaultFontSize, font.pointSize());
+}
+
+void HelpViewer::scaleUp()
+{
+ TRACE_OBJ
+ setZoomFactor(zoomFactor() + 1./16);
+}
+
+void HelpViewer::scaleDown()
+{
+ TRACE_OBJ
+ setZoomFactor(qMax(1./16, zoomFactor() - 1./16));
+}
+
+void HelpViewer::resetScale()
+{
+ TRACE_OBJ
+ setZoomFactor(d->webDpiRatio);
+}
+
+qreal HelpViewer::scale() const
+{
+ TRACE_OBJ
+ return zoomFactor() / d->webDpiRatio;
+}
+
+QString HelpViewer::title() const
+{
+ TRACE_OBJ
+ return QWebEngineView::title();
+}
+
+void HelpViewer::setTitle(const QString &title)
+{
+ TRACE_OBJ
+ Q_UNUSED(title)
+}
+
+QUrl HelpViewer::source() const
+{
+ TRACE_OBJ
+ HelpPage *currentPage = static_cast (page());
+ if (currentPage && !d->m_loadFinished) {
+ // see HelpPage::acceptNavigationRequest(...)
+ return currentPage->m_loadingUrl;
+ }
+ return url();
+}
+
+void HelpViewer::setSource(const QUrl &url)
+{
+ TRACE_OBJ
+ if (url.toString() == QLatin1String("help"))
+ load(LocalHelpFile);
+ else {
+ // because of async page loading, we will hit some kind
+ // of race condition while using a remote command, like a combination of
+ // SetSource; SyncContent. SetSource would be called and SyncContents shortly
+ // afterwards, but the page might not have finished loading and the old url
+ // would be returned.
+ d->m_loadFinished = false;
+ static_cast(page())->upcomingLoad(url);
+ load(url);
+ }
+}
+
+QString HelpViewer::selectedText() const
+{
+ TRACE_OBJ
+ return QWebEngineView::selectedText();
+}
+
+bool HelpViewer::isForwardAvailable() const
+{
+ TRACE_OBJ
+ return pageAction(QWebEnginePage::Forward)->isEnabled();
+}
+
+bool HelpViewer::isBackwardAvailable() const
+{
+ TRACE_OBJ
+ return pageAction(QWebEnginePage::Back)->isEnabled();
+}
+
+bool HelpViewer::findText(const QString &text, FindFlags flags, bool incremental, bool fromSearch)
+{
+ Q_UNUSED(incremental)
+ Q_UNUSED(fromSearch)
+ QWebEnginePage::FindFlags webEngineFlags(0);
+ if (flags & FindBackward)
+ webEngineFlags |= QWebEnginePage::FindBackward;
+ if (flags & FindCaseSensitively)
+ webEngineFlags |= QWebEnginePage::FindCaseSensitively;
+ // QWebEngineView's findText is asynchronous, and the variant taking a callback runs the
+ // callback on the main thread, so blocking here becomes ugly too
+ // So we just claim that the search succeeded
+ QWebEngineView::findText(text, webEngineFlags);
+ return true;
+}
+
+// -- public slots
+
+#ifndef QT_NO_CLIPBOARD
+void HelpViewer::copy()
+{
+ TRACE_OBJ
+ triggerPageAction(QWebEnginePage::Copy);
+}
+#endif
+
+void HelpViewer::forward()
+{
+ TRACE_OBJ
+ QWebEngineView::forward();
+}
+
+void HelpViewer::backward()
+{
+ TRACE_OBJ
+ back();
+}
+
+// -- protected
+
+void HelpViewer::keyPressEvent(QKeyEvent *e)
+{
+ TRACE_OBJ
+ // TODO: remove this once we support multiple keysequences per command
+#ifndef QT_NO_CLIPBOARD
+ if (e->key() == Qt::Key_Insert && e->modifiers() == Qt::CTRL) {
+ if (!selectedText().isEmpty())
+ copy();
+ }
+#endif
+ QWebEngineView::keyPressEvent(e);
+}
+
+void HelpViewer::wheelEvent(QWheelEvent *event)
+{
+ TRACE_OBJ
+ if (event->modifiers() & Qt::ControlModifier) {
+ event->accept();
+ event->angleDelta().y() > 0 ? scaleUp() : scaleDown();
+ } else {
+ QWebEngineView::wheelEvent(event);
+ }
+}
+
+void HelpViewer::mousePressEvent(QMouseEvent *event)
+{
+ TRACE_OBJ
+#ifdef Q_OS_LINUX
+ if (handleForwardBackwardMouseButtons(event))
+ return;
+#endif
+
+ if (HelpPage *currentPage = static_cast (page())) {
+ currentPage->m_pressedButtons = event->buttons();
+ currentPage->m_keyboardModifiers = event->modifiers();
+ }
+
+ QWebEngineView::mousePressEvent(event);
+}
+
+void HelpViewer::mouseReleaseEvent(QMouseEvent *event)
+{
+ TRACE_OBJ
+#ifndef Q_OS_LINUX
+ if (handleForwardBackwardMouseButtons(event))
+ return;
+#endif
+
+ if (HelpPage *currentPage = static_cast (page())) {
+ currentPage->m_pressedButtons = event->buttons();
+ currentPage->m_keyboardModifiers = event->modifiers();
+ }
+
+ QWebEngineView::mouseReleaseEvent(event);
+}
+
+void HelpViewer::resizeEvent(QResizeEvent *e)
+{
+ //const int topTextPosition = cursorForPosition({width() / 2, 0}).position();
+ QWebEngineView::resizeEvent(e);
+ //scrollToTextPosition(topTextPosition);
+}
+
+// -- private slots
+
+void HelpViewer::actionChanged()
+{
+ TRACE_OBJ
+ QAction *a = qobject_cast(sender());
+ if (a == pageAction(QWebEnginePage::Copy))
+ emit copyAvailable(a->isEnabled());
+ else if (a == pageAction(QWebEnginePage::Back))
+ emit backwardAvailable(a->isEnabled());
+ else if (a == pageAction(QWebEnginePage::Forward))
+ emit forwardAvailable(a->isEnabled());
+}
+
+// -- private
+
+bool HelpViewer::eventFilter(QObject *obj, QEvent *event)
+{
+ TRACE_OBJ
+ return QWebEngineView::eventFilter(obj, event);
+}
+
+void HelpViewer::contextMenuEvent(QContextMenuEvent *event)
+{
+ TRACE_OBJ
+ QWebEngineView::contextMenuEvent(event);
+}
+
+QT_END_NAMESPACE
diff --git a/src/assistant/assistant/helpviewer_qwv.cpp b/src/assistant/assistant/helpviewer_qwv.cpp
index f8acb7b46d..7ed073eb85 100644
--- a/src/assistant/assistant/helpviewer_qwv.cpp
+++ b/src/assistant/assistant/helpviewer_qwv.cpp
@@ -101,7 +101,7 @@ void HelpPage::triggerAction(WebAction action, bool checked)
break;
}
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
if (action == CopyLinkToClipboard || action == CopyImageUrlToClipboard) {
const QString link = QApplication::clipboard()->text();
QApplication::clipboard()->setText(HelpEngineWrapper::instance().findFile(link).toString());
@@ -124,11 +124,12 @@ bool HelpPage::acceptNavigationRequest(QWebFrame *,
}
if (type == QWebPage::NavigationTypeLinkClicked
- && (m_keyboardModifiers & Qt::ControlModifier || m_pressedButtons == Qt::MidButton)) {
- m_pressedButtons = Qt::NoButton;
- m_keyboardModifiers = Qt::NoModifier;
- OpenPagesManager::instance()->createPage(url);
- return false;
+ && (m_keyboardModifiers & Qt::ControlModifier
+ || m_pressedButtons == Qt::MiddleButton)) {
+ m_pressedButtons = Qt::NoButton;
+ m_keyboardModifiers = Qt::NoModifier;
+ OpenPagesManager::instance()->createPage(url);
+ return false;
}
m_loadingUrl = url; // because of async page loading, we will hit some kind
@@ -166,8 +167,10 @@ HelpViewer::HelpViewer(qreal zoom, QWidget *parent)
SLOT(actionChanged()));
connect(pageAction(QWebPage::Forward), SIGNAL(changed()), this,
SLOT(actionChanged()));
- connect(page(), SIGNAL(linkHovered(QString,QString,QString)), this,
- SIGNAL(highlighted(QString)));
+ connect(page(), &QWebPage::linkHovered, this,
+ [this] (const QString &link, const QString &, const QString &) {
+ emit this->highlighted(QUrl(link));
+ });
connect(this, SIGNAL(urlChanged(QUrl)), this, SIGNAL(sourceChanged(QUrl)));
connect(this, SIGNAL(loadStarted()), this, SLOT(setLoadStarted()));
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setLoadFinished(bool)));
@@ -288,7 +291,7 @@ bool HelpViewer::findText(const QString &text, FindFlags flags, bool incremental
// -- public slots
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
void HelpViewer::copy()
{
TRACE_OBJ
@@ -314,7 +317,7 @@ void HelpViewer::keyPressEvent(QKeyEvent *e)
{
TRACE_OBJ
// TODO: remove this once we support multiple keysequences per command
-#ifndef QT_NO_CLIPBOARD
+#if QT_CONFIG(clipboard)
if (e->key() == Qt::Key_Insert && e->modifiers() == Qt::CTRL) {
if (!selectedText().isEmpty())
copy();
diff --git a/src/assistant/assistant/indexwindow.cpp b/src/assistant/assistant/indexwindow.cpp
index d8c0f8212e..5e7ece6cbe 100644
--- a/src/assistant/assistant/indexwindow.cpp
+++ b/src/assistant/assistant/indexwindow.cpp
@@ -44,6 +44,8 @@
#include
#include
+#include
+#include
QT_BEGIN_NAMESPACE
@@ -71,10 +73,12 @@ IndexWindow::IndexWindow(QWidget *parent)
this, &IndexWindow::disableSearchLineEdit);
connect(helpEngine.indexModel(), &QHelpIndexModel::indexCreated,
this, &IndexWindow::enableSearchLineEdit);
- connect(m_indexWidget, &QHelpIndexWidget::linkActivated,
- this, &IndexWindow::linkActivated);
- connect(m_indexWidget, &QHelpIndexWidget::linksActivated,
- this, &IndexWindow::linksActivated);
+ connect(m_indexWidget, &QHelpIndexWidget::documentActivated,
+ this, [this](const QHelpLink &link) {
+ emit linkActivated(link.url);
+ });
+ connect(m_indexWidget, &QHelpIndexWidget::documentsActivated,
+ this, &IndexWindow::documentsActivated);
connect(m_searchLineEdit, &QLineEdit::returnPressed,
m_indexWidget, &QHelpIndexWidget::activateCurrentItem);
layout->addWidget(m_indexWidget);
@@ -147,7 +151,7 @@ bool IndexWindow::eventFilter(QObject *obj, QEvent *e)
if (idx.isValid()) {
Qt::MouseButtons button = mouseEvent->button();
if (((button == Qt::LeftButton) && (mouseEvent->modifiers() & Qt::ControlModifier))
- || (button == Qt::MidButton)) {
+ || (button == Qt::MiddleButton)) {
open(m_indexWidget, idx);
}
}
@@ -196,15 +200,15 @@ void IndexWindow::open(QHelpIndexWidget* indexWidget, const QModelIndex &index)
QHelpIndexModel *model = qobject_cast(indexWidget->model());
if (model) {
const QString keyword = model->data(index, Qt::DisplayRole).toString();
- const QMap links = model->linksForKeyword(keyword);
+ const QList docs = model->helpEngine()->documentsForKeyword(keyword);
QUrl url;
- if (links.count() > 1) {
- TopicChooser tc(this, keyword, links);
+ if (docs.count() > 1) {
+ TopicChooser tc(this, keyword, docs);
if (tc.exec() == QDialog::Accepted)
url = tc.link();
- } else if (!links.isEmpty()) {
- url = links.first();
+ } else if (!docs.isEmpty()) {
+ url = docs.first().url;
} else {
return;
}
diff --git a/src/assistant/assistant/indexwindow.h b/src/assistant/assistant/indexwindow.h
index 647d3b3b95..b20531799b 100644
--- a/src/assistant/assistant/indexwindow.h
+++ b/src/assistant/assistant/indexwindow.h
@@ -37,10 +37,12 @@ QT_BEGIN_NAMESPACE
class QHelpIndexWidget;
class QModelIndex;
+struct QHelpLink;
class IndexWindow : public QWidget
{
Q_OBJECT
+ Q_MOC_INCLUDE()
public:
IndexWindow(QWidget *parent = nullptr);
@@ -54,8 +56,7 @@ class IndexWindow : public QWidget
signals:
void linkActivated(const QUrl &link);
- void linksActivated(const QMap &links,
- const QString &keyword);
+ void documentsActivated(const QList &documents, const QString &keyword);
void escapePressed();
private slots:
diff --git a/src/assistant/assistant/main.cpp b/src/assistant/assistant/main.cpp
index 3ddbdbc29e..b5d8ddfe2d 100644
--- a/src/assistant/assistant/main.cpp
+++ b/src/assistant/assistant/main.cpp
@@ -49,13 +49,16 @@
#include
#endif
+#if defined(BROWSER_QTWEBENGINE)
+#include
+#endif
+
#include "../shared/collectionconfiguration.h"
#include "helpenginewrapper.h"
#include "mainwindow.h"
#include "cmdlineparser.h"
// #define TRACING_REQUESTED
-// #define DEBUG_TRANSLATIONS
QT_USE_NAMESPACE
@@ -241,93 +244,64 @@ bool unregisterDocumentation(QHelpEngineCore &collection,
void setupTranslation(const QString &fileName, const QString &dir)
{
QTranslator *translator = new QTranslator(QCoreApplication::instance());
- if (translator->load(fileName, dir))
+ if (translator->load(QLocale(), fileName, QLatin1String("_"), dir))
QCoreApplication::installTranslator(translator);
-#ifdef DEBUG_TRANSLATIONS
- else if (!fileName.endsWith(QLatin1String("en_US"))
- && !fileName.endsWith(QLatin1String("_C"))) {
- qDebug("Could not load translation file %s in directory %s.",
- qPrintable(fileName), qPrintable(dir));
- }
-#endif
}
void setupTranslations()
{
TRACE_OBJ
- const QString& locale = QLocale::system().name();
const QString &resourceDir
- = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
- setupTranslation(QLatin1String("assistant_") + locale, resourceDir);
- setupTranslation(QLatin1String("qt_") + locale, resourceDir);
- setupTranslation(QLatin1String("qt_help_") + locale, resourceDir);
+ = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
+ setupTranslation(QLatin1String("assistant"), resourceDir);
+ setupTranslation(QLatin1String("qt"), resourceDir);
+ setupTranslation(QLatin1String("qt_help"), resourceDir);
}
} // Anonymous namespace.
-int main(int argc, char *argv[])
-{
- QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
- QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
- QCoreApplication::setAttribute(Qt::AA_DisableWindowContextHelpButton);
- TRACE_OBJ
- QScopedPointer a(createApplication(argc, argv));
-#if QT_CONFIG(library)
- a->addLibraryPath(a->applicationDirPath() + QLatin1String("/plugins"));
-#endif
- setupTranslations();
-
-#if defined(BROWSER_QTWEBKIT)
- if (qobject_cast(a.data())) {
- QFont f;
- f.setStyleHint(QFont::SansSerif);
- QWebSettings::globalSettings()->setFontFamily(QWebSettings::StandardFont, f.defaultFamily());
- }
-#endif // BROWSER_QTWEBKIT
-
- // Parse arguments.
- CmdLineParser cmd(a->arguments());
- CmdLineParser::Result res = cmd.parse();
- if (res == CmdLineParser::Help)
- return 0;
- else if (res == CmdLineParser::Error)
- return -1;
+enum ExitStatus {
+ ExitSuccess = 0,
+ ExitFailure,
+ NoExit
+};
+static ExitStatus preliminarySetup(CmdLineParser *cmd)
+{
/*
* Create the collection objects that we need. We always have the
* cached collection file. Depending on whether the user specified
* one, we also may have an input collection file.
*/
- const QString collectionFile = cmd.collectionFile();
+ const QString collectionFile = cmd->collectionFile();
const bool collectionFileGiven = !collectionFile.isEmpty();
QScopedPointer collection;
if (collectionFileGiven) {
collection.reset(new QHelpEngineCore(collectionFile));
- collection->setProperty("_q_readonly", QVariant::fromValue(true));
if (!collection->setupData()) {
- cmd.showMessage(QCoreApplication::translate("Assistant",
- "Error reading collection file '%1': %2.").
- arg(collectionFile).arg(collection->error()), true);
- return EXIT_FAILURE;
+ cmd->showMessage(QCoreApplication::translate("Assistant",
+ "Error reading collection file '%1': %2.")
+ .arg(collectionFile).arg(collection->error()), true);
+ return ExitFailure;
}
}
const QString &cachedCollectionFile = collectionFileGiven
- ? constructCachedCollectionFilePath(*collection)
- : MainWindow::defaultHelpCollectionFileName();
+ ? constructCachedCollectionFilePath(*collection)
+ : MainWindow::defaultHelpCollectionFileName();
if (collectionFileGiven && !QFileInfo(cachedCollectionFile).exists()
- && !collection->copyCollectionFile(cachedCollectionFile)) {
- cmd.showMessage(QCoreApplication::translate("Assistant",
- "Error creating collection file '%1': %2.").
- arg(cachedCollectionFile).arg(collection->error()), true);
- return EXIT_FAILURE;
+ && !collection->copyCollectionFile(cachedCollectionFile)) {
+ cmd->showMessage(QCoreApplication::translate("Assistant",
+ "Error creating collection file '%1': %2.")
+ .arg(cachedCollectionFile).arg(collection->error()), true);
+ return ExitFailure;
}
QHelpEngineCore cachedCollection(cachedCollectionFile);
if (!cachedCollection.setupData()) {
- cmd.showMessage(QCoreApplication::translate("Assistant",
- "Error reading collection file '%1': %2.").
- arg(cachedCollectionFile).
- arg(cachedCollection.error()), true);
- return EXIT_FAILURE;
+ cmd->showMessage(QCoreApplication::translate("Assistant",
+ "Error reading collection file '%1': %2.")
+ .arg(cachedCollectionFile)
+ .arg(cachedCollection.error()), true);
+ return ExitFailure;
}
stripNonexistingDocs(cachedCollection);
@@ -335,56 +309,98 @@ int main(int argc, char *argv[])
if (CollectionConfiguration::isNewer(*collection, cachedCollection))
CollectionConfiguration::copyConfiguration(*collection,
cachedCollection);
- if (!synchronizeDocs(*collection, cachedCollection, cmd))
- return EXIT_FAILURE;
+ if (!synchronizeDocs(*collection, cachedCollection, *cmd))
+ return ExitFailure;
}
- if (cmd.registerRequest() != CmdLineParser::None) {
+ if (cmd->registerRequest() != CmdLineParser::None) {
const QStringList &cachedDocs =
- cachedCollection.registeredDocumentations();
+ cachedCollection.registeredDocumentations();
const QString &namespaceName =
- QHelpEngineCore::namespaceName(cmd.helpFile());
- if (cmd.registerRequest() == CmdLineParser::Register) {
+ QHelpEngineCore::namespaceName(cmd->helpFile());
+ if (cmd->registerRequest() == CmdLineParser::Register) {
if (collectionFileGiven
- && !registerDocumentation(*collection, cmd, true))
- return EXIT_FAILURE;
+ && !registerDocumentation(*collection, *cmd, true))
+ return ExitFailure;
if (!cachedDocs.contains(namespaceName)
- && !registerDocumentation(cachedCollection, cmd, !collectionFileGiven))
- return EXIT_FAILURE;
- return EXIT_SUCCESS;
+ && !registerDocumentation(cachedCollection, *cmd, !collectionFileGiven))
+ return ExitFailure;
+ return ExitSuccess;
}
- if (cmd.registerRequest() == CmdLineParser::Unregister) {
+ if (cmd->registerRequest() == CmdLineParser::Unregister) {
if (collectionFileGiven
- && !unregisterDocumentation(*collection, namespaceName, cmd, true))
- return EXIT_FAILURE;
+ && !unregisterDocumentation(*collection, namespaceName, *cmd, true))
+ return ExitFailure;
if (cachedDocs.contains(namespaceName)
- && !unregisterDocumentation(cachedCollection, namespaceName,
- cmd, !collectionFileGiven))
- return EXIT_FAILURE;
- return EXIT_SUCCESS;
+ && !unregisterDocumentation(cachedCollection, namespaceName,
+ *cmd, !collectionFileGiven))
+ return ExitFailure;
+ return ExitSuccess;
}
}
- if (cmd.removeSearchIndex()) {
+ if (cmd->removeSearchIndex()) {
return removeSearchIndex(cachedCollectionFile)
- ? EXIT_SUCCESS : EXIT_FAILURE;
+ ? ExitSuccess : ExitFailure;
}
if (!QSqlDatabase::isDriverAvailable(QLatin1String("QSQLITE"))) {
- cmd.showMessage(QCoreApplication::translate("Assistant",
- "Cannot load sqlite database driver!"),
- true);
- return EXIT_FAILURE;
+ cmd->showMessage(QCoreApplication::translate("Assistant",
+ "Cannot load sqlite database driver!"),
+ true);
+ return ExitFailure;
}
- if (!cmd.currentFilter().isEmpty()) {
+ if (!cmd->currentFilter().isEmpty()) {
if (collectionFileGiven)
- collection->setCurrentFilter(cmd.currentFilter());
- cachedCollection.setCurrentFilter(cmd.currentFilter());
+ collection->setCurrentFilter(cmd->currentFilter());
+ cachedCollection.setCurrentFilter(cmd->currentFilter());
}
if (collectionFileGiven)
- cmd.setCollectionFile(cachedCollectionFile);
+ cmd->setCollectionFile(cachedCollectionFile);
+
+ return NoExit;
+}
+
+int main(int argc, char *argv[])
+{
+ TRACE_OBJ
+ QScopedPointer a(createApplication(argc, argv));
+#if QT_CONFIG(library)
+ a->addLibraryPath(a->applicationDirPath() + QLatin1String("/plugins"));
+#endif
+ setupTranslations();
+
+#if defined(BROWSER_QTWEBKIT)
+ if (qobject_cast(a.data())) {
+ QFont f;
+ f.setStyleHint(QFont::SansSerif);
+ QWebSettings::globalSettings()->setFontFamily(QWebSettings::StandardFont, f.defaultFamily());
+ }
+#endif // BROWSER_QTWEBKIT
+
+#if defined(BROWSER_QTWEBENGINE)
+ QWebEngineUrlScheme scheme(QByteArrayLiteral("qthelp"));
+ scheme.setSyntax(QWebEngineUrlScheme::Syntax::Path);
+ scheme.setFlags(QWebEngineUrlScheme::SecureScheme);
+ QWebEngineUrlScheme::registerScheme(scheme);
+#endif // BROWSER_QTWEBENGINE
+
+ // Parse arguments.
+ CmdLineParser cmd(a->arguments());
+ CmdLineParser::Result res = cmd.parse();
+ if (res == CmdLineParser::Help)
+ return 0;
+ else if (res == CmdLineParser::Error)
+ return -1;
+
+ const ExitStatus status = preliminarySetup(&cmd);
+ switch (status) {
+ case ExitFailure: return EXIT_FAILURE;
+ case ExitSuccess: return EXIT_SUCCESS;
+ default: break;
+ }
MainWindow *w = new MainWindow(&cmd);
w->show();
diff --git a/src/assistant/assistant/mainwindow.cpp b/src/assistant/assistant/mainwindow.cpp
index 2b9c87bbf0..7d3447a8fd 100644
--- a/src/assistant/assistant/mainwindow.cpp
+++ b/src/assistant/assistant/mainwindow.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Assistant of the Qt Toolkit.
@@ -58,13 +58,14 @@
#include
#include
-#include
-#include
-#include
-#include
+#include
#include
#include
#include
+#include
+
+#include
+#include
#include
#include
#include
@@ -72,7 +73,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -418,7 +418,7 @@ static const char *docs[] = {
static QStringList newQtDocumentation()
{
QStringList result;
- const QDir docDirectory(QLibraryInfo::location(QLibraryInfo::DocumentationPath));
+ const QDir docDirectory(QLibraryInfo::path(QLibraryInfo::DocumentationPath));
const QFileInfoList entries = docDirectory.entryInfoList(QStringList(QStringLiteral("*.qch")),
QDir::Files, QDir::Name);
if (!entries.isEmpty()) {
@@ -556,7 +556,9 @@ void MainWindow::setupActions()
tmp->setMenuRole(QAction::QuitRole);
menu = menuBar()->addMenu(tr("&Edit"));
+#if QT_CONFIG(clipboard)
menu->addAction(globalActions->copyAction());
+#endif
menu->addAction(globalActions->findAction());
QAction *findNextAction = menu->addAction(tr("Find &Next"),
@@ -610,12 +612,12 @@ void MainWindow::setupActions()
tmp = menu->addAction(tr("Next Page"),
openPages, &OpenPagesManager::nextPage);
tmp->setShortcuts(QList() << QKeySequence(tr("Ctrl+Alt+Right"))
- << QKeySequence(Qt::CTRL + Qt::Key_PageDown));
+ << QKeySequence(Qt::CTRL | Qt::Key_PageDown));
tmp = menu->addAction(tr("Previous Page"),
openPages, &OpenPagesManager::previousPage);
tmp->setShortcuts(QList() << QKeySequence(tr("Ctrl+Alt+Left"))
- << QKeySequence(Qt::CTRL + Qt::Key_PageUp));
+ << QKeySequence(Qt::CTRL | Qt::Key_PageUp));
const Qt::Modifier modifier =
#ifdef Q_OS_MAC
@@ -624,10 +626,10 @@ void MainWindow::setupActions()
Qt::CTRL;
#endif
- QShortcut *sct = new QShortcut(QKeySequence(modifier + Qt::Key_Tab), this);
+ QShortcut *sct = new QShortcut(QKeySequence(modifier | Qt::Key_Tab), this);
connect(sct, &QShortcut::activated,
openPages, &OpenPagesManager::nextPageWithSwitcher);
- sct = new QShortcut(QKeySequence(modifier + Qt::SHIFT + Qt::Key_Tab), this);
+ sct = new QShortcut(QKeySequence(modifier | Qt::SHIFT | Qt::Key_Tab), this);
connect(sct, &QShortcut::activated,
openPages, &OpenPagesManager::previousPageWithSwitcher);
@@ -650,7 +652,9 @@ void MainWindow::setupActions()
navigationBar->addAction(globalActions->homeAction());
navigationBar->addAction(m_syncAction);
navigationBar->addSeparator();
+#if QT_CONFIG(clipboard)
navigationBar->addAction(globalActions->copyAction());
+#endif
navigationBar->addAction(globalActions->printAction());
navigationBar->addAction(globalActions->findAction());
navigationBar->addSeparator();
@@ -668,8 +672,10 @@ void MainWindow::setupActions()
#endif
// content viewer connections
+#if QT_CONFIG(clipboard)
connect(m_centralWidget, &CentralWidget::copyAvailable,
globalActions, &GlobalActions::setCopyAvailable);
+#endif
connect(m_centralWidget, &CentralWidget::currentViewerChanged,
globalActions, &GlobalActions::updateActions);
connect(m_centralWidget, &CentralWidget::forwardAvailable,
@@ -677,12 +683,12 @@ void MainWindow::setupActions()
connect(m_centralWidget, &CentralWidget::backwardAvailable,
globalActions, &GlobalActions::updateActions);
connect(m_centralWidget, &CentralWidget::highlighted,
- this, [this](const QString &link) { statusBar()->showMessage(link);} );
+ this, [this](const QUrl &link) { statusBar()->showMessage(link.toString());} );
// index window
connect(m_indexWindow, &IndexWindow::linkActivated,
m_centralWidget, &CentralWidget::setSource);
- connect(m_indexWindow, &IndexWindow::linksActivated,
+ connect(m_indexWindow, &IndexWindow::documentsActivated,
this, &MainWindow::showTopicChooser);
connect(m_indexWindow, &IndexWindow::escapePressed,
this, &MainWindow::activateCurrentCentralWidgetTab);
@@ -739,7 +745,7 @@ void MainWindow::setupFilterToolbar()
connect(&helpEngine, &HelpEngineWrapper::setupFinished,
this, &MainWindow::setupFilterCombo, Qt::QueuedConnection);
- connect(m_filterCombo, QOverload::of(&QComboBox::activated),
+ connect(m_filterCombo, &QComboBox::activated,
this, &MainWindow::filterDocumentation);
connect(helpEngine.filterEngine(), &QHelpFilterEngine::filterActivated,
this, &MainWindow::currentFilterChanged);
@@ -822,11 +828,11 @@ void MainWindow::gotoAddress()
m_centralWidget->setSource(m_addressLineEdit->text());
}
-void MainWindow::showTopicChooser(const QMap &links,
+void MainWindow::showTopicChooser(const QList &documents,
const QString &keyword)
{
TRACE_OBJ
- TopicChooser tc(this, keyword, links);
+ TopicChooser tc(this, keyword, documents);
if (tc.exec() == QDialog::Accepted) {
m_centralWidget->setSource(tc.link());
}
@@ -842,7 +848,7 @@ void MainWindow::showPreferences()
m_centralWidget, &CentralWidget::updateBrowserFont);
connect(&dia, &PreferencesDialog::updateUserInterface,
m_centralWidget, &CentralWidget::updateUserInterface);
- dia.showDialog();
+ dia.exec();
}
void MainWindow::syncContents()
@@ -899,6 +905,8 @@ void MainWindow::showAboutDialog()
QByteArray resources;
#if defined(BROWSER_QTWEBKIT)
const QString browser = QStringLiteral("Qt WebKit");
+#elif defined(BROWSER_QTWEBENGINE)
+ const QString browser = QStringLiteral("Qt WebEngine");
#else
const QString browser = QStringLiteral("QTextBrowser");
#endif
@@ -907,7 +915,7 @@ void MainWindow::showAboutDialog()
"Version %2
"
"Browser: %3
"
"Copyright (C) %4 The Qt Company Ltd.
")
- .arg(tr("Qt Assistant"), QLatin1String(QT_VERSION_STR), browser, QStringLiteral("2019")),
+ .arg(tr("Qt Assistant"), QLatin1String(QT_VERSION_STR), browser, QStringLiteral("2021")),
resources);
QLatin1String path(":/qt-project.org/assistant/images/assistant-128.png");
aboutDia.setPixmap(QString(path));
diff --git a/src/assistant/assistant/mainwindow.h b/src/assistant/assistant/mainwindow.h
index c5bf5837e1..22983c7877 100644
--- a/src/assistant/assistant/mainwindow.h
+++ b/src/assistant/assistant/mainwindow.h
@@ -46,10 +46,12 @@ class ContentWindow;
class IndexWindow;
class QtDocInstaller;
class SearchWidget;
+struct QHelpLink;
class MainWindow : public QMainWindow
{
Q_OBJECT
+ Q_MOC_INCLUDE()
public:
explicit MainWindow(CmdLineParser *cmdLine, QWidget *parent = nullptr);
@@ -88,7 +90,7 @@ private slots:
void showNewAddress();
void showAboutDialog();
void showNewAddress(const QUrl &url);
- void showTopicChooser(const QMap &links, const QString &keyword);
+ void showTopicChooser(const QList &documents, const QString &keyword);
void updateApplicationFont();
void filterDocumentation(int filterIndex);
void setupFilterCombo();
diff --git a/src/assistant/assistant/openpageswidget.cpp b/src/assistant/assistant/openpageswidget.cpp
index 6400fd97d1..2be24c164a 100644
--- a/src/assistant/assistant/openpageswidget.cpp
+++ b/src/assistant/assistant/openpageswidget.cpp
@@ -52,8 +52,11 @@ void OpenPagesDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt
{
TRACE_OBJ
if (option.state & QStyle::State_MouseOver) {
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
if ((QApplication::mouseButtons() & Qt::LeftButton) == 0)
pressedIndex = QModelIndex();
+QT_WARNING_POP
QBrush brush = option.palette.alternateBase();
if (index == pressedIndex)
brush = option.palette.dark();
@@ -184,7 +187,7 @@ void OpenPagesWidget::handleClicked(const QModelIndex &index)
QWidget *vp = viewport();
const QPoint &cursorPos = QCursor::pos();
QMouseEvent e(QEvent::MouseMove, vp->mapFromGlobal(cursorPos), cursorPos,
- Qt::NoButton, nullptr, nullptr);
+ Qt::NoButton, {}, {});
QCoreApplication::sendEvent(vp, &e);
}
}
diff --git a/src/assistant/assistant/preferencesdialog.cpp b/src/assistant/assistant/preferencesdialog.cpp
index 7955e08dfc..9af0ff1889 100644
--- a/src/assistant/assistant/preferencesdialog.cpp
+++ b/src/assistant/assistant/preferencesdialog.cpp
@@ -28,42 +28,24 @@
#include "preferencesdialog.h"
#include "centralwidget.h"
-#include "filternamedialog.h"
#include "fontpanel.h"
#include "helpenginewrapper.h"
#include "openpagesmanager.h"
+#include "helpdocsettingswidget.h"
#include
+
#include
-#include
-#include
#include
#include
#include
-
-#include
+#include
#include
QT_BEGIN_NAMESPACE
-static QStringList versionsToStringList(const QList &versions)
-{
- QStringList versionList;
- for (const QVersionNumber &version : versions)
- versionList.append(version.isNull() ? QString() : version.toString());
- return versionList;
-}
-
-static QList stringListToVersions(const QStringList &versionList)
-{
- QList versions;
- for (const QString &versionString : versionList)
- versions.append(QVersionNumber::fromString(versionString));
- return versions;
-}
-
PreferencesDialog::PreferencesDialog(QWidget *parent)
: QDialog(parent)
, m_appFontChanged(false)
@@ -74,18 +56,6 @@ PreferencesDialog::PreferencesDialog(QWidget *parent)
{
m_ui.setupUi(this);
- QString resourcePath = QLatin1String(":/qt-project.org/assistant/images/");
-#ifdef Q_OS_MACOS
- resourcePath.append(QLatin1String("mac"));
-#else
- resourcePath.append(QLatin1String("win"));
-#endif
-
- m_ui.filterAddButton->setIcon(QIcon(resourcePath + QLatin1String("/plus.png")));
- m_ui.filterRemoveButton->setIcon(QIcon(resourcePath + QLatin1String("/minus.png")));
-
- // TODO: filter docs via lineedit
-
connect(m_ui.buttonBox->button(QDialogButtonBox::Ok), &QAbstractButton::clicked,
this, &PreferencesDialog::okClicked);
connect(m_ui.buttonBox->button(QDialogButtonBox::Apply), &QAbstractButton::clicked,
@@ -93,46 +63,30 @@ PreferencesDialog::PreferencesDialog(QWidget *parent)
connect(m_ui.buttonBox->button(QDialogButtonBox::Cancel), &QAbstractButton::clicked,
this, &QDialog::reject);
- m_originalSetup = readOriginalSetup();
- m_currentSetup = m_originalSetup;
+ m_docSettings = HelpDocSettings::readSettings(helpEngine.helpEngine());
if (m_hideDocsTab) {
m_ui.tabWidget->removeTab(m_ui.tabWidget->indexOf(m_ui.docsTab));
} else {
- connect(m_ui.docAddButton, &QAbstractButton::clicked,
- this, &PreferencesDialog::addDocumentation);
- connect(m_ui.docRemoveButton, &QAbstractButton::clicked,
- this, &PreferencesDialog::removeDocumentation);
+ connect(m_ui.docSettingsWidget, &HelpDocSettingsWidget::docSettingsChanged,
+ [this](const HelpDocSettings &settings) {
+ m_docSettings = settings;
+ if (m_hideFiltersTab)
+ return;
- updateDocumentationPage();
+ m_ui.filterSettingsWidget->setAvailableComponents(m_docSettings.components());
+ m_ui.filterSettingsWidget->setAvailableVersions(m_docSettings.versions());
+ });
+
+ m_ui.docSettingsWidget->setDocSettings(m_docSettings);
}
if (m_hideFiltersTab) {
m_ui.tabWidget->removeTab(m_ui.tabWidget->indexOf(m_ui.filtersTab));
} else {
- connect(m_ui.componentWidget, &OptionsWidget::optionSelectionChanged,
- this, &PreferencesDialog::componentsChanged);
- connect(m_ui.versionWidget, &OptionsWidget::optionSelectionChanged,
- this, &PreferencesDialog::versionsChanged);
- connect(m_ui.filterWidget, &QListWidget::currentItemChanged,
- this, &PreferencesDialog::filterSelected);
- connect(m_ui.filterWidget, &QListWidget::itemDoubleClicked,
- this, &PreferencesDialog::renameFilterClicked);
-
- // TODO: repeat these actions on context menu
- connect(m_ui.filterAddButton, &QAbstractButton::clicked,
- this, &PreferencesDialog::addFilterClicked);
- connect(m_ui.filterRenameButton, &QAbstractButton::clicked,
- this, &PreferencesDialog::renameFilterClicked);
- connect(m_ui.filterRemoveButton, &QAbstractButton::clicked,
- this, &PreferencesDialog::removeFilterClicked);
-
- m_ui.componentWidget->setNoOptionText(tr("No Component"));
- m_ui.componentWidget->setInvalidOptionText(tr("Invalid Component"));
- m_ui.versionWidget->setNoOptionText(tr("No Version"));
- m_ui.versionWidget->setInvalidOptionText(tr("Invalid Version"));
-
- updateFilterPage();
+ m_ui.filterSettingsWidget->setAvailableComponents(m_docSettings.components());
+ m_ui.filterSettingsWidget->setAvailableVersions(m_docSettings.versions());
+ m_ui.filterSettingsWidget->readSettings(helpEngine.filterEngine());
}
updateFontSettingsPage();
@@ -142,342 +96,6 @@ PreferencesDialog::PreferencesDialog(QWidget *parent)
setFont(helpEngine.appFont());
}
-PreferencesDialog::~PreferencesDialog()
-{
- if (m_appFontChanged) {
- helpEngine.setAppFont(m_appFontPanel->selectedFont());
- helpEngine.setUseAppFont(m_appFontPanel->isChecked());
- helpEngine.setAppWritingSystem(m_appFontPanel->writingSystem());
- emit updateApplicationFont();
- }
-
- if (m_browserFontChanged) {
- helpEngine.setBrowserFont(m_browserFontPanel->selectedFont());
- helpEngine.setUseBrowserFont(m_browserFontPanel->isChecked());
- helpEngine.setBrowserWritingSystem(m_browserFontPanel->writingSystem());
- emit updateBrowserFont();
- }
-
- QString homePage = m_ui.homePageLineEdit->text();
- if (homePage.isEmpty())
- homePage = QLatin1String("help");
- helpEngine.setHomePage(homePage);
-
- int option = m_ui.helpStartComboBox->currentIndex();
- helpEngine.setStartOption(option);
-}
-
-FilterSetup PreferencesDialog::readOriginalSetup() const
-{
- FilterSetup filterSetup;
-
- filterSetup.m_namespaceToComponent = helpEngine.filterEngine()->namespaceToComponent();
- filterSetup.m_namespaceToVersion = helpEngine.filterEngine()->namespaceToVersion();
- for (auto it = filterSetup.m_namespaceToComponent.constBegin();
- it != filterSetup.m_namespaceToComponent.constEnd(); ++it) {
- const QString namespaceName = it.key();
- const QString namespaceFileName = helpEngine.documentationFileName(namespaceName);
- filterSetup.m_namespaceToFileName.insert(namespaceName, namespaceFileName);
- filterSetup.m_fileNameToNamespace.insert(namespaceFileName, namespaceName);
- filterSetup.m_componentToNamespace[it.value()].append(namespaceName);
- }
- for (auto it = filterSetup.m_namespaceToVersion.constBegin();
- it != filterSetup.m_namespaceToVersion.constEnd(); ++it) {
- filterSetup.m_versionToNamespace[it.value()].append(it.key());
- }
-
- const QStringList allFilters = helpEngine.filterEngine()->filters();
- for (const QString &filter : allFilters)
- filterSetup.m_filterToData.insert(filter, helpEngine.filterEngine()->filterData(filter));
-
- filterSetup.m_currentFilter = helpEngine.filterEngine()->activeFilter();
-
- return filterSetup;
-}
-
-void PreferencesDialog::showDialog()
-{
- if (exec() != Accepted)
- m_appFontChanged = m_browserFontChanged = false;
-}
-
-void PreferencesDialog::updateFilterPage()
-{
- if (m_hideFiltersTab)
- return;
-
- QString currentFilter = m_itemToFilter.value(m_ui.filterWidget->currentItem());
- if (currentFilter.isEmpty())
- currentFilter = m_currentSetup.m_currentFilter;
-
- m_currentSetup = m_originalSetup;
-
- m_ui.filterWidget->clear();
- m_ui.componentWidget->clear();
- m_ui.versionWidget->clear();
- m_itemToFilter.clear();
- m_filterToItem.clear();
-
- for (const QString &filterName : m_currentSetup.m_filterToData.keys()) {
- QListWidgetItem *item = new QListWidgetItem(filterName);
- m_ui.filterWidget->addItem(item);
- m_itemToFilter.insert(item, filterName);
- m_filterToItem.insert(filterName, item);
- if (filterName == currentFilter)
- m_ui.filterWidget->setCurrentItem(item);
- }
-
- if (!m_ui.filterWidget->currentItem() && !m_filterToItem.isEmpty())
- m_ui.filterWidget->setCurrentItem(m_filterToItem.first());
-
- updateCurrentFilter();
-}
-
-void PreferencesDialog::updateCurrentFilter()
-{
- if (m_hideFiltersTab)
- return;
-
- const QString ¤tFilter = m_itemToFilter.value(m_ui.filterWidget->currentItem());
-
- const bool filterSelected = !currentFilter.isEmpty();
- m_ui.componentWidget->setEnabled(filterSelected);
- m_ui.versionWidget->setEnabled(filterSelected);
- m_ui.filterRenameButton->setEnabled(filterSelected);
- m_ui.filterRemoveButton->setEnabled(filterSelected);
-
- m_ui.componentWidget->setOptions(m_currentSetup.m_componentToNamespace.keys(),
- m_currentSetup.m_filterToData.value(currentFilter).components());
- m_ui.versionWidget->setOptions(versionsToStringList(m_currentSetup.m_versionToNamespace.keys()),
- versionsToStringList(m_currentSetup.m_filterToData.value(currentFilter).versions()));
-}
-
-void PreferencesDialog::updateDocumentationPage()
-{
- if (m_hideDocsTab)
- return;
-
- m_ui.registeredDocsListWidget->clear();
- m_namespaceToItem.clear();
- m_itemToNamespace.clear();
-
- for (const QString &namespaceName : m_currentSetup.m_namespaceToFileName.keys()) {
- QListWidgetItem *item = new QListWidgetItem(namespaceName);
- m_namespaceToItem.insert(namespaceName, item);
- m_itemToNamespace.insert(item, namespaceName);
- m_ui.registeredDocsListWidget->addItem(item);
- }
-}
-
-void PreferencesDialog::filterSelected(QListWidgetItem *item)
-{
- Q_UNUSED(item)
-
- updateCurrentFilter();
-}
-
-void PreferencesDialog::componentsChanged(const QStringList &components)
-{
- const QString ¤tFilter = m_itemToFilter.value(m_ui.filterWidget->currentItem());
- if (currentFilter.isEmpty())
- return;
-
- m_currentSetup.m_filterToData[currentFilter].setComponents(components);
-}
-
-void PreferencesDialog::versionsChanged(const QStringList &versions)
-{
- const QString ¤tFilter = m_itemToFilter.value(m_ui.filterWidget->currentItem());
- if (currentFilter.isEmpty())
- return;
-
- m_currentSetup.m_filterToData[currentFilter].setVersions(stringListToVersions(versions));
-}
-
-QString PreferencesDialog::suggestedNewFilterName(const QString &initialFilterName) const
-{
- QString newFilterName = initialFilterName;
-
- int counter = 1;
- while (m_filterToItem.contains(newFilterName)) {
- newFilterName = initialFilterName + QLatin1Char(' ')
- + QString::number(++counter);
- }
-
- return newFilterName;
-}
-
-QString PreferencesDialog::getUniqueFilterName(const QString &windowTitle,
- const QString &initialFilterName)
-{
- QString newFilterName = initialFilterName;
- while (1) {
- FilterNameDialog dialog(this);
- dialog.setWindowTitle(windowTitle);
- dialog.setFilterName(newFilterName);
- if (dialog.exec() == QDialog::Rejected)
- return QString();
-
- newFilterName = dialog.filterName();
- if (!m_filterToItem.contains(newFilterName))
- break;
-
- if (QMessageBox::warning(this, tr("Filter Exists"),
- tr("The filter \"%1\" already exists.")
- .arg(newFilterName),
- QMessageBox::Retry | QMessageBox::Cancel)
- == QMessageBox::Cancel) {
- return QString();
- }
- }
-
- return newFilterName;
-}
-
-void PreferencesDialog::addFilterClicked()
-{
- const QString newFilterName = getUniqueFilterName(tr("Add Filter"),
- suggestedNewFilterName(tr("New Filter")));
- if (newFilterName.isEmpty())
- return;
-
- addFilter(newFilterName);
-}
-
-void PreferencesDialog::renameFilterClicked()
-{
- const QString ¤tFilter = m_itemToFilter.value(m_ui.filterWidget->currentItem());
- if (currentFilter.isEmpty())
- return;
-
- const QString newFilterName = getUniqueFilterName(tr("Rename Filter"), currentFilter);
- if (newFilterName.isEmpty())
- return;
-
- const QHelpFilterData oldFilterData = m_currentSetup.m_filterToData.value(currentFilter);
- removeFilter(currentFilter);
- addFilter(newFilterName, oldFilterData);
-
- if (m_currentSetup.m_currentFilter == currentFilter)
- m_currentSetup.m_currentFilter = newFilterName;
-}
-
-void PreferencesDialog::removeFilterClicked()
-{
- const QString ¤tFilter = m_itemToFilter.value(m_ui.filterWidget->currentItem());
- if (currentFilter.isEmpty())
- return;
-
- if (QMessageBox::question(this, tr("Remove Filter"),
- tr("Are you sure you want to remove the \"%1\" filter?")
- .arg(currentFilter),
- QMessageBox::Yes | QMessageBox::No)
- != QMessageBox::Yes) {
- return;
- }
-
- removeFilter(currentFilter);
-
- if (m_currentSetup.m_currentFilter == currentFilter)
- m_currentSetup.m_currentFilter.clear();
-}
-
-void PreferencesDialog::addFilter(const QString &filterName,
- const QHelpFilterData &filterData)
-{
- QListWidgetItem *item = new QListWidgetItem(filterName);
- m_currentSetup.m_filterToData.insert(filterName, filterData);
- m_filterToItem.insert(filterName, item);
- m_itemToFilter.insert(item, filterName);
- m_ui.filterWidget->insertItem(m_filterToItem.keys().indexOf(filterName), item);
-
- m_ui.filterWidget->setCurrentItem(item);
- updateCurrentFilter();
-}
-
-void PreferencesDialog::removeFilter(const QString &filterName)
-{
- QListWidgetItem *item = m_filterToItem.value(filterName);
- m_itemToFilter.remove(item);
- m_filterToItem.remove(filterName);
- delete item;
-
- m_currentSetup.m_filterToData.remove(filterName);
-}
-
-void PreferencesDialog::addDocumentation()
-{
- const QStringList &fileNames = QFileDialog::getOpenFileNames(this,
- tr("Add Documentation"), QString(), tr("Qt Compressed Help Files (*.qch)"));
- if (fileNames.isEmpty())
- return;
-
- bool added = false;
-
- for (const QString &fileName : fileNames) {
- const QCompressedHelpInfo info = QCompressedHelpInfo::fromCompressedHelpFile(fileName);
- const QString namespaceName = info.namespaceName();
-
- if (m_currentSetup.m_namespaceToFileName.contains(namespaceName))
- continue;
-
- if (m_currentSetup.m_fileNameToNamespace.contains(fileName))
- continue;
-
- const QString component = info.component();
- const QVersionNumber version = info.version();
-
- m_currentSetup.m_namespaceToFileName.insert(namespaceName, fileName);
- m_currentSetup.m_fileNameToNamespace.insert(fileName, namespaceName);
-
- m_currentSetup.m_namespaceToComponent.insert(namespaceName, component);
- m_currentSetup.m_componentToNamespace[component].append(namespaceName);
-
- m_currentSetup.m_namespaceToVersion.insert(namespaceName, version);
- m_currentSetup.m_versionToNamespace[version].append(namespaceName);
-
- QListWidgetItem *item = new QListWidgetItem(namespaceName);
- m_namespaceToItem.insert(namespaceName, item);
- m_itemToNamespace.insert(item, namespaceName);
- m_ui.registeredDocsListWidget->insertItem(m_namespaceToItem.keys().indexOf(namespaceName), item);
-
- added = true;
- }
-
- if (added)
- updateCurrentFilter();
-}
-
-void PreferencesDialog::removeDocumentation()
-{
- const QList selectedItems = m_ui.registeredDocsListWidget->selectedItems();
- if (selectedItems.isEmpty())
- return;
-
- for (QListWidgetItem *item : selectedItems) {
- const QString namespaceName = m_itemToNamespace.value(item);
- m_itemToNamespace.remove(item);
- m_namespaceToItem.remove(namespaceName);
- delete item;
-
- const QString fileName = m_currentSetup.m_namespaceToFileName.value(namespaceName);
- const QString component = m_currentSetup.m_namespaceToComponent.value(namespaceName);
- const QVersionNumber version = m_currentSetup.m_namespaceToVersion.value(namespaceName);
- m_currentSetup.m_namespaceToComponent.remove(namespaceName);
- m_currentSetup.m_namespaceToVersion.remove(namespaceName);
- m_currentSetup.m_namespaceToFileName.remove(namespaceName);
- m_currentSetup.m_fileNameToNamespace.remove(fileName);
- m_currentSetup.m_componentToNamespace[component].removeOne(namespaceName);
- if (m_currentSetup.m_componentToNamespace[component].isEmpty())
- m_currentSetup.m_componentToNamespace.remove(component);
- m_currentSetup.m_versionToNamespace[version].removeOne(namespaceName);
- if (m_currentSetup.m_versionToNamespace[version].isEmpty())
- m_currentSetup.m_versionToNamespace.remove(version);
- }
-
- updateCurrentFilter();
-}
-
void PreferencesDialog::okClicked()
{
applyChanges();
@@ -487,74 +105,27 @@ void PreferencesDialog::okClicked()
void PreferencesDialog::applyClicked()
{
applyChanges();
- m_originalSetup = readOriginalSetup();
- m_currentSetup = m_originalSetup;
- updateDocumentationPage();
- updateFilterPage();
-}
-template
-static QMap subtract(const QMap &minuend,
- const QMap &subtrahend)
-{
- QMap result = minuend;
+ m_docSettings = HelpDocSettings::readSettings(helpEngine.helpEngine());
- for (auto itSubtrahend = subtrahend.cbegin(); itSubtrahend != subtrahend.cend(); ++itSubtrahend) {
- auto itResult = result.find(itSubtrahend.key());
- if (itResult != result.end() && itSubtrahend.value() == itResult.value())
- result.erase(itResult);
+ if (!m_hideDocsTab)
+ m_ui.docSettingsWidget->setDocSettings(m_docSettings);
+ if (!m_hideFiltersTab) {
+ m_ui.filterSettingsWidget->setAvailableComponents(m_docSettings.components());
+ m_ui.filterSettingsWidget->setAvailableVersions(m_docSettings.versions());
+ m_ui.filterSettingsWidget->readSettings(helpEngine.filterEngine());
}
-
- return result;
}
void PreferencesDialog::applyChanges()
{
bool changed = false;
-
- const QMap docsToRemove = subtract(
- m_originalSetup.m_namespaceToFileName,
- m_currentSetup.m_namespaceToFileName);
- const QMap docsToAdd = subtract(
- m_currentSetup.m_namespaceToFileName,
- m_originalSetup.m_namespaceToFileName);
-
- for (const QString &namespaceName : docsToRemove.keys()) {
- if (!helpEngine.unregisterDocumentation(namespaceName))
- qWarning() << "Cannot unregister documentation:" << namespaceName;
- changed = true;
- }
-
- for (const QString &fileName : docsToAdd.values()) {
- if (!helpEngine.registerDocumentation(fileName))
- qWarning() << "Cannot register documentation file:" << fileName;
- changed = true;
- }
-
- const QMap filtersToRemove = subtract(
- m_originalSetup.m_filterToData,
- m_currentSetup.m_filterToData);
- const QMap filtersToAdd = subtract(
- m_currentSetup.m_filterToData,
- m_originalSetup.m_filterToData);
-
- const QString ¤tFilter = helpEngine.filterEngine()->activeFilter();
-
- for (const QString &filter : filtersToRemove.keys()) {
- helpEngine.filterEngine()->removeFilter(filter);
- if (currentFilter == filter && !filtersToAdd.contains(filter))
- helpEngine.filterEngine()->setActiveFilter(QString());
- changed = true;
- }
-
- for (auto it = filtersToAdd.cbegin(); it != filtersToAdd.cend(); ++it) {
- helpEngine.filterEngine()->setFilterData(it.key(), it.value());
- changed = true;
- }
+ if (!m_hideDocsTab)
+ changed = HelpDocSettings::applySettings(helpEngine.helpEngine(), m_docSettings);
+ if (!m_hideFiltersTab)
+ changed = changed || m_ui.filterSettingsWidget->applySettings(helpEngine.filterEngine());
if (changed) {
- helpEngine.filterEngine()->setActiveFilter(m_currentSetup.m_currentFilter);
-
// In order to update the filtercombobox and indexwidget
// according to the new filter configuration.
helpEngine.setupData();
@@ -563,6 +134,30 @@ void PreferencesDialog::applyChanges()
helpEngine.setShowTabs(m_ui.showTabs->isChecked());
if (m_showTabs != m_ui.showTabs->isChecked())
emit updateUserInterface();
+
+ if (m_appFontChanged) {
+ helpEngine.setAppFont(m_appFontPanel->selectedFont());
+ helpEngine.setUseAppFont(m_appFontPanel->isChecked());
+ helpEngine.setAppWritingSystem(m_appFontPanel->writingSystem());
+ emit updateApplicationFont();
+ m_appFontChanged = false;
+ }
+
+ if (m_browserFontChanged) {
+ helpEngine.setBrowserFont(m_browserFontPanel->selectedFont());
+ helpEngine.setUseBrowserFont(m_browserFontPanel->isChecked());
+ helpEngine.setBrowserWritingSystem(m_browserFontPanel->writingSystem());
+ emit updateBrowserFont();
+ m_browserFontChanged = false;
+ }
+
+ QString homePage = m_ui.homePageLineEdit->text();
+ if (homePage.isEmpty())
+ homePage = QLatin1String("help");
+ helpEngine.setHomePage(homePage);
+
+ const int option = m_ui.helpStartComboBox->currentIndex();
+ helpEngine.setStartOption(option);
}
void PreferencesDialog::updateFontSettingsPage()
@@ -605,13 +200,13 @@ void PreferencesDialog::updateFontSettingsPage()
const QList &appCombos = m_appFontPanel->findChildren