diff options
Diffstat (limited to 'examples/demos/documentviewer/doc')
-rw-r--r-- | examples/demos/documentviewer/doc/abstractviewer.py.rstinc | 25 | ||||
-rw-r--r-- | examples/demos/documentviewer/doc/documentviewer.png | bin | 0 -> 22897 bytes | |||
-rw-r--r-- | examples/demos/documentviewer/doc/documentviewer.rst | 13 | ||||
-rw-r--r-- | examples/demos/documentviewer/doc/jsonviewer.py.rstinc | 11 | ||||
-rw-r--r-- | examples/demos/documentviewer/doc/mainwindow.py.rstinc | 11 | ||||
-rw-r--r-- | examples/demos/documentviewer/doc/viewerfactory.py.rstinc | 3 |
6 files changed, 63 insertions, 0 deletions
diff --git a/examples/demos/documentviewer/doc/abstractviewer.py.rstinc b/examples/demos/documentviewer/doc/abstractviewer.py.rstinc new file mode 100644 index 000000000..4c040b956 --- /dev/null +++ b/examples/demos/documentviewer/doc/abstractviewer.py.rstinc @@ -0,0 +1,25 @@ +``AbstractViewer`` provides a generalized API to view, save, and print a +document. Properties of both the document and the viewer can be queried: + + * Does the document have content? + * Has it been modified? + * Is an overview (thumbnails or bookmarks) supported? + +``AbstractViewer`` provides protected methods for derived classes to create +actions and menus on the main window. In order to display these assets on the +main window, they are parented to it. ``AbstractViewer`` is responsible for +removing and destroying the UI assets it creates. It inherits from ``QObject`` +to implement signals and slots. + +The ``uiInitialized()`` signal is emitted after a viewer receives all necessary +information about UI assets on the main window. + +The ``printingEnabledChanged()`` signal is emitted when document printing is +either enabled or disabled. This happens after a new document was successfully +loaded, or, for example, all content was removed. + +The ``printStatusChanged`` signal notifies about changes in its progress after +starting the printing process. + +The ``documentLoaded()`` signal notifies the application that a document was +successfully loaded. diff --git a/examples/demos/documentviewer/doc/documentviewer.png b/examples/demos/documentviewer/doc/documentviewer.png Binary files differnew file mode 100644 index 000000000..750aca589 --- /dev/null +++ b/examples/demos/documentviewer/doc/documentviewer.png diff --git a/examples/demos/documentviewer/doc/documentviewer.rst b/examples/demos/documentviewer/doc/documentviewer.rst new file mode 100644 index 000000000..b21e3f43e --- /dev/null +++ b/examples/demos/documentviewer/doc/documentviewer.rst @@ -0,0 +1,13 @@ +Document Viewer Example +======================= + +A Widgets application to display and print JSON, text, and PDF files. + +Document Viewer demonstrates how to use a QMainWindow with static +and dynamic toolbars, menus, and actions. + + +.. image:: documentviewer.png + :width: 90% + :align: center + :alt: Document Viewer Example diff --git a/examples/demos/documentviewer/doc/jsonviewer.py.rstinc b/examples/demos/documentviewer/doc/jsonviewer.py.rstinc new file mode 100644 index 000000000..1ba92f247 --- /dev/null +++ b/examples/demos/documentviewer/doc/jsonviewer.py.rstinc @@ -0,0 +1,11 @@ +``JsonViewer`` displays a JSON file in a ``QTreeView``. Internally, it loads +the contents of a file into a data structure via a string and uses it to +populate a custom tree model with JsonItemModel. + +The JSON viewer demonstrates how to implement a custom item model +inherited from ``QAbstractItemModel``. + +``JsonViewer`` uses the top-level objects of the document as bookmarks for +navigation. Other nodes (keys and values) can be added as additional bookmarks, +or removed from the bookmark list. A ``QLineEdit`` is used as a search field to +navigate through the JSON tree. diff --git a/examples/demos/documentviewer/doc/mainwindow.py.rstinc b/examples/demos/documentviewer/doc/mainwindow.py.rstinc new file mode 100644 index 000000000..976443ceb --- /dev/null +++ b/examples/demos/documentviewer/doc/mainwindow.py.rstinc @@ -0,0 +1,11 @@ +The ``MainWindow`` class provides an application screen with menus, actions, +and a toolbar. It can open a file, automatically detecting its content type. It +also maintains a list of previously opened files, using ``QSettings`` to store +and reload settings when launched. The ``MainWindow`` creates a suitable viewer +for the opened file, based on its content type, and provides support for +printing a document. + +``MainWindow's`` constructor initializes the user interface created in Qt +Designer. The ``mainwindow.ui`` file provides a ``QTabWidget`` on the left, +showing bookmarks and thumbnails. On the right, there is a ``QScrollArea`` for +viewing file content. diff --git a/examples/demos/documentviewer/doc/viewerfactory.py.rstinc b/examples/demos/documentviewer/doc/viewerfactory.py.rstinc new file mode 100644 index 000000000..1627a576b --- /dev/null +++ b/examples/demos/documentviewer/doc/viewerfactory.py.rstinc @@ -0,0 +1,3 @@ +The ``ViewerFactory`` class manages viewers for known file types. It loads all +available viewers on construction and provides a public API to query the loaded +plugins, their names, and supported MIME types. |