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
|
// Copyright (C) 2021 The Qt Company Ltd.
// Copyright (C) 2019 Luxoft Sweden AB
// Copyright (C) 2018 Pelagicore AG
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\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.
*/
|