Commit Graph

10 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
Friedemann Kleint 1c75be5290 documentviewer demo: Fix zoom actions
Use modern theme icons. Add standard shortcuts to the PDF
viewer actions. Remove duplicated adding to the toolbar.

Pick-to: 6.8
Change-Id: I4cfe33c7b8fcc3c070f5c0542b821dd9393bfe2d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-11-26 09:17:53 +01: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
Axel Spoerl 1f6505a0cf Documentviewer demo / PdfViewer: Disconnect forward/back buttons
Add missing disconnect statements in PdfViewer::cleanup().

Pick-to: 6.6
Change-Id: I48dbc14f7dc2105e6310f50e4d48afa66388aed4
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2023-10-09 17:30:16 +02:00
Marc Mutz 8ca6cd6c97 PdfViewer: port to new QPdfPageSelector API
QPdfPageSelector changed from being a QSpinBox to just a QWidget that
has-a QSpinBox. This code shows why that was a good idea: users are
supposed to call setDocument(), not manipulate QSpinBox::maxiumum()
manually.

Pick-to: 6.6 6.6.0
Fixes: QTBUG-116987
Change-Id: I35ed7786b7e257c8c9aba70671d739db02d7589d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-09-18 07:14:52 +00:00
Friedemann Kleint 5e62422bcc DocumentViewer demo: Small polish of the PDF plugin
Apply a few fixes that were already done for the other plugins.

Pick-to: 6.6
Change-Id: I3b94547023f77952a670cb7c0385b15e7ddd03ce
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-07-05 09:06:18 +02:00
Friedemann Kleint 843367eac0 DocumentViewer demo: Fix warnings about closed QIODevice when paging PDF
Apparently, QPdfViewer needs an open file.

Pick-to: 6.6
Change-Id: I891f6eeb5a96344bdfce483e77c67b80b1666676
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-07-05 09:06:14 +02:00
Axel Spoerl 3c4337653b Fix string literals, tr() usage and includes in PdfViewer
Re-order includes and replace const char * usage by tr() or string
literals.

Pick-to: 6.6
Change-Id: If8b21647c09621e4240bac63aafcae301a741367
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-06-21 00:50:04 +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 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