Commit Graph

9 Commits

Author SHA1 Message Date
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
Axel Spoerl 59c784dff2 Documentviewer demo: Reset AbstractView::m_printingEnabled in cleanup
m_printingEnabled wasn't reset in AbstractViewer::cleanup().
That prevented the printingEnabledChanged() signal from being fired,
when a viewer displayed a printable document from the 2nd time onward.

Always disable printing in the cleanup() method.

Fixes: QTBUG-125057
Pick-to: 6.7
Change-Id: I7d237a27a3547103ef0ce099a0735b2444bc0248
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-05-08 09:45:55 +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
Axel Spoerl 459e09b485 Documentviewer demo: Centralize disconnect
Viewer plugins may connect to the central back/forward buttons.
If they disconnect those explicitly in their cleanup methods, the
buttons are nullptr when the application is closed. This lead to a
warning.

Save the QMetaObject::Connection object in a list in Abstractviewer
and directly disconnect it from AbstractViewer::cleanup. That way,
QObject::disconnect is never called with a nullptr argument.

Amends 1f6505a0cf.

Pick-to: 6.6
Change-Id: I4fee76d507f3329fef31e6c9171694ea82914239
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2023-10-20 10:39:09 +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 01b7e2d091 DocumentViewer demo: Make plugins re-usable
The DocumentViewer demo was originally developed as a self-contained
application. Its dependency to PdfWidgets has lead to splitting it up
into plugins: ba61af0bf3

The new architecture re-uses the viewer objects, but it doesn't reset
them properly. This is why viewer-specific UI-assets (menus, toolbars
and buttons) get duplicated.

This patch adds cleanup functionality and removes duplications.

Fixes: QTBUG-114615
Fixes: QTBUG-114617
Pick-to: 6.6
Change-Id: I4f123f8a69be978f992531603b15de71069d5a66
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-06-20 09:18:32 +02:00
Axel Spoerl c8b3c09355 Documentviewer Demo: Turn AbstractViewer class into static library
abstractviewer.cpp is compiled 3 times, once for each plugin.
That leads to duplicate symbol compiler warnings on macOS and makes
the demo unusable on macOS.

This patch turns the class in to a static library and links it into
the plugins.

Fixes: QTBUG-114370
Fixes: QTBUG-114618
Pick-to: 6.6
Change-Id: I7c785e4d463bc908c8df707f1a45301731c4da35
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-06-19 19:47: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