summaryrefslogtreecommitdiffstats
path: root/examples/applicationmanager/multi-views/doc/src/multi-views.qdoc
blob: 959b3dd7fc47592b883ed494ee5fdda09ca75e72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/****************************************************************************
**
** Copyright (C) 2019 Luxoft Sweden AB
** Copyright (C) 2018 Pelagicore AG
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Luxoft 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/multi-views
\brief Learn how to render a WindowObject using multiple WindowItems.
\ingroup applicationmanager-examples
\title Multiple Views per Window System UI Example
\image multi-views.png

\section1 Introduction

This example shows you how to assign the same WindowObject to multiple WindowItems, resulting in
the same surface being rendered multiple times on screen. The example also illustrates the pros
and cons of a primary window.

\b Prerequisites: You're already familiar with the concepts and topics introduced in the
   \l{Animated Windows System UI Example}.

The button on the top left of the screen shows an icon, a cog, for the only built-in application
in this example. Overlayed on this icon is the action taken when you click on it. \uicontrol Start
is shown when the application is not running, and clicking on it calls
\l{ApplicationObject::start}{ApplicationObject.start}. Otherwise, the button shows \uicontrol Stop
and the corresponding action is taken when clicked.

When the application starts, its sole window is shown, decorated with a title bar and borders.
The title bar displays \uicontrol Primary if \l{WindowItem::primary}{WindowItem.primary} is true;
\uicontrol Secondary otherwise.

Then, comes the name of the application that created the window, which in this case is \b App1.
On the far left of a window's title bar is a minus button (-) that destroys its WindowItem. On the
far right, there's a plus (+) button that creates a new WindowItem and assigns the same
WindowObject to it. Finally, for secondary WindowItems, there's also a \uicontrol P button on the
right of the title bar that sets the \l{WindowItem::primary}{primary} property of that WindowItem
to true.

When you click on a window, its background color turns red. So when you click on the
\l{WindowItem::primary}{primary} WindowItem you'll see that the event reaches the application,
since the window's background color becomes red. But if you create one or more secondary
WindowItems and click on them, you will notice that these secondary windows don't flash red, as
secondary WindowItems do not forward input events to the WindowObjects they render.
*/