Commit Graph

22 Commits

Author SHA1 Message Date
Masoud Jami 573e557ae6 document viewer example: document the translation approach
This patch adds the documentation for the translation approach of
the document viewer example.

Pick-to: 6.10
Change-Id: Iae31d9c6278630347f331631c107259a470257dc
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2025-08-05 10:34:33 +02:00
Kai Köhne a5deebcd48 documentviewer: Provide macOS bundle metadata
Name the bundle 'Document Viewer.app', and provide more
metadata for the Info.plist file.

Pick-to: 6.10
Change-Id: I4de88c1b272477b67c645a682b756d6b134a5a19
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-07-11 20:03:25 +02:00
Kai Köhne a1ca013bb6 documentviewer: Clean up used Qt modules
We don't use svg's anymore in the example. Also, the official place
to look for qt_add_translations is Qt6LinguistTools, not Qt6Linguist.

Pick-to: 6.10
Change-Id: I5a4d8e9af739b2e8cb14e69a84f4127e520b3a50
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-07-10 14:21:21 +02:00
Kai Köhne 8f3d743da9 documentviewer: Clean up use of printsupport macro
* Do not use the QT_ prefix, as that is reserved for Qt itself,
  not client code (which an example is).
* Do not define the define on a global level, but as a PUBLIC
  target definition for the abstractviewer library.

Pick-to: 6.10
Change-Id: I01a001b0c0706e9f951118472fe1a62ff68a2e4e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-07-10 14:20:55 +02:00
Kai Köhne 1bc8cba0e2 Example: Use actual example name for project()
The project name is used in Qt Creator as root name for the project.
Using the same name as the documentation/example name makes it
clearer which example is actually open. Only drop prefixes like
'Qt Quick Demo - '.

Pick-to: 6.10
Change-Id: I863a23e26307a973bb04ce879d0c95c3731cdc53
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2025-07-09 08:58:58 +02:00
Kai Köhne 8ccc066721 documentviewer: Simplify qt_add_translation setup
* Define i18n languages centrally
* Use canonical :/i18n directory (default)

Change-Id: I7e8d9c57512418c51843464622ec270dea1b3456
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2025-05-15 09:50:55 +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
Alexey Edelev c50a9c9f02 Fix the order of adding subdirectories in documentviewer demo
Swap 'plugins' and 'app' subdirectories to make plugin targets visible
for the respective conditions.

Fixes: QTBUG-129080
Pick-to: 6.8 6.8.0 6.7
Change-Id: Iadea3e2199527cc530a4a4f9a24c98a8cf59d81d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-09-24 14:12:57 +00:00
Sami Shalayel 7b528c1723 documentviewer 3d plugin: use qt_add_qml_module
Use qt_add_qml_module for the document viewer demo 3d plugin.

Make the plugin qmllint clean by removing unused imports, unqualified
accesses and setting the ComponentBound behavior.

Use loadFromModule instead of setSource, and rename q3dViewer.qml to
Viewer.qml to be loadable. Same for queryMimeTypes.qml that is now
QueryMimeTypes.qml.

No doc or .pro files needed to be changed as the quick3d viewer plugin
has neither documentation nor qmake file.

Pick-to: 6.8
Task-number: QTBUG-100100
Change-Id: I723277d53ed4b7eb1353772928c6069919d0b4e9
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-07-10 08:45:45 +02:00
Alexandru Croitor cde9cfb96c CMake: Add deployment API to our examples
Projects were modified using the tool at:
https://git.qt.io/alcroito/cmake_refactor

Some examples had to be adapted manually, mostly those that build
additional qml modules / plugins.

documentviewer did not get the deployment api, because it's trickier.

Pick-to: 6.7
Task-number: QTBUG-101340
Task-number: QTBUG-102056
Task-number: QTBUG-102057
Change-Id: I76322185fc824c112d77e077ee39e7ccbc193a4c
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-05-13 09:44:04 +02:00
Lucie Gérard 8b36425fab Correct build system file license under example
According to QUIP-18 [1] all files under examples
should be licensed
LicenseRef-Qt-Commercial OR BSD-3-Clause

[1]: https://contribute.qt-project.org/quips/18

Pick-to: 6.7 6.7.0
Task-number: QTBUG-121787
Change-Id: Ia2e8f62af64a384196a9b0c02ac5b2fbf5404a8b
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2024-03-19 08:20:16 +01:00
Samuli Piippo 22315147d0 CMake: fix installation of demos projects
Projects need install instructions to be usable on embedded platforms.
Fix existing instructions to put files into correct places.

Fixes: QTBUG-112024
Pick-to: 6.7
Change-Id: I6a3d84edc1c67281d5497e99144c159faf0f783c
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Kimmo Ollila <kimmo.ollila@qt.io>
2024-01-25 15:13:29 +02: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
Friedemann Kleint 09cb56314c DocumentViewer demo: Actually build the PDF plugin
Pick-to: 6.6
Change-Id: I29f7dacd1c57d87505894e54918c5d2f53626378
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-07-05 09:06:11 +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 6d1c824061 DocumentViewer demo: Fix print support
Pick-to: 6.6
Change-Id: I1b9a73ee39838bef7b1d535d2ff99dfd0f71dea8
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-06-20 14:53:14 +02:00
Alexandru Croitor 0482f46a46 CMake: Clean up the CMakeLists.txt file a bit
Remove the commented out find_package.
Remove the redundant CMAKE_AUTOMOC assignment, because
qt_standard_project_setup was already called.

Pick-to: 6.5 6.6
Change-Id: I20f60541377153febd28413450b4af7b07d4e41c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-06-08 09:55:03 +02:00
Alexandru Croitor 54200de405 Fix build of documentviewer example
Due to a missing qt_standard_project_setup call, AUTOMOC was never
enabled which led to undefined symbol issues at link time.

Remove documentWasModified slot declaration because it didn't have a
definition, and it was not referenced by anything in the code.

Pick-to: 6.5 6.6
Fixes: QTBUG-114365
Change-Id: Ib6938163be1a1fdc0bb6f4a925878ec1b309d03e
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-06-08 09:55:01 +02:00
Axel Spoerl 7ae8a61df6 Documentviewer demo: Remove optional PrintSupport and PdfWidgets deps
This patch removes optional dependencies to eliminate compiler
errors/warnings.

Task-number: QTBUG-113377
Change-Id: I95707ccad30837093263d509a5617b2de4574962
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2023-05-05 13:16:33 +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
Axel Spoerl 9bba48e1ca Add Json, text and pdf document viewer demo
Add a demo with a combined viewer for Json, pdf and text documents.
The example demonstrates how to create an application, utilizing
a main window with static and dynamic toolbars, menus and actions.

Type specific viewers inherit from an abstract viewer class.
The Json viewer implements an abstract tree model for QJsonDocument.

The example demonstrates a few useful application features, implemented
with QtWidgets and QSettings, to (re)store properties:
- Detecting file content types with QMimeDatabase
- Changing and restoring override cursor when hovering over a widget.
- Basic printing support.

Pick-to: 6.5 6.5.0
Change-Id: Ie411669cfdbc41ac399cd1aed87e60722195c42c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-03-09 11:55:22 +01:00