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>
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>
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>
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>
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>
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>
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>
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>
Apparently, QPdfViewer needs an open file.
Pick-to: 6.6
Change-Id: I891f6eeb5a96344bdfce483e77c67b80b1666676
Reviewed-by: Axel Spoerl <axel.spoerl@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 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>
This unearthes that JSON should convert from UTF-8.
Pick-to: 6.6
Change-Id: If155b745cac0579232b927a3988588204c31d207
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Follow the naming style of the other examples, and just name the example
page 'Document Viewer'.
Also remove the page from the group mainwindow-classes, at is - quite
evidently - not a class. Instead, add it to the list of widgets examples.
Pick-to: 6.5
Change-Id: Ic54640a2da4e549e389056e6c504238040d24985
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This patch updates the documentation with regard to the plugin
architecture implementation and new helper classes.
Task-number: QTBUG-111925
Change-Id: I776470c84c492eeff973d6ac535374de679c03e5
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Use e.g. Qt6::Core instead of Qt::Core. This is better matching the
find_package(Qt6 ...) call, and also avoids issues that the versionless
targets have.
Pick-to: 6.5
Task-number: QTBUG-113277
Change-Id: I9bc7963d8524ef2ab061e32aef428711646247a7
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
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>
The document viewer demo uses QPdfPageSelector, which is available in
Qt 6.6 but not in 6.5. This is why the demo fails to compile in 6.5.
This patch adds ifdef'ry in order to compile without QPdfPageSelector
in 6.5.
Fixes: QTBUG-111982
Pick-to: 6.5 6.5.0
Change-Id: Iaad3e5705bba784b0ce69a7f6ddfabfbe4148e84
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This patch removes two unused data members and fixes
a documentation typo.
Pick-to: 6.5 6.5.0
Change-Id: I79fd66c727f2af54f1e13a33f8da2895b587663b
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Add a demo with a combined viewer for Json, pdf and text documents.
The example demonstrates how to create an application, utilizing
a main window with static and dynamic toolbars, menus and actions.
Type specific viewers inherit from an abstract viewer class.
The Json viewer implements an abstract tree model for QJsonDocument.
The example demonstrates a few useful application features, implemented
with QtWidgets and QSettings, to (re)store properties:
- Detecting file content types with QMimeDatabase
- Changing and restoring override cursor when hovering over a widget.
- Basic printing support.
Pick-to: 6.5 6.5.0
Change-Id: Ie411669cfdbc41ac399cd1aed87e60722195c42c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>