added test / more docs

This commit is contained in:
Thijs Wenker 2018-07-04 02:49:20 +02:00
parent 3f6793b462
commit 3a32472b0b
4 changed files with 40 additions and 2 deletions

View file

@ -102,8 +102,8 @@ Windows.Window {
shown = false; shown = false;
if (nativeWindow) { if (nativeWindow) {
contentHolder.parent = nativeWindow.contentItem; contentHolder.parent = nativeWindow.contentItem;
nativeWindow.setVisible(interactiveWindowVisible);
updateInteractiveWindowPositionForMode(); updateInteractiveWindowPositionForMode();
nativeWindow.setVisible(interactiveWindowVisible);
} }
} else if (presentationMode === modeNotSet) { } else if (presentationMode === modeNotSet) {
console.error("presentationMode should be set."); console.error("presentationMode should be set.");

View file

@ -24,6 +24,11 @@
* *
* @hifi-interface * @hifi-interface
* @hifi-client-entity * @hifi-client-entity
*
* @property {number} width
* @property {number} height
* @property {number} ALWAYS_ON_TOP - InteractiveWindow flag for always showing a window on top
* @property {number} CLOSE_BUTTON_HIDES - InteractiveWindow flag for hiding the window instead of closing on window close by user
*/ */
class DesktopScriptingInterface : public QObject, public Dependency { class DesktopScriptingInterface : public QObject, public Dependency {
Q_OBJECT Q_OBJECT

View file

@ -42,7 +42,6 @@ using namespace InteractiveWindowEnums;
/**jsdoc /**jsdoc
* @class InteractiveWindow * @class InteractiveWindow
* @hideconstructor
* *
* @hifi-interface * @hifi-interface
* @hifi-client-en * @hifi-client-en

View file

@ -0,0 +1,34 @@
//
// interactiveWindowTest.js
//
// Created by Thijs Wenker on 2018-07-03
// Copyright 2018 High Fidelity, Inc.
//
// An example of an interactive window that toggles presentation mode when toggling HMD on/off
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
function getPreferredPresentationMode() {
return HMD.active ? Desktop.PresentationMode.VIRTUAL : Desktop.PresentationMode.NATIVE;
}
function getPreferredTitle() {
return HMD.active ? 'Virtual Desktop Window' : 'Native Desktop Window';
}
var virtualWindow = Desktop.createWindow(Script.resourcesPath() + 'qml/OverlayWindowTest.qml', {
title: getPreferredTitle(),
flags: Desktop.ALWAYS_ON_TOP,
presentationMode: getPreferredPresentationMode(),
size: {x: 500, y: 400}
});
HMD.displayModeChanged.connect(function() {
virtualWindow.presentationMode = getPreferredPresentationMode();
virtualWindow.title = getPreferredTitle();
});
Script.scriptEnding.connect(function() {
virtualWindow.close();
});