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>
0ef5057f45 did remove the local project() for
app/CMakeLists.txt. As a side-effect, update_translations
now did search _all_ source files in the project for translatable
strings, including the plugin directory.
Avoid this by being explicit about the SOURCE_TARGETS.
Pick-to: 6.10
Change-Id: I0fad07b5aa8a89dfe8475faafc8c88acf55433cf
Reviewed-by: Masoud Jami <masoud.jami@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
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>
The toplevel CMakeLists.txt file already states we need Qt 6.8 minimum.
Pick-to: 6.10
Change-Id: Ic02179847c72c9d4ee967e4b9b4e9135a223163f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
QT_CONFIG() is easier to read than double navigation, and fails
for typos. So always prefer it over "ifndef QT_NO"
Pick-to: 6.10
Change-Id: I4e2324a999988fcc120a240193ba8f6bfd4baddc
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
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>
Clearly separate the parts dealing with the abstractviewer,
documentviewer targets, as well as the installation step.
Pick-to: 6.10
Change-Id: Ia824d7ca10d9a3810a185578c48b2bacc8fe3394
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
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>
The included CMakeLists.txt files are _not_ standalone projects,
so remove any project() as well as duplicated find_package() calls.
Pick-to: 6.10
Change-Id: Ia56128e19588d38eb3c91fac7e9a188f82146515
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This is a cleaner approach then manually tweaking the dependent targets
include directories.
Pick-to: 6.10
Change-Id: I8382f5556c950398e8a553a77f380922ed14ae9b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* 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>
Remove redundant translations for <number>% and use QLocale::percent()
instead.
Pick-to: 6.10
Change-Id: I6ddeceda6f723aae0c2a7f8338ce2d436ea434e2
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Adding a tooltip to only one of the action looks weird. As the
tooltip is not much better than the default text just remove.
Pick-to: 6.10
Change-Id: I26d76aa8c6ecdf9b8d9fadd8efa2afe4b898adac
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Previously, only the imageviewer plugin had a retranslate() method,
which meant that when switching languages, UI texts in other plugins
(jsonviewer, txtviewer, pdfviewer) would not be updated.
This change adds retranslate() methods to all plugins that contain
translatable UI text:
- jsonviewer: Updates menu titles, toolbar titles, actions, tab titles,
and bookmark tooltips
- txtviewer: Updates menu titles, toolbar titles, and action texts/tooltips
- pdfviewer: Updates toolbar title, action texts/tooltips, and tab titles
Each plugin now stores references to UI elements that need retranslation
and implements the retranslate() method to update all translatable text
when the language is changed.
Fixes: QTBUG-138344
Pick-to: 6.10
Change-Id: I9d294694a42c2c48e03b72e28e9c0f4015cd5c80
Reviewed-by: Masoud Jami <masoud.jami@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
When switching languages in the UI, plugin texts were not correctly
translated because only the main window translator was updated with
the new language. Plugin translators kept their original language.
Fixes: QTBUG-138344
Pick-to: 6.10
Change-Id: Ie1d2e7947b9125b1889d40ed4e6e1c8adff21249
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Masoud Jami <masoud.jami@qt.io>
Using the 'New' shortcut in this context is misleading,
and assigning it twice to opposite actions doesn't make
much sense, either. Just remove.
Pick-to: 6.10
Change-Id: Ied88319d4f874008ceb2a83f12556cd1fc3e2c88
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Use 'Exit' instead of 'Quit'. This is more common on Windows,
and on macOS we adapt to the system menu, anyhow.
* Use Keyboard shortcuts where it makes sense.
Pick-to: 6.10
Change-Id: Ied972bccef685b97cd01ca3fa41c7e6507eda041
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
The toolbar was broken in that the pixmap path to magnifier.png was
wrong. With the path enabled, the magnifier looked alien between the
other icons that are retrieved from the system style.
While this could be fixed easily, the acutal search functionality
would've required much more work. As is, the search via
QTV::keybardSearch() is quite limited:
* Only the first columns with the JSON keys are searched
* The text is matched only to the beginning of the column
text, you cannot search for texts in between or at the end of the
key.
* Only expanded rows are searched.
All in all, this makes the search appear rather broken. Let's just
remove it.
Pick-to: 6.10
Change-Id: Ie58b88e2ff6327d703094f108eab94b083012e16
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
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>
If you switch languages before any file has been opened,
the example did crash.
Pick-to: 6.10
Change-Id: Ib4675b428026a3c12c165a4b458de2c527cd1fbd
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This patch replaces the SVG icons with Qt minimalistic icons and
resolves the warnings about the non-supported SVG properties.
Fixes: QTBUG-138169
Pick-to: 6.10 6.9 6.8
Change-Id: Ib290c15d1498945149ba4425062268619bfe2a33
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Avoid creating and initializing the QLocale instance
in a global constructor. This is generally not recommended
for non-constinit types, and additionally causes a crash
on WebAssembly in the QLocale backend implementation.
Pick-to: 6.10
Change-Id: I720c60bf89d39434022f61e8d71de7b4e8610d8e
Reviewed-by: Masoud Jami <masoud.jami@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
This fixes a cmake warning that the output path does not match
The Q3DViewerModule target is a QML module with target path Q3DViewer. It
uses an OUTPUT_DIRECTORY of
$HOME/dev/qt/dev/src/qtdoc/examples/demos/documentviewer/build/Qt_6_10_0_build-Debug/plugins/q3dviewer,
which should end in the same target path, but doesn't. Tooling such as
qmllint may not work correctly.
Pick-to: 6.9
Change-Id: I33e402a52e3ee5747da428b9a74121e35345f63d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
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>
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>
Since qtbase/b8f588bea74aae0a890e1af18b936b0bfbf8c237
removed the QtWidgets image viewer example, there
is no way to exercise the image plugins.
Re-add the code as documentviewer plugin.
Pick-to: 6.9
Change-Id: I0eb26d02a9c11cdb0fce315ffc6f7c662e98c924
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
The txtviewer plugin example is part of the documentviewer example but
at the same time a separate example with its own documentation page.
That means it appears on Qt Creator's Welcome Page and must be buildable
standalone.
Add the usual CMake stanza for standalone projects to the top of the
project file.
Pick-to: 6.8 6.9
Task-number: QTBUG-132738
Change-Id: Ib5aad765ec5dbc2406df6b1cca574a20448f6529
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
displayModel.handleBoundsChanged() didn't take an argument and always
handled the bounds of the display model. If a RuntimeLoader was used,
the object was out of bounds.
Make the function take a bounds argument and pass the right bounds to
be handled.
Task-number: QTBUG-119176
Pick-to: 6.7
Change-Id: I8a9986d9ebea14dea2246f02937fe47bbcf95191
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
q3dviewer was missing as a plugin target in the example's
CMakeLists.txt.
Pick-to: 6.7 6.6
Change-Id: I1ec6791198551c45cbc1e2efaf4c7d2fd8792bcd
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Amend ba61af0bf3 and install the
abstractviewer library so that demo works after being deployed.
Pick-to: 6.7 6.6
Change-Id: I481b1d655d5666e11eef4d4aee99359750913750
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>