Commit Graph

60 Commits

Author SHA1 Message Date
Samuli Piippo 22315147d0 CMake: fix installation of demos projects
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>
2024-01-25 15:13:29 +02:00
Axel Spoerl 85ff73b5ff Documentviewer/Q3DViewer: pass correct bounds argument
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>
2024-01-25 11:00:25 +01:00
Jaishree Vyas d741f3d9cb Doc: Create separate Graphics Multimedia example categories
Fixes: QTBUG-117884
Pick-to: 6.6 6.7
Change-Id: I52b36360e4967efc6da74972218b7496c7830291
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2024-01-16 14:40:08 +01:00
Axel Spoerl 57b2d37b47 Documentviewer: Add q3dviewer as a conditional plugin target
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>
2024-01-09 22:56:02 +00:00
Samuli Piippo f80bee1a42 documentviewer: fix deployment of abstractviewer library
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>
2024-01-08 17:14:44 +02:00
Axel Spoerl 0e35a8eaf1 Plugin documentation: Refer to Document Viewer Demo
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>
2023-12-20 11:28:58 +01:00
Axel Spoerl 7a14d2ab93 Documentviewer demo / Quick3dViewer: Don't re-use quick view
The quick view used to display 3d files in a widgets application was
being re-used. If another viewer is launched and its contents become
visible in the main window scroll area, the quick view's window
container gets deleted, which causes deletion of the quick view as
well.

That makes the application crash, if an .obj file is viewed, followed
by another file type and then .obj again. The latter will crash.

=> Don't re-use the quick view any more.

Fixes: QTBUG-119175
Pick-to: 6.7 6.6
Change-Id: Ieea54f0a3377dfbc9ff3a07e5b99c80b472e5658
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-12-13 17:17:22 +01:00
Axel Spoerl eea2929d84 Documentviewer: Make AbstractViewer shared/static, depending on build
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>
2023-11-23 14:29:03 +01: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
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
Axel Spoerl 16d096709f Documentviewer demo: Darwin fixes
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>
2023-10-04 15:26:39 +02:00
Axel Spoerl f906b6f0e6 Documentviewer Demo: fix plugin search on Windows
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>
2023-10-02 07:01:58 +00: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
Topi Reinio f39470f7cd Doc: Add missing \image command to Text Viewer Plugin Example
Fixes documentation warning:

(qdoc) warning: demos/documentviewer/plugins/txtviewer:
    Example documentation should have at least one '\image'

Pick-to: 6.6
Change-Id: I6ceee59e42358c7fb67c332529d184d99e103513
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
2023-08-29 14:31:45 +00:00
Topi Reinio d9561a5e6e Doc: Fix documentation issues
Fix link targets for section titles that are incorrect or were changed
elsewhere in the documentation.

Also,

doc/src/howtos/installer-cli.qdoc:

* Style double-dash in the section title with \tt. Without \tt, QDoc
  interprets -- as 'en dash'; the output is incorrect and the special
  character also prevents linking to the section title.

examples/demos/documentviewer/doc/src/txtviewer.qdoc:

* Add missing end delimiter for the comment block, and fix linking to
  the parent example (Document Viewer).

Pick-to: 6.6
Change-Id: Ic660fa66e6ce87046664771349e3720f51c90352
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
2023-08-29 12:38:38 +00:00
Inkamari Harjula aa5a3ae5d6 Doc: Add example categories to qtdoc examples
Added categories to qtdoc examples.

Task-number: QTBUG-116430
Pick-to: 6.5 6.6
Change-Id: I91adf8b2d4af083181b2203da8dec44d6b17f606
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-08-28 10:47:07 +03:00
Friedemann Kleint de79604a91 DocumentViewer demo: Remove code making the JSON model editable
It is a viewer after all, with no save functionality.

Pick-to: 6.6
Change-Id: I9a6f2c2809719abe33238b23a30cc9a06dc43c19
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-07-05 11:57:26 +02: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
Friedemann Kleint 09cb56314c DocumentViewer demo: Actually build the PDF plugin
Pick-to: 6.6
Change-Id: I29f7dacd1c57d87505894e54918c5d2f53626378
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-07-05 09:06:11 +02: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 9c7d96e376 DocumentViewer demo: Remove OpenMode from class RecentFiles
A document viewer typically uses read-only.

Pick-to: 6.6
Change-Id: Ic5a601c0b5af9d0e97a47368d71e8daa9e5e0244
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-07-03 16:10:36 +02:00
Friedemann Kleint 07fbbb3bec DocumentViewer demo: Streamline enumerations of class RecentFiles
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>
2023-07-03 16:10:36 +02:00
Friedemann Kleint 7f3ffeee2f DocumentViewer demo: Remove unused signals of class RecentFiles
Pick-to: 6.6
Change-Id: I28c634948b802454e523409d60eafce7e8b9ed20
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-07-03 16:10:36 +02: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
Friedemann Kleint 2378671318 DocumentViewer demo: Do not derive class RecentFiles from QStringList
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>
2023-07-03 16:10:36 +02:00
Friedemann Kleint 01505ae868 DocumentViewer demo: Remove unused <concepts> include
MSVC is complaining about it.

