Commit Graph

11 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 7f9ff2d5cf Documentviewer demo: Exit application when no plugins were found
When building viewer plugins failed, the application could still be
launched and documents opened. This would crash the application with
a nullptr dereference.

Print a qWarning and exit application in MainWindow c'tor, when no
plugins were found.

Fixes: QTBUG-122041
Pick-to: 6.7 6.8
Change-Id: I92cd1678fdc3f88edc0f35347bd15c3e7c43f122
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-08-30 10:02:58 +00:00
Axel Spoerl 1857297f60 Documentviewer demo: Disconnect print related connections
The documentviewer demo re-uses its viewer plugins. It connects its
print button to the viewers' print functionalities, without keeping
track of the connections. That leads to double connects and crashes.

Store relevant connections in an array and disconnect them.

Fixes: QTBUG-121940
Pick-to: 6.7
Change-Id: Ifcef2097d874d6d37c7891bafc1805264282e984
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-02-15 09:39:58 +01:00
Friedemann Kleint 17e7109f01 Examples: Use consistent organization names and settings paths
Set the organization name to "QtProject".
Set an application name to Hangman to be used by QSettings.
Remove unused QSettings instance from Thermostat.
Let QSettings in Document Viewer use defaults.

Pick-to: 6.6
Change-Id: I8ebaeb444cd18bab95424f0efea670b02d41e657
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-07-04 13:43:26 +00:00
Friedemann Kleint d19a179e75 DocumentViewer demo: Remove unused variables
Pick-to: 6.6
Change-Id: I4d94bb8126749468fb28daa593390f1da0da6a7c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-07-03 16:10:36 +02:00
Axel Spoerl 5682c13aa8 DocumentViewer demo: Replace connect-by-name with explicit connect
Replace autoconnections with old_style_slot_names by explicit connect
statements with camelStyle.

Pick-to: 6.6
Change-Id: I1e1ddee064ee183c4baba3253c69eae7931ad459
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-06-21 21:41:59 +02:00
Friedemann Kleint 818c4b6468 DocumentViewer demo: Improve file dialog handling
Loop in the open dialog until opening the file
succeeds so that the directory is not reset.

Set a suffix for saving.

Pick-to: 6.6
Change-Id: Ic5a83d13148cfc16e5605abed7a2d965b6a6d149
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-06-20 16:05:10 +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
Alexandru Croitor 6b722fd0a0 Fix documentviewer namespace build
Sprinkle some QT_BEGIN_NAMESPACE in the right places to avoid build
failures.

Pick-to: 6.5 6.6
Change-Id: I9cbfadb414881ef32405f0ad99c1009e89466490
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-06-08 09:54:59 +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