Multiple Views per Window System-UI Example

A WindowObject being rendered by multiple WindowItems.

This example shows that it is possible to assign the same WindowObject to multiple WindowItems (so that you get the same surface being rendered multiple times on the screen) and the difference between being a primary WindowItem or not. Its implementation builds on top of the Animated Windows System-UI Example.

The button on the top left of the screen shows the icon (a cog) of the only built-in application of this example. Overlayed on the icon is the action taken when you click on it. "Start" will be shown when the application is not running, and clicking on it will call ApplicationObject.start. Otherwise it will show "Stop" and the corresponding action will be executed when clicked.

Once the application is started, its sole window will be shown, decorated with a title bar and borders. The title bar displays "Primary" if WindowItem.primary is true or "Secondary" otherwise. Then comes the name of the application that created the window, which in this example is called simply "App1". On the far left of a window's title bar is a "-" button that destroys its WindowItem and on the far right a "+" button that creates a new WindowItem and assigns the same WindowObject to it. Finally, in case of secondary WindowItems, there will also be a "P" button on the right side of the title bar that sets the primary property of that WindowItem to true.

The background color of the window turns red when pressed. So when you click over the primary WindowItem you will see that the event reaches the application since it sets the background color of its window to red. But if you create one or more secondary WindowItems and click on them you will notice that these secondary windows won't flash red, as secondary WindowItems do not forward input events to the WindowObjects they render.

Files:

Images:

© 2019 Luxoft Sweden AB. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.