Pick-to: 6.6
Change-Id: Ifd85c48971cef5b62fbac4d1d5901a066c8d511c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-06-29 14:01:59 +02:00
Friedemann Kleint 96fadad46a DocumentViewer demo: Introduce a .qrc file
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>
2023-06-27 15:17:22 +02:00
Axel Spoerl c56673c241 Replace Application example by documentviewer's TxtViewer plugin
This patch adds a snippet based documentation of TxtViewer's code with
the target to replace the Application example in widgets.

Pick-to: 6.6
Change-Id: I25045c8f710ae110398e71099c276571cb32ecf3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-06-26 16:06:31 +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 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
Topi Reinio dc659775c4 Doc: Fix file quoting in Document Viewer demo
Adapt the file quoting command in the documentation to match changes
in the source code.

Pick-to: 6.6
Change-Id: I6f3a93b4efff8df8d7cd6f8244b610b1ad93e4ba
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-06-21 11:34:19 +00: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
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 a212b57f25 DocumentViewer demo: Fix tr() usage
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>
2023-06-20 16:04:37 +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
Friedemann Kleint c35c18ff2c DocumentViewer demo: Some modernization
Pick-to: 6.6
Change-Id: I2169e8a109f30b6e4f18a4e2bce9d529c0096a5a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-06-20 14:53:55 +02:00
Friedemann Kleint 6d1c824061 DocumentViewer demo: Fix print support
Pick-to: 6.6
Change-Id: I1b9a73ee39838bef7b1d535d2ff99dfd0f71dea8
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-06-20 14:53:14 +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 6cefb818b3 DocumentViewer demo: Don't rely on Qt Designer standard icons
Not all standard icons provided Qt Designer are visible in macOS.
(e.g. docoment-open, document-open-recent)

This patch ships fallback icons with the example.

Fixes: QTBUG-114620
Pick-to: 6.6
Change-Id: Id133ce4ae1c77bff411cd07c2b2b2ef1f62d4336
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-06-20 04:37:17 +02:00
Axel Spoerl 394839e0d4 DocumentViewer demo: Warn about unsupported mime type before defaulting
When a file is opened and its mime type is not supported, the demo
falls back to TxtViewer.

This patch adds a warning popup to notify the user in that case.

Fixes: QTBUG-114614
Pick-to: 6.6
Change-Id: I5794d0013ecaac37934ac56c4a642998baa65e0a
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-06-20 04:37:17 +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
Paul Wicking 1261ff785c Doc: Fix typo in demo
s/thow/the

Task-number: QTBUG-114618
Pick-to: 6.6 6.5
Change-Id: I39b770063e8ee33f84cf348ca7655a4ee6033b38
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
2023-06-17 16:34:44 +02:00
Kai Köhne e1220042e6 Doc: Add more examples to Application Examples category
Add following examples to Application Examples category:

* Robot Arm Example
* Qt Quick Demo - RESTful Color Palette API client
* Media Player Example
* Document Viewer

Pick-to: 6.5 6.6
Change-Id: Ie36bb9a09d7fe868db07e02edcb1778f214494e9
Reviewed-by: Kimmo Leppälä <kimmo.leppala@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2023-06-15 11:07:40 +02:00
Alexandru Croitor 0482f46a46 CMake: Clean up the CMakeLists.txt file a bit
Remove the commented out find_package.
Remove the redundant CMAKE_AUTOMOC assignment, because
qt_standard_project_setup was already called.

Pick-to: 6.5 6.6
Change-Id: I20f60541377153febd28413450b4af7b07d4e41c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-06-08 09:55:03 +02:00
Alexandru Croitor 54200de405 Fix build of documentviewer example
Due to a missing qt_standard_project_setup call, AUTOMOC was never
enabled which led to undefined symbol issues at link time.

Remove documentWasModified slot declaration because it didn't have a
definition, and it was not referenced by anything in the code.

Pick-to: 6.5 6.6
Fixes: QTBUG-114365
Change-Id: Ib6938163be1a1fdc0bb6f4a925878ec1b309d03e
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-06-08 09:55:01 +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
Topi Reinio 8f66cabc1d Doc: Update documentation for Document Viewer demo
The source code has seen multiple revisions and the documentation
was referring to types and implementation details that no longer
exist or hold true.

Reorganize the content, simplify the language, and fix the source
file quoting.

Change-Id: If22c052460b4dc2f1e321eb423c6f2a415cd26f5
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
2023-05-10 07:44:05 +00:00
Joerg Bornemann 0d750c07a7 Fix documentviewer build when PdfWidgets is missing
Task-number:QTBUG-113377

Change-Id: I4274c0a6b8d42b0949e0c7fa18b654a898d25e3a
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-05-08 17:23:06 +00:00