diff options
Diffstat (limited to 'examples/applicationmanager/application-features/doc/src/application-features.qdoc')
-rw-r--r-- | examples/applicationmanager/application-features/doc/src/application-features.qdoc | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/examples/applicationmanager/application-features/doc/src/application-features.qdoc b/examples/applicationmanager/application-features/doc/src/application-features.qdoc new file mode 100644 index 00000000..f0276c2d --- /dev/null +++ b/examples/applicationmanager/application-features/doc/src/application-features.qdoc @@ -0,0 +1,134 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Luxoft Sweden AB +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Application Manager. +** +** $QT_BEGIN_LICENSE:FDL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + +\example applicationmanager/application-features +\title Application Features Example +\image application-features.png +\brief Showcases client applications with various features, including a native application. +\ingroup applicationmanager-examples + +\section1 Introduction + +This example demonstrates how to implement some particular features you may require in an +application, such as: + +\list + \li how to implement a nested compositor + \li how to simulate a crash and recover from it + \li how to show multiple top-level windows simultaneously + \li how to use the native runtime, with no QML + +\endlist + +Most of these features are only supported properly in +\l{Single-Process vs. Multi-Process Mode}{multi-process mode}. + +\note This example focuses on the application (client) side. The \l{The System UI}{System UI} +(compositor/server) is based on the \l{Desktop System UI Example} with some modifications. Refer +to that example for more details on how to implement a System UI. + +\section2 Nested Compositor + +The nested compositor application shows how to implement a Wayland compositor inside an application +(Wayland client) window. The compositor is implemented in pure QML and kept to a minimum. To +display Wayland clients within this compositor, you need to set the \c WAYLAND_DISPLAY environment +variable appropriately. + +To start a client with this environment variable set via command line: + +\badcode +WAYLAND_DISPLAY=qtam-wayland-nested qmlscene client.qml -platform wayland +\endcode + +This command only works in multi-process mode, since the nested compositor needs a real window as +its root element. + +The QML code for the nested compositor application is as follows: + +\quotefromfile applicationmanager/application-features/apps/compositor/compositor.qml +\skipto import QtQuick 2.11 +\printuntil /^\}/ + +\section2 Crash Simulation and Recovery + +This application provides various means to force a crash in an application, such as a segmentation +fault. It utilizes a QML plugin implemented in C++, to provide the \c Terminator QML type to +trigger crashes. The application manager then prints the cause of the crash and related +information, like a backtrace. The System UI implements a basic form of crash recovery: restarting +the application. + +This application only works on multi-process mode. In single-process mode a crash affects the entire +program (the System UI). + +The QML code for the crash simulation and recovery application is as follows: + +\quotefromfile applicationmanager/application-features/apps/crash/crashapp.qml +\skipto import QtQuick 2.11 +\printuntil case "gracefully": Terminator.exitGracefully(); break; +\printuntil /^\}/ + +\section2 Two Top-Level Windows + +This application illustrates how you can display multiple top-level windows by having a QtObject +as the application's root element. + +The QML code for the two top-level windows application is as follows: + +\quotefromfile applicationmanager/application-features/apps/twins/twins.qml +\skipto import QtQuick 2.11 +\printuntil Component.onCompleted: setWindowProperty("type", "pop-up"); +\printuntil /^\}/ + +\section2 Native Widgets + +This application is based on \l{QWidget}s. Compared to the other applications in this example, +which are QML applications, this one uses the native runtime. Consequently, the application's entry +point isn't a \c{main.qml} file, but an executable. This application is a basic application that +still adheres to this particular System UI. It's meant to illustrate the concept: the System UI +needs a \c type window property to differentiate between normal windows and popups. + +This application only works in multi-process mode, as application processes cannot be started in +single-process mode. + +The C++ code for the native widgets application is as follows: + +\quotefromfile applicationmanager/application-features/native/widgets/main.cpp +\skipto #include <QApplication> +\printuntil /^\}/ + +\section1 Code Structure + +Compared to the other Qt Application Manager Examples, which are purely based on QML, this example +requires you to build it explicitly. The code is structured in a way where the resulting application +folders only contain the artifacts necessary to run the application. Consequently, you can package +these applications and install them as well. + +To build Qt Application Manager including its examples, you need to pass \c qmake the +\c{-config enable-examples} parameter For more details, see \l{build}{Build}. +*/ |