Commit Graph

13 Commits

Author SHA1 Message Date
Kai Köhne e31802fb15 documentviewer: Fix deployment for macOS, Windows, Linux
Adapt the logic to install and detect especially the
plugins libs:

* Do not just compile them into the app build folder, but
  keep the libs separate under the 'plugins' direcory
* At installation time, follow the logic of *deployqt
  for Qt plugins, and store them in CMAKE_INSTALL_PREFIX/plugins
  (Linux, Windows) or Document Viewer.app/Contents/Plugins
  (macOS).

Unfortunately, this all requires different look ups at runtime for
all operating systems. For macOS and Windows, we furthermore need
to check both for valid paths with an installed build, and an
un-installed build.

While at it, move the install logic to app/CMakeLists.txt, so that
there is less repetition.

An alternative approach would be to calculate the relative paths
at configure time, and either pass on command line or in a created
header file. Anyhow, the current approach is more compact.

Pick-to: 6.10
Fixes: QTBUG-138476
Change-Id: I467d3bd4e14ef6b8b747bceb7177837e2edd3b8c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-07-15 16:49:02 +02:00
Masoud Jami b743a98270 qtdoc: Extend documentviewer demo to use translations
This patch extends the documentviewer demo to use
text based translation for English and German, as follows:

- Add AbstractView::addTranslation(fileName) for inheriting
  plugin classes to optionally load own translations.

- Implement runtime translation switching. Provide option for
  plugins to benefit, if they implement their own runtime
  switching functionality.

Task-number: QTBUG-71856
Change-Id: Ic7782b7fa38d1121b140351f5eaa88ac027a6bcd
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2025-05-15 09:50:51 +02:00
Masoud Jami 600dfd439f qtdoc: Fix loading svg icons and txtviewer plugin in documentviewer demo
Apply a couple of fixes to load icons correctly and preventing seg fault
in loading txt files in the documentviewer demo.

Change-Id: I5c3e8694abe37140d73da8b40204bc05aaf37e9c
Pick-to: 6.9 6.8
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-04-23 10:54:29 +00:00
Axel Spoerl 94548822fe Documentviewer: Handle absence of QtQuick3D.AssetUtils
The documentviewer demo assumed, that Quick3D always comes with
AssetUtils installed. It attempted to create a RuntimeLoader instance
and asserted the result. This lead to a crash, when case AssetUtils were
not installed.

Don't assert, when no RuntimeLoader object can be instantiated. Return
an empty list of MIME types instead. Ignore plugins that don't support
any MIME types.

Fixes: QTBUG-128673
Pick-to: 6.8 6.8.0 6.7
Change-Id: Ib4771ba93dac2e0aab3a89b7e3cd7e64c97e4e5d
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2024-09-18 13:55:31 +02:00
Axel Spoerl 0e35a8eaf1 Plugin documentation: Refer to Document Viewer Demo
Update code snippets to use JsonViewer as an example.
Add a section about loading plugins.

Task-number: QTBUG-119981
Pick-to: 6.7
Change-Id: Ied3dcba02ad275d16535ab015c49ce03ec0a0e30
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-12-20 11:28:58 +01:00
Axel Spoerl 504e818821 Documentviewer demo: Add quick3d plugin
Add a plugin to show 3d files in QtQuick3D.

Change-Id: I0dcb51f0508a8f677a39f31cdb50f13890a635e5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-11-02 14:10:25 +00:00
Axel Spoerl 16d096709f Documentviewer demo: Darwin fixes
Remove definitions of onActionOpenTriggered() and
onActionQuitTriggered(), the implementation of which has been removed.

Change the required binary directory from "macOS" to "MacOS", to find
plugins correctly.

Fixes: QTBUG-117694
Pick-to: 6.6
Change-Id: Iba7d7c07e2881d2e8c4dce4b58f34a6441e8b467
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-04 15:26:39 +02:00
Axel Spoerl f906b6f0e6 Documentviewer Demo: fix plugin search on Windows
The plugin dlls are located in the "app" subdirectory of the
executable's path.

Search there.

Fixes: QTBUG-117691
Pick-to: 6.6 6.6.0
Change-Id: I467e90344e0a85384e8e06393fe41a98f1904bfc
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2023-10-02 07:01:58 +00:00
Friedemann Kleint 01505ae868 DocumentViewer demo: Remove unused <concepts> include
MSVC is complaining about it.

Pick-to: 6.6
Change-Id: Ifd85c48971cef5b62fbac4d1d5901a066c8d511c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-06-29 14:01:59 +02:00
Friedemann Kleint 6536439d44 DocumentViewer demo: Use modern string literals
This unearthes that JSON should convert from UTF-8.

Pick-to: 6.6
Change-Id: If155b745cac0579232b927a3988588204c31d207
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-06-21 15:04:51 +02:00
Friedemann Kleint e00a8ad305 DocumentViewer demo: Reorder includes
Remove unused forward declarations and includes; reorder by module.

Pick-to: 6.6
Change-Id: Id9468d1fdb2685df44f2b4a9407c6b12ac2859f3
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-06-20 16:04:26 +02:00
Axel Spoerl 394839e0d4 DocumentViewer demo: Warn about unsupported mime type before defaulting
When a file is opened and its mime type is not supported, the demo
falls back to TxtViewer.

This patch adds a warning popup to notify the user in that case.

Fixes: QTBUG-114614
Pick-to: 6.6
Change-Id: I5794d0013ecaac37934ac56c4a642998baa65e0a
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-06-20 04:37:17 +02:00
Axel Spoerl ba61af0bf3 Migrate documentviewer example into plugin based architecture
This patch changes the document viewer example to a plugin based
architecture.
It adapts the documentation accordingly.

Change-Id: Ia24028aa27e21fb8ab36f5ef3a9953be60858b19
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-05-02 10:11:06 +02:00