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>
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>
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>
* 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>
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 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>
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>
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>
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>
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>
Update code snippets to use JsonViewer as an example.
Add a section about loading plugins.
Task-number: QTBUG-119981
Pick-to: 6.7
Change-Id: Ied3dcba02ad275d16535ab015c49ce03ec0a0e30
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Make the abstract viewer class static if the build is static, shared
otherwise.
Fixes: QTBUG-118754
Fixes: QTBUG-118672
Pick-to: 6.6
Change-Id: Ic98c932b6c91242e79b022a38653f434b108330d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
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>
Remove definitions of onActionOpenTriggered() and
onActionQuitTriggered(), the implementation of which has been removed.
Change the required binary directory from "macOS" to "MacOS", to find
plugins correctly.
Fixes: QTBUG-117694
Pick-to: 6.6
Change-Id: Iba7d7c07e2881d2e8c4dce4b58f34a6441e8b467
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The plugin dlls are located in the "app" subdirectory of the
executable's path.
Search there.
Fixes: QTBUG-117691
Pick-to: 6.6 6.6.0
Change-Id: I467e90344e0a85384e8e06393fe41a98f1904bfc
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
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>
A document viewer typically uses read-only.
Pick-to: 6.6
Change-Id: Ic5a601c0b5af9d0e97a47368d71e8daa9e5e0244
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Remove unused values and introduce Other for a number of RemoveReasons.
Pick-to: 6.6
Change-Id: I6ea170cac0dc04d0b5d9326441be5519ad544ba0
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Inheriting containers is considered bad practice and also not
possible in Python.
As a drive-by, change the loop removing dangling files and duplicates
from range based for to index-based, as actually removing a file
would invalidate end().
Pick-to: 6.6
Change-Id: I826aebe1000d412d94e63a0564db7485b9550ca5
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Add a .qrc file, which can be browsed in Qt Creator.
Remove the hard-coded build paths from the .ui file, which prevents
it from being used for Qt for Python.
Pick-to: 6.6
Task-number: PYSIDE-2206
Change-Id: I4ed7de87c79c964da1d0adaa9330fbab137de1e8
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This unearthes that JSON should convert from UTF-8.
Pick-to: 6.6
Change-Id: If155b745cac0579232b927a3988588204c31d207
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
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>
Try to avoid concatenating translated texts and parameters; this may
not work in all languages. Use QDir::toNativeSeparators() for file
names.
Pick-to: 6.6
Change-Id: I00c058a91cab04c04580045229350ba3d9951d5e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
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